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
|
2013-12-21 20:51:48 +00:00
|
|
|
# Copyright (C) 2009-2014 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
|
|
|
|
printf "${boldred} no package.mk file found in $PKG_DIR${endcolor}\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-01-27 13:05:34 +00:00
|
|
|
$SCRIPTS/get $1
|
|
|
|
|
|
|
|
STAMP=$PKG_BUILD/.openelec-unpack
|
|
|
|
|
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
|
|
|
|
2013-12-12 17:59:28 +00:00
|
|
|
for i in $BUILD/$1-*; do
|
|
|
|
if [ -d $i -a -f "$i/.openelec-unpack" ] ; then
|
|
|
|
. "$i/.openelec-unpack"
|
|
|
|
if [ "$STAMP_PKG_NAME" = "$1" ]; then
|
|
|
|
# trigger unpack / full rebuild on any package.mk change
|
2014-01-27 02:34:44 +00:00
|
|
|
if [ $PKG_DIR/package.mk -nt "$i/.openelec-unpack" ]; then
|
2013-12-12 17:59:28 +00:00
|
|
|
CLEAN_SOURCE=yes
|
|
|
|
break
|
|
|
|
fi
|
2013-12-12 18:41:52 +00:00
|
|
|
# handle $PKG_NEED_UNPACK
|
|
|
|
for file in $PKG_NEED_UNPACK; do
|
|
|
|
if [ -f "$file" -a "$file" -nt "$i/.openelec-unpack" ] ; then
|
|
|
|
CLEAN_SOURCE=yes
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2013-12-12 19:20:19 +00:00
|
|
|
# trigger unpack / full rebuild on any patch / script / etc.. change
|
|
|
|
# TODO: rewwork $PKG_DIR/scripts -> $PKG_DIR/filesystem/....
|
|
|
|
for file in $PKG_DIR/{patches,patches.upstream,scripts}/* ; do
|
|
|
|
if [ -f "$file" -a "$file" -nt "$i/.openelec-unpack" ]; then
|
2013-12-12 17:59:28 +00:00
|
|
|
CLEAN_SOURCE=yes
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
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
|
|
|
|
2013-12-10 13:20:44 +00:00
|
|
|
if [ "$CLEAN_SOURCE" = "yes" ]; then
|
|
|
|
$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
|
2014-01-02 13:12:03 +00:00
|
|
|
unset -f pre_unpack
|
|
|
|
unset -f unpack
|
|
|
|
unset -f post_unpack
|
2014-01-05 18:14:45 +00:00
|
|
|
unset -f pre_patch
|
|
|
|
unset -f post_patch
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2014-01-02 13:12:03 +00:00
|
|
|
. $PKG_DIR/package.mk
|
|
|
|
|
|
|
|
if [ "$(type -t pre_unpack)" = "function" ]; then
|
|
|
|
pre_unpack
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$PKG_SOURCE_DIR" ]; then
|
|
|
|
mv $BUILD/$PKG_SOURCE_DIR $BUILD/$PKG_NAME-$PKG_VERSION
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
2014-01-05 18:14:45 +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
|
|
|
|
|
2014-05-24 14:22:33 +00:00
|
|
|
if [ "$TARGET_ARCH" = "i386" -o "$TARGET_ARCH" = "x86_64" ]; then
|
|
|
|
PATCH_ARCH="x86"
|
|
|
|
else
|
|
|
|
PATCH_ARCH="$TARGET_ARCH"
|
|
|
|
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 \
|
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 \
|
2014-05-23 15:23:17 +00:00
|
|
|
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch; do
|
|
|
|
|
|
|
|
if [ $(dirname $i) = "$PKG_DIR/patches" ]; then
|
|
|
|
PATCH_DESC="(common)"
|
2014-05-24 14:22:33 +00:00
|
|
|
elif [ $(dirname $i) = "$PKG_DIR/patches/$PATCH_ARCH" ]; then
|
|
|
|
PATCH_DESC="(common - $PATCH_ARCH)"
|
|
|
|
elif [ $(dirname $i) = "$PKG_DIR/patches/$PKG_VERSION/$PATCH_ARCH" ]; then
|
|
|
|
PATCH_DESC="($PKG_VERSION - $PATCH_ARCH)"
|
2014-05-23 15:23:17 +00:00
|
|
|
elif [ $(dirname $i) = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME" ]; then
|
|
|
|
PATCH_DESC="(project)"
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
2012-12-27 09:40:15 +00:00
|
|
|
if [ -f "$i" ]; then
|
2014-05-24 01:01:11 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}${PATCH_DESC}${endcolor} $i\n" ' '>&$SILENT_OUT
|
|
|
|
cat $i | patch -d `echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 >&$VERBOSE_OUT
|
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
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldyellow}FIXCONFIG${endcolor} $config\n" ' '>&$SILENT_OUT
|
2011-02-09 10:09:22 +00:00
|
|
|
|
|
|
|
[ -f "$config/config.guess" ] && cp -f $SCRIPTS/configtools/config.guess $config
|
|
|
|
[ -f "$config/config.sub" ] && cp -f $SCRIPTS/configtools/config.sub $config
|
|
|
|
[ -f "$config/configure.guess" ] && cp -f $SCRIPTS/configtools/config.guess $config/configure.guess
|
|
|
|
[ -f "$config/configure.sub" ] && cp -f $SCRIPTS/configtools/config.sub $config/configure.sub
|
|
|
|
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
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
for i in PKG_NAME PKG_VERSION PKG_REV PKG_SHORTDESC PKG_LONGDESC PKG_SITE PKG_URL PKG_SECTION; do
|
|
|
|
eval val=\$$i
|
|
|
|
echo "STAMP_$i=\"$val"\" >> $STAMP
|
|
|
|
done
|