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
|
|
|
|
|
|
|
|
$SCRIPTS/get $1
|
|
|
|
|
2013-12-05 00:02:48 +00:00
|
|
|
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
|
|
|
|
if [ -f $PKG_DIR/package.mk -a $PKG_DIR/package.mk -nt "$i/.openelec-unpack" ]; then
|
|
|
|
CLEAN_SOURCE=yes
|
|
|
|
break
|
|
|
|
# TODO: remove after converting ALL packages
|
|
|
|
elif [ -f $PKG_DIR/meta -a $PKG_DIR/meta -nt "$i/.openelec-unpack" ]; then
|
|
|
|
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-02 13:12:03 +00:00
|
|
|
if [ -f $PKG_DIR/package.mk ]; then
|
|
|
|
# unset functions
|
|
|
|
unset -f pre_unpack
|
|
|
|
unset -f unpack
|
|
|
|
unset -f post_unpack
|
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
|
|
|
|
else # todo: deprecated
|
|
|
|
if [ -f "$PKG_DIR/unpack" ]; then
|
|
|
|
$PKG_DIR/unpack $@ >&$VERBOSE_OUT
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
2013-12-05 00:02:48 +00:00
|
|
|
|
2014-01-02 13:12:03 +00:00
|
|
|
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
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-17 11:40:01 +00:00
|
|
|
for i in $PKG_DIR/patches/$PKG_NAME-*.patch ; do
|
2010-12-18 21:55:20 +00:00
|
|
|
if [ -f "$i" ]; then
|
2009-03-18 12:02:53 +00:00
|
|
|
PATCH=`basename $i`
|
2009-05-31 21:34:46 +00:00
|
|
|
PT=`echo $PATCH | sed 's/.*\.\(.*\)$/\1/'`
|
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
|
|
|
if [ "$PT" != "patch" -a "$PT" != "$TARGET_ARCH" ]; then
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldyellow}SKIP PATCH${endcolor} ${boldwhite}(common)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2009-03-18 12:02:53 +00:00
|
|
|
continue;
|
|
|
|
else
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}(common)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2014-01-02 11:59:46 +00:00
|
|
|
apply_patch $i $PKG_BUILD || exit 1
|
2013-01-17 11:40:01 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in $PKG_DIR/patches/$PKG_VERSION/*.patch ; do
|
|
|
|
if [ -f "$i" ]; then
|
|
|
|
PATCH=`basename $i`
|
|
|
|
PT=`echo $PATCH | sed 's/.*\.\(.*\)$/\1/'`
|
|
|
|
if [ "$PT" != "patch" -a "$PT" != "$TARGET_ARCH" ]; then
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldyellow}SKIP PATCH${endcolor} ${boldwhite}($PKG_VERSION)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2013-01-17 11:40:01 +00:00
|
|
|
continue;
|
|
|
|
else
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}($PKG_VERSION)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2014-01-02 11:59:46 +00:00
|
|
|
apply_patch $i $PKG_BUILD || exit 1
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-12-27 09:40:15 +00:00
|
|
|
for i in $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch ; do
|
|
|
|
if [ -f "$i" ]; then
|
|
|
|
PATCH=`basename $i`
|
|
|
|
PT=`echo $PATCH | sed 's/.*\.\(.*\)$/\1/'`
|
|
|
|
if [ "$PT" != "patch" -a "$PT" != "$TARGET_ARCH" ]; then
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldyellow}SKIP PATCH${endcolor} ${boldwhite}(project)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2012-12-27 09:40:15 +00:00
|
|
|
continue;
|
|
|
|
else
|
2013-12-20 14:51:09 +00:00
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}(project)${endcolor} $i\n" ' '>&$SILENT_OUT
|
2014-01-02 11:59:46 +00:00
|
|
|
apply_patch $i $PKG_BUILD || exit 1
|
2012-12-27 09:40:15 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-12-21 06:53:41 +00:00
|
|
|
# post_unpack() :
|
|
|
|
# - Formerly used to replace $PKG_DIR/rename
|
|
|
|
# - now replaced by $PKG_SOURCE_DIR .
|
|
|
|
# - now moved after patching to replace the formerly 'unpack' script
|
|
|
|
if [ -f $PKG_DIR/package.mk ]; then
|
|
|
|
if [ "$(type -t post_unpack)" = "function" ]; then
|
|
|
|
post_unpack
|
|
|
|
fi
|
|
|
|
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
|
|
|
|
2013-12-10 13:20:44 +00:00
|
|
|
if [ -f "$PKG_DIR/package.mk" ]; then
|
|
|
|
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
|
|
|
|
elif [ -f "$PKG_DIR/meta" ]; then
|
|
|
|
# Deprecated
|
|
|
|
. $PKG_DIR/meta
|
|
|
|
|
|
|
|
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
|
|
|
|
else
|
|
|
|
# Deprecated
|
|
|
|
for i in `sed -n "s/^\([^#].*\)=\".*$/\1/p" $PROJECT_DIR/$PROJECT/options | grep -v "#"`; do
|
|
|
|
eval val=\$$i
|
|
|
|
echo "STAMP_$i=\"$val"\" >> $STAMP
|
|
|
|
done
|
|
|
|
fi
|