mkpkg: update mkpkg_kodi

- package kodi-platform
- package binary addons (pvr/audioencoders/audiodecoders/etc)
This commit is contained in:
Stefan Saraev 2015-04-03 11:56:45 +03:00
parent e12231ab81
commit 3a545181ea

View File

@ -21,42 +21,96 @@
PKG_NAME="kodi" PKG_NAME="kodi"
PKG_VERSION="" PKG_VERSION=""
GIT_REPO="-b master git://github.com/xbmc/xbmc.git" BRANCH="master"
DEST_DIR="$PKG_NAME" BRANCH_FOR_ADDONS="master"
GIT_REPO="git://github.com/xbmc/xbmc.git"
DEST_DIR="$PKG_NAME-$BRANCH"
echo "getting sources..." git_clone() {
if [ ! -d $DEST_DIR-latest ]; then # git_clone https://repo.url branch ./target_dir [githash]
git clone $GIT_REPO $DEST_DIR-latest echo "[mkpkg] Checking out $1 ..."
if [ ! -d "$3" ]; then
git clone "$1" -b $2 "$3"
else
if [ -d "$3" ] ; then
cd "$3"
git checkout $2 >/dev/null 2>/dev/null
git pull
if [ ! -z "$4" ] ; then
git branch -D $4 >/dev/null 2>/dev/null
git checkout $4 -b $4 >/dev/null 2>/dev/null
fi
cd ..
fi
fi fi
}
cd $DEST_DIR-latest copy_sources() {
git pull # copy_sources source_dir package_name package_version
if [ -d "$1" ] ; then
echo "[mkpkg] Copying sources: $2-$3" ...
rm -rf "$2-$3"
cp -R "$1" "$2-$3"
echo "$GIT_HASH" > "$2-$3/VERSION"
echo "getting version..." echo "[mkpkg] Cleaning $2-$3 ..."
GIT_REV=`git log -n1 --format=%h` rm -rf "$2-$3/.git"
echo $GIT_REV
cd ..
if [ -z "$PKG_VERSION" ]; then
PKG_VERSION="14-$GIT_REV"
fi fi
}
echo "copying sources..." package_sources() {
rm -rf $PKG_NAME-$PKG_VERSION # package_sources source_dir
cp -R $DEST_DIR-latest $PKG_NAME-$PKG_VERSION if [ -d "$1" ] ; then
echo "$GIT_REV" > $PKG_NAME-$PKG_VERSION/VERSION echo "[mkpkg] Packing $1.tar.xz ..."
if [ ! -f "$1.tar.xz" ] ; then
tar cvJf "$1.tar.xz" "$1"
fi
rm -rf "$1"
fi
}
echo "cleaning sources..." # kodi
rm -rf $PKG_NAME-$PKG_VERSION/.git git_clone $GIT_REPO $BRANCH $DEST_DIR.git
echo "seperating theme..." # kodi-platform
rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION REPO=$(cat $DEST_DIR.git/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | awk '{print $2}')
mv $PKG_NAME-$PKG_VERSION/addons/skin.confluence $PKG_NAME-theme-Confluence-$PKG_VERSION GIT_HASH=$(cat $DEST_DIR.git/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt | awk '{print $3}')
if [ ! -e kodi-platform-$GIT_HASH.tar.xz ] ; then
git_clone $REPO $BRANCH_FOR_ADDONS kodi-platform.git $GIT_HASH
copy_sources kodi-platform.git kodi-platform $GIT_HASH
package_sources kodi-platform-$GIT_HASH
else
echo "[mkpkg] kodi-platform-$GIT_HASH.tar.xz already exists ..."
fi
echo "packing sources..." # addons
tar cvJf $PKG_NAME-$PKG_VERSION.tar.xz $PKG_NAME-$PKG_VERSION for addon in $DEST_DIR.git/project/cmake/addons/addons/*.* ; do
tar cvJf $PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz $PKG_NAME-theme-Confluence-$PKG_VERSION PVR_ADDON=$(basename $addon)
REPO=$(cat $DEST_DIR.git/project/cmake/addons/addons/$PVR_ADDON/$PVR_ADDON.txt | awk '{print $2}')
GIT_HASH=$(cat $DEST_DIR.git/project/cmake/addons/addons/$PVR_ADDON/$PVR_ADDON.txt | awk '{print $3}')
if [ ! -e $PVR_ADDON-$GIT_HASH.tar.xz ] ; then
git_clone $REPO $BRANCH_FOR_ADDONS $PVR_ADDON.git $GIT_HASH
copy_sources $PVR_ADDON.git $PVR_ADDON $GIT_HASH
package_sources $PVR_ADDON-$GIT_HASH
else
echo "[mkpkg] $PVR_ADDON-$GIT_HASH.tar.xz already exists ..."
fi
done
echo "remove temporary sourcedir..." cd $DEST_DIR.git
rm -rf $PKG_NAME-$PKG_VERSION GIT_REV=`git log -n1 --format=%h`
rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION VERSION_MAJOR=$(grep ^VERSION_MAJOR version.txt | cut -d" " -f2)
VERSION_MINOR=$(grep ^VERSION_MINOR version.txt | cut -d" " -f2)
VERSION_TAG=$(grep ^VERSION_TAG version.txt | cut -d" " -f2 | tr A-Z a-z)
PKG_VERSION="$VERSION_MAJOR.$VERSION_MINOR-$VERSION_TAG-$GIT_REV"
echo $PKG_VERSION
cd ..
copy_sources $PKG_NAME-$BRANCH.git $PKG_NAME $PKG_VERSION
echo "[mkpkg] Seperating skin.confluence ..."
rm -rf $PKG_NAME-theme-Confluence-$PKG_VERSION
mv $PKG_NAME-$PKG_VERSION/addons/skin.confluence $PKG_NAME-theme-Confluence-$PKG_VERSION
package_sources $PKG_NAME-$PKG_VERSION
package_sources $PKG_NAME-theme-Confluence-$PKG_VERSION