diff options
Diffstat (limited to 'tools/Linux/packaging')
-rw-r--r-- | tools/Linux/packaging/README.debian | 31 | ||||
-rw-r--r-- | tools/Linux/packaging/media/icon128x128.png | bin | 0 -> 3825 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon16x16.png | bin | 0 -> 690 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon22x22.png | bin | 0 -> 929 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon24x24.png | bin | 0 -> 979 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon256x256.png | bin | 0 -> 6729 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon32x32.png | bin | 0 -> 1264 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon48x48.png | bin | 0 -> 1698 bytes | |||
-rw-r--r-- | tools/Linux/packaging/media/icon64x64.png | bin | 0 -> 2297 bytes | |||
-rwxr-xr-x | tools/Linux/packaging/mk-debian-package.sh | 187 | ||||
-rwxr-xr-x | tools/Linux/packaging/package-kodi-launchpad.sh | 81 |
11 files changed, 299 insertions, 0 deletions
diff --git a/tools/Linux/packaging/README.debian b/tools/Linux/packaging/README.debian new file mode 100644 index 0000000..5e217d3 --- /dev/null +++ b/tools/Linux/packaging/README.debian @@ -0,0 +1,31 @@ +--- How to build a Kodi Debian package --- + +There are two available build methods: +1.) debuild / debhelper + Requirements: debhelper, devscripts, all Kodi build deps + sudo apt-get install debhelper devscripts + sudo apt-get build-dep kodi (if you have one of our repos/ppas added, else read docs/README.Linux.md or docs/README.Ubuntu.md) + + Result: Debian package for your host distribution and architecture only + Recommended for local installs + + Example Usage: ./mk-debian-package.sh + +2.) pdebuild / pbuilder + Requirements: pbuilder, devscripts, proper pbuilder environment + For a comprehensive example how to setup pbuilder read: + https://wiki.ubuntu.com/PbuilderHowto + + Result: Debian package for arbitrary Debian based distributions and architectures. + Recommended for hosting your own apt repository or (clean room) compile testing for various distributions + + Example Usage: + RELEASEV=16 \ + DISTS=-"unstable" \ + ARCHS="i386 amd64" \ + BUILDER="pdebuild" \ + PDEBUILD_OPTS="--debbuildopts \"-j4\"" \ + PBUILDER_BASE="/home/$USER/xbmc-packaging/pbuilder" \ + DPUT_TARGET="local" \ + ./mk-debian-package.sh + diff --git a/tools/Linux/packaging/media/icon128x128.png b/tools/Linux/packaging/media/icon128x128.png Binary files differnew file mode 100644 index 0000000..8a25c4a --- /dev/null +++ b/tools/Linux/packaging/media/icon128x128.png diff --git a/tools/Linux/packaging/media/icon16x16.png b/tools/Linux/packaging/media/icon16x16.png Binary files differnew file mode 100644 index 0000000..9b27352 --- /dev/null +++ b/tools/Linux/packaging/media/icon16x16.png diff --git a/tools/Linux/packaging/media/icon22x22.png b/tools/Linux/packaging/media/icon22x22.png Binary files differnew file mode 100644 index 0000000..21f76e5 --- /dev/null +++ b/tools/Linux/packaging/media/icon22x22.png diff --git a/tools/Linux/packaging/media/icon24x24.png b/tools/Linux/packaging/media/icon24x24.png Binary files differnew file mode 100644 index 0000000..dad983b --- /dev/null +++ b/tools/Linux/packaging/media/icon24x24.png diff --git a/tools/Linux/packaging/media/icon256x256.png b/tools/Linux/packaging/media/icon256x256.png Binary files differnew file mode 100644 index 0000000..cc2ee49 --- /dev/null +++ b/tools/Linux/packaging/media/icon256x256.png diff --git a/tools/Linux/packaging/media/icon32x32.png b/tools/Linux/packaging/media/icon32x32.png Binary files differnew file mode 100644 index 0000000..c0a0534 --- /dev/null +++ b/tools/Linux/packaging/media/icon32x32.png diff --git a/tools/Linux/packaging/media/icon48x48.png b/tools/Linux/packaging/media/icon48x48.png Binary files differnew file mode 100644 index 0000000..898c023 --- /dev/null +++ b/tools/Linux/packaging/media/icon48x48.png diff --git a/tools/Linux/packaging/media/icon64x64.png b/tools/Linux/packaging/media/icon64x64.png Binary files differnew file mode 100644 index 0000000..700144b --- /dev/null +++ b/tools/Linux/packaging/media/icon64x64.png diff --git a/tools/Linux/packaging/mk-debian-package.sh b/tools/Linux/packaging/mk-debian-package.sh new file mode 100755 index 0000000..ad81be0 --- /dev/null +++ b/tools/Linux/packaging/mk-debian-package.sh @@ -0,0 +1,187 @@ +#!/bin/bash +# +# Copyright (C) 2013 Team XBMC +# http://kodi.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XBMC; see the file COPYING. If not, see +# <http://www.gnu.org/licenses/>. +# + + +RELEASEV=${RELEASEV:-"auto"} +VERSION_PREFIX=${VERSION_PREFIX:-""} +TAG=${TAG} +TAGREV=${TAGREV:-""} +REPO_DIR=${WORKSPACE:-$(cd "$(dirname $0)/../../../" ; pwd)} +[[ $(which lsb_release) ]] && DISTS=${DISTS:-$(lsb_release -cs)} || DISTS=${DISTS:-"stable"} +ARCHS=${ARCHS:-$(dpkg --print-architecture)} +BUILDER=${BUILDER:-"debuild"} +DEBUILD_OPTS=${DEBUILD_OPTS:-""} +PDEBUILD_OPTS=${PDEBUILD_OPTS:-""} +PBUILDER_BASE=${PBUILDER_BASE:-"/var/cache/pbuilder"} +DPUT_TARGET=${DPUT_TARGET:-"local"} +DEBIAN=${DEBIAN:-"https://github.com/xbmc/xbmc-packaging/archive/master.tar.gz"} +BUILD_DATE=$(date '+%Y%m%d.%H%M') + +function usage { + echo "$0: This script builds a Kodi debian package from a git repository." + echo "The build is controlled by ENV variables, which can be overridden as appropriate:" + echo "BUILDER is either debuild(default) or pdebuild(needs a proper pbuilder setup)" + checkEnv +} + +function checkEnv { + echo "#------ build environment ------#" + echo "REPO_DIR: $REPO_DIR" + getVersion + echo "RELEASEV: $RELEASEV" + echo "REVISION: $TAGREV" + [[ -n $TAG ]] && echo "TAG: $TAG" + echo "DISTS: $DISTS" + echo "ARCHS: $ARCHS" + echo "DEBIAN: $DEBIAN" + echo "BUILDER: $BUILDER" + echo "CONFIGURATION: $Configuration" + + if ! [[ $(which $BUILDER) ]] + then + echo "Error: can't find ${BUILDER}, consider using full path to [debuild|pdebuild]" + exit 1 + fi + + if [[ "$BUILDER" =~ "pdebuild" ]] + then + if ! [[ -d $PBUILDER_BASE ]] ; then echo "Error: $PBUILDER_BASE does not exist"; exit 1; fi + echo "PBUILDER_BASE: $PBUILDER_BASE" + echo "PDEBUILD_OPTS: $PDEBUILD_OPTS" + else + echo "DEBUILD_OPTS: $DEBUILD_OPTS" + fi + + echo "#-------------------------------#" +} + +function getVersion { + getGitRev + if [[ $RELEASEV == "auto" ]] + then + local MAJORVER=$(grep VERSION_MAJOR $REPO_DIR/version.txt | awk '{ print $2 }') + local MINORVER=$(grep VERSION_MINOR $REPO_DIR/version.txt | awk '{ print $2 }') + RELEASEV=${MAJORVER}.${MINORVER} + else + PACKAGEVERSION="${RELEASEV}~git${BUILD_DATE}-${TAG}" + fi + + if [[ -n ${VERSION_PREFIX} ]] + then + PACKAGEVERSION="${VERSION_PREFIX}:${RELEASEV}~git${BUILD_DATE}-${TAG}" + else + PACKAGEVERSION="${RELEASEV}~git${BUILD_DATE}-${TAG}" + fi +} + +function getGitRev { + cd $REPO_DIR || exit 1 + REV=$(git log -1 --pretty=format:"%h") + [[ -z $TAG ]] && TAG=$REV + [[ -z $TAGREV ]] && TAGREV=0 +} + +function archiveRepo { + cd $REPO_DIR || exit 1 + git clean -xfd + echo $REV > VERSION + tools/depends/target/ffmpeg/autobuild.sh -d + DEST="kodi-${RELEASEV}~git${BUILD_DATE}-${TAG}" + [[ -d debian ]] && rm -rf debian + cd .. + tar -czf ${DEST}.tar.gz --exclude .git $(basename $REPO_DIR) + ln -s ${DEST}.tar.gz ${DEST/-/_}.orig.tar.gz + echo "Output Archive: ${DEST}.tar.gz" + + cd $REPO_DIR || exit 1 + getDebian +} + +function getDebian { + if [[ -d $DEBIAN ]] + then + cp -r $DEBIAN . + else + mkdir tmp && cd tmp + curl -L -s $DEBIAN -o debian.tar.gz + tar xzf debian.tar.gz + cd xbmc-packaging-* + for FILE in *.unified; do mv $FILE debian/${FILE%.unified}; done + mv debian $REPO_DIR + cd $REPO_DIR ; rm -rf tmp + fi +} + +function buildDebianPackages { + archiveRepo + cd $REPO_DIR || exit 1 + sed -e "s/#PACKAGEVERSION#/${PACKAGEVERSION}/g" -e "s/#TAGREV#/${TAGREV}/g" debian/changelog.in > debian/changelog.tmp + [ "$Configuration" == "Debug" ] && sed -i "s/XBMC_RELEASE = yes/XBMC_RELEASE = no/" debian/rules + + for dist in $DISTS + do + sed "s/#DIST#/${dist}/g" debian/changelog.tmp > debian/changelog + for arch in $ARCHS + do + cd $REPO_DIR + echo "building: DIST=$dist ARCH=$arch" + if [[ "$BUILDER" =~ "pdebuild" ]] + then + DIST=$dist ARCH=$arch $BUILDER $PDEBUILD_OPTS + [ $? -eq 0 ] && uploadPkg || exit 1 + else + $BUILDER $DEBUILD_OPTS + echo "output directory: $REPO_DIR/.." + fi + done + done +} + +function uploadPkg { + PKG="${PBUILDER_BASE}/${dist}-${arch}/result/${DEST/-/_}-${TAGREV}_${arch}.changes" + echo "signing package" + debsign $PKG + echo "uploading $PKG to $DPUT_TARGET" + dput $DPUT_TARGET $PKG + UPLOAD_DONE=$? +} + +function cleanup { + if [[ $UPLOAD_DONE -eq 0 ]] && [[ "$BUILDER" =~ "pdebuild" ]] + then + cd $REPO_DIR/.. || exit 1 + rm ${DEST}* + rm ${DEST/-/_}* + fi +} + +### +# main +### +if [[ $1 = "-h" ]] || [[ $1 = "--help" ]] +then + usage + exit +fi + +checkEnv +buildDebianPackages +cleanup + diff --git a/tools/Linux/packaging/package-kodi-launchpad.sh b/tools/Linux/packaging/package-kodi-launchpad.sh new file mode 100755 index 0000000..d6e7c51 --- /dev/null +++ b/tools/Linux/packaging/package-kodi-launchpad.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +releaseversion=${VERSION:-"AUTO"} +epoch=${EPOCH:-"2"} +gitrev=${GITREV:-"$(git log -1 --pretty=format:"%h")"} +tag=${TAG:-${gitrev}} +tagrev=${tagrev:-"0"} +dists=${DISTS:-"hirsute groovy focal bionic"} +gpgkey=${GPG_KEY:-"jenkins (jenkins build bot) <jenkins@kodi.tv>"} +ppa=${PPA:-"nightly"} +debianrepo="${DEBIAN:-"https://github.com/xbmc/xbmc-packaging"}" + +if [ "$releaseversion" = "AUTO" ]; then + majorversion="$(awk '/VERSION_MAJOR/ {print $2}' version.txt)" + minorversion="$(awk '/VERSION_MINOR/ {print $2}' version.txt)" + releaseversion="${majorversion}.${minorversion}" +fi + +version="${releaseversion}+git$(date '+%Y%m%d.%H%M')-${tag}" +debversion="${epoch}:${version}" +origtarball="kodi_${version}.orig.tar.gz" + +declare -A PPAS=( + ["nightly"]='ppa:team-xbmc/xbmc-nightly' + ["unstable"]='ppa:team-xbmc/unstable' + ["stable"]='ppa:team-xbmc/ppa' + ["wsnipex-nightly"]='ppa:wsnipex/kodi-git' + ["wsnipex-stable"]='ppa:wsnipex/kodi-stable' +) + +# clean up before creating the source tarball +git clean -xfd + +# set build info +date '+%Y%m%d' > BUILDDATE +echo $gitrev > VERSION + +# download packaging files +wget -O - ${debianrepo}/archive/master.tar.gz | tar xzv --strip-components=1 --exclude=".git*" -f - +[ -d debian ] || { echo "ERROR: directory debian does not exist"; exit 3; } + +# add tarballs for internal ffmpeg, libdvd +tools/depends/target/ffmpeg/autobuild.sh -d || { echo "Error downloading ffmpeg"; exit 2; } +make -C tools/depends/target/libdvdnav download || { echo "Error downloading libdvdnav"; exit 2; } +make -C tools/depends/target/libdvdread download || { echo "Error downloading libdvdread"; exit 2; } +make -C tools/depends/target/libdvdcss download || { echo "Error downloading libdvdcss"; exit 2; } +make -C tools/depends/target/dav1d download || { echo "Error downloading dav1d"; exit 2; } + +# create orig tarball if needed +if grep -q quilt debian/source/format; then + echo "origtarball: ${origtarball}" + git archive -o ../${origtarball} ${gitrev} +fi + + +# build source packages +for dist in ${dists//,/ }; do + echo "### Building for ${dist} ###" + sed \ + -e "s/#PACKAGEVERSION#/${debversion}/" \ + -e "s/#TAGREV#/${tagrev}/" \ + -e "s/#DIST#/${dist}/g" \ + debian/changelog.in > debian/changelog + + echo "Changelog:" + cat debian/changelog + echo + + debuild -d -S -k"${gpgkey}" + echo "### DONE ###" +done + +# upload to PPA +echo "### Uploading to PPA ${PPAS[${ppa}]} ###" +dput ${PPAS[${ppa}]} ../kodi_${version}*.changes +if [ $? -eq 0 ]; then + echo "### Successfully pushed ${version} to launchpad ###" +else + echo "### ERROR could not upload package ###" +fi + |