2013-07-19 00:35:52 +00:00
|
|
|
#!/bin/bash
|
2011-01-09 22:32:01 +00:00
|
|
|
|
2011-01-09 20:26:03 +00:00
|
|
|
################################################################################
|
|
|
|
# This file is part of OpenELEC - http://www.openelec.tv
|
2016-01-02 16:26:58 +00:00
|
|
|
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
|
2011-01-09 20:26:03 +00:00
|
|
|
#
|
2013-12-21 20:51:48 +00:00
|
|
|
# OpenELEC is free software: you can redistribute it and/or modify
|
2011-01-09 20:26:03 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2013-12-21 20:51:48 +00:00
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
2011-01-09 20:26:03 +00:00
|
|
|
#
|
2013-12-21 20:51:48 +00:00
|
|
|
# OpenELEC is distributed in the hope that it will be useful,
|
2011-01-09 20:26:03 +00:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2013-12-21 20:51:48 +00:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2011-01-09 20:26:03 +00:00
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-21 20:51:48 +00:00
|
|
|
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
2011-01-09 20:26:03 +00:00
|
|
|
################################################################################
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2010-07-21 16:54:45 +00:00
|
|
|
. config/options $1
|
2009-03-18 12:02:53 +00:00
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "usage: $0 package_name"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
if [ ! -f $PKG_DIR/package.mk ]; then
|
2014-08-17 16:13:43 +00:00
|
|
|
printf "${boldred}$1: no package.mk file found${endcolor}\n"
|
2014-01-27 02:34:44 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-01-27 13:05:34 +00:00
|
|
|
$SCRIPTS/get $1
|
|
|
|
|
2016-06-08 07:13:39 +00:00
|
|
|
STAMP=$PKG_BUILD/.libreelec-unpack
|
2014-01-27 13:05:34 +00:00
|
|
|
|
2009-03-18 12:02:53 +00:00
|
|
|
mkdir -p $BUILD
|
|
|
|
|
2010-12-18 21:55:20 +00:00
|
|
|
[ ! -d "$SOURCES/$1" -a ! -d "$PKG_DIR/sources" ] && exit 0
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2015-08-02 20:59:29 +00:00
|
|
|
STAMP_DEPENDS="$PKG_DIR $PKG_NEED_UNPACK $PROJECT_DIR/$PROJECT/patches/$PKG_NAME"
|
2016-10-15 22:54:53 +00:00
|
|
|
[ -n "$DEVICE" ] && STAMP_DEPENDS="$STAMP_DEPENDS $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME"
|
2015-08-02 20:59:29 +00:00
|
|
|
|
2013-12-12 17:59:28 +00:00
|
|
|
for i in $BUILD/$1-*; do
|
2016-06-08 07:13:39 +00:00
|
|
|
if [ -d $i -a -f "$i/.libreelec-unpack" ] ; then
|
|
|
|
. "$i/.libreelec-unpack"
|
2013-12-12 17:59:28 +00:00
|
|
|
if [ "$STAMP_PKG_NAME" = "$1" ]; then
|
2015-10-23 10:53:36 +00:00
|
|
|
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
|
2015-08-02 20:59:29 +00:00
|
|
|
if [ ! "$PKG_DEEPMD5" = "$STAMP_PKG_DEEPMD5" ] ; then
|
|
|
|
$SCRIPTS/clean $1
|
2013-12-12 17:59:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
done
|
buildsystem: big rework & cleanup - PART-1: split functions from 'config/path' to an seperate file 'config/functions', rework and cleanup some build scripts, remove references to $TARGET_PLATFORM, add support for more then one downloadurl for $PKG_URL (partially done), remove support for: $PKG_DIR/arch, $PKG_DIR/platform, $PKG_DIR/url files, remove support for *.diff patches, create download-stampfiles in sources/$PKG_NAME, create md5 files after download, add support to download all sources at once with './scripts/get'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 21:01:08 +00:00
|
|
|
|
2016-09-11 13:33:59 +00:00
|
|
|
if [ -d "$PKG_BUILD" -a ! -f "$STAMP" ]; then
|
|
|
|
# stale pkg build dir
|
|
|
|
$SCRIPTS/clean $1
|
|
|
|
fi
|
|
|
|
|
2010-12-18 21:55:20 +00:00
|
|
|
[ -f "$STAMP" ] && exit 0
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldcyan}UNPACK${endcolor} $1\n" ' '>&$SILENT_OUT
|
2012-10-22 00:00:23 +00:00
|
|
|
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
# unset functions
|
2015-08-03 12:58:14 +00:00
|
|
|
unset -f pre_unpack
|
|
|
|
unset -f unpack
|
|
|
|
unset -f post_unpack
|
|
|
|
unset -f pre_patch
|
|
|
|
unset -f post_patch
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2015-08-03 12:58:14 +00:00
|
|
|
. $PKG_DIR/package.mk
|
2014-01-02 13:12:03 +00:00
|
|
|
|
2015-08-03 12:58:14 +00:00
|
|
|
if [ "$(type -t pre_unpack)" = "function" ]; then
|
|
|
|
pre_unpack
|
|
|
|
fi
|
2014-01-02 13:12:03 +00:00
|
|
|
|
2015-08-03 12:58:14 +00:00
|
|
|
if [ "$(type -t unpack)" = "function" ]; then
|
|
|
|
unpack
|
|
|
|
else
|
|
|
|
if [ -n "$PKG_URL" ]; then
|
|
|
|
$SCRIPTS/extract $1 "$1*.tar.bz2" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.tbz" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.tar.gz" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.tar.xz" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.txz" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.tgz" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.7z" $BUILD
|
|
|
|
$SCRIPTS/extract $1 "$1*.zip" $BUILD
|
2014-01-02 13:12:03 +00:00
|
|
|
fi
|
2015-08-03 12:58:14 +00:00
|
|
|
fi
|
2014-01-02 13:12:03 +00:00
|
|
|
|
2016-03-29 21:51:55 +00:00
|
|
|
if [ ! -d $BUILD/$PKG_NAME-$PKG_VERSION ]; then
|
|
|
|
if [ -n "$PKG_SOURCE_DIR" ]; then
|
|
|
|
mv $BUILD/$PKG_SOURCE_DIR $BUILD/$PKG_NAME-$PKG_VERSION
|
|
|
|
elif [ -d $BUILD/$PKG_NAME-$PKG_VERSION* ]; then
|
|
|
|
mv $BUILD/$PKG_NAME-$PKG_VERSION* $BUILD/$PKG_NAME-$PKG_VERSION
|
|
|
|
fi
|
2015-08-03 12:58:14 +00:00
|
|
|
fi
|
2014-01-02 13:12:03 +00:00
|
|
|
|
2015-08-03 12:58:14 +00:00
|
|
|
if [ -d "$PKG_DIR/sources" ]; then
|
|
|
|
[ ! -d "$BUILD/${PKG_NAME}-${PKG_VERSION}" ] && mkdir -p $BUILD/${PKG_NAME}-${PKG_VERSION}
|
|
|
|
cp -PRf $PKG_DIR/sources/* $BUILD/${PKG_NAME}-${PKG_VERSION}
|
|
|
|
fi
|
|
|
|
|
2016-02-22 13:12:07 +00:00
|
|
|
if [ -z "$PKG_URL" ]; then
|
|
|
|
mkdir -p "${BUILD}/${PKG_NAME}-${PKG_VERSION}"
|
|
|
|
fi
|
|
|
|
|
2015-08-03 12:58:14 +00:00
|
|
|
if [ "$(type -t post_unpack)" = "function" ]; then
|
|
|
|
post_unpack
|
|
|
|
fi
|
2013-12-05 00:02:48 +00:00
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
if [ "$(type -t pre_patch)" = "function" ]; then
|
|
|
|
pre_patch
|
2014-01-05 18:14:45 +00:00
|
|
|
fi
|
|
|
|
|
2015-04-03 09:08:22 +00:00
|
|
|
if [ "$TARGET_ARCH" = "x86_64" ]; then
|
2014-05-24 14:22:33 +00:00
|
|
|
PATCH_ARCH="x86"
|
|
|
|
else
|
|
|
|
PATCH_ARCH="$TARGET_ARCH"
|
|
|
|
fi
|
|
|
|
|
2016-12-06 18:25:25 +00:00
|
|
|
PATCH_DIRS_PKG=""
|
|
|
|
PATCH_DIRS_PRJ=""
|
|
|
|
if [ -n "$PKG_PATCH_DIRS" ]; then
|
|
|
|
for patch_dir in $PKG_PATCH_DIRS; do
|
|
|
|
[ -d $PKG_DIR/patches/$patch_dir ] && PATCH_DIRS_PKG="$PATCH_DIRS_PKG $PKG_DIR/patches/$patch_dir/*.patch"
|
|
|
|
[ -d $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$patch_dir ] && PATCH_DIRS_PRJ="$PATCH_DIRS_PRJ $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$patch_dir/*.patch"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2014-05-23 15:23:17 +00:00
|
|
|
for i in $PKG_DIR/patches/$PKG_NAME-*.patch \
|
2014-05-24 14:22:33 +00:00
|
|
|
$PKG_DIR/patches/$PATCH_ARCH/$PKG_NAME-*.patch \
|
2016-12-06 18:25:25 +00:00
|
|
|
$PATCH_DIRS_PKG \
|
2014-05-23 15:23:17 +00:00
|
|
|
$PKG_DIR/patches/$PKG_VERSION/*.patch \
|
2014-05-24 14:22:33 +00:00
|
|
|
$PKG_DIR/patches/$PKG_VERSION/$PATCH_ARCH/*.patch \
|
2016-03-04 16:27:55 +00:00
|
|
|
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch \
|
2016-10-15 21:58:50 +00:00
|
|
|
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PATCH_ARCH/*.patch \
|
2016-12-06 18:25:25 +00:00
|
|
|
$PATCH_DIRS_PRJ \
|
2016-10-15 21:58:50 +00:00
|
|
|
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION/*.patch \
|
|
|
|
$PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME/*.patch; do
|
2014-05-23 15:23:17 +00:00
|
|
|
|
2016-12-06 18:25:25 +00:00
|
|
|
thisdir="$(dirname "$i")"
|
|
|
|
|
|
|
|
if [ "$thisdir" = "$PKG_DIR/patches" ]; then
|
2014-05-23 15:23:17 +00:00
|
|
|
PATCH_DESC="(common)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PKG_DIR/patches/$PATCH_ARCH" ]; then
|
2014-05-24 14:22:33 +00:00
|
|
|
PATCH_DESC="(common - $PATCH_ARCH)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PKG_DIR/patches/$PKG_VERSION" ]; then
|
|
|
|
PATCH_DESC="(common - $PKG_VERSION)"
|
|
|
|
elif [ "$thisdir" = "$PKG_DIR/patches/$PKG_VERSION/$PATCH_ARCH" ]; then
|
2014-05-24 14:22:33 +00:00
|
|
|
PATCH_DESC="($PKG_VERSION - $PATCH_ARCH)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME" ]; then
|
2014-05-23 15:23:17 +00:00
|
|
|
PATCH_DESC="(project)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PATCH_ARCH" ]; then
|
2016-10-15 21:58:50 +00:00
|
|
|
PATCH_DESC="(project - $PATCH_ARCH)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION" ]; then
|
2016-03-24 17:28:34 +00:00
|
|
|
PATCH_DESC="(project - $PKG_VERSION)"
|
2016-12-06 18:25:25 +00:00
|
|
|
elif [ "$thisdir" = "$PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME" ]; then
|
2016-10-15 21:58:50 +00:00
|
|
|
PATCH_DESC="(device)"
|
2016-12-06 18:25:25 +00:00
|
|
|
else
|
|
|
|
if [[ "$thisdir" =~ ^$PKG_DIR/.* ]]; then
|
|
|
|
PATCH_DESC="(common - $(basename "$thisdir"))"
|
|
|
|
elif [[ "$thisdir" =~ ^$PROJECT_DIR/.* ]]; then
|
|
|
|
PATCH_DESC="(project - $(basename "$thisdir"))"
|
|
|
|
else
|
|
|
|
PATCH_DESC="(unknown - $(basename "$thisdir"))"
|
|
|
|
fi
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
2012-12-27 09:40:15 +00:00
|
|
|
if [ -f "$i" ]; then
|
2017-01-30 10:01:10 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}${PATCH_DESC}${endcolor} ${i#$ROOT/}\n" ' '>&$SILENT_OUT
|
2015-01-14 23:06:10 +00:00
|
|
|
if [ -n "$(grep -E '^GIT binary patch$' $i)" ]; then
|
2017-02-17 06:40:16 +00:00
|
|
|
cat $i | git apply --directory=`echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 --verbose --whitespace=nowarn --unsafe-paths >&$VERBOSE_OUT
|
2015-01-14 23:06:10 +00:00
|
|
|
else
|
|
|
|
cat $i | patch -d `echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 >&$VERBOSE_OUT
|
|
|
|
fi
|
2012-12-27 09:40:15 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
if [ "$(type -t post_patch)" = "function" ]; then
|
|
|
|
post_patch
|
2013-12-21 06:53:41 +00:00
|
|
|
fi
|
|
|
|
|
2011-02-09 10:09:22 +00:00
|
|
|
for config in `find $BUILD/$1* -name config.guess | sed 's/config.guess//'`; do
|
2016-04-06 22:11:53 +00:00
|
|
|
if [ ! "$PKG_NAME" == "configtools" ] ; then
|
|
|
|
printf "%${BUILD_INDENT}c ${boldyellow}FIXCONFIG${endcolor} $config\n" ' '
|
2011-02-09 10:09:22 +00:00
|
|
|
|
2017-02-17 06:40:16 +00:00
|
|
|
[ -f "$config/config.guess" -a -f $TOOLCHAIN/configtools/config.guess ] && \
|
|
|
|
cp -f $TOOLCHAIN/configtools/config.guess $config
|
|
|
|
[ -f "$config/config.sub" -a -f $TOOLCHAIN/configtools/config.sub ] && \
|
|
|
|
cp -f $TOOLCHAIN/configtools/config.sub $config
|
2016-04-06 22:11:53 +00:00
|
|
|
fi
|
2011-02-09 10:09:22 +00:00
|
|
|
done
|
|
|
|
|
2013-07-20 02:47:18 +00:00
|
|
|
rm -f $STAMPS/$1/build_*
|
buildsystem: big rework & cleanup - PART-1: split functions from 'config/path' to an seperate file 'config/functions', rework and cleanup some build scripts, remove references to $TARGET_PLATFORM, add support for more then one downloadurl for $PKG_URL (partially done), remove support for: $PKG_DIR/arch, $PKG_DIR/platform, $PKG_DIR/url files, remove support for *.diff patches, create download-stampfiles in sources/$PKG_NAME, create md5 files after download, add support to download all sources at once with './scripts/get'
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-11-19 21:01:08 +00:00
|
|
|
|
2015-10-23 10:53:36 +00:00
|
|
|
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
|
2015-08-02 20:59:29 +00:00
|
|
|
for i in PKG_NAME PKG_DEEPMD5; do
|
2014-01-27 02:34:44 +00:00
|
|
|
eval val=\$$i
|
2015-08-02 20:59:29 +00:00
|
|
|
echo "STAMP_$i=\"$val\"" >> $STAMP
|
2014-01-27 02:34:44 +00:00
|
|
|
done
|