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 22:11:13 +00:00
|
|
|
|
# Copyright (C) 2010-2011 Roman Weber (roman@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
|
|
|
|
|
|
2013-07-12 12:37:01 +00:00
|
|
|
|
if [ -z "$INSTALL" ] ; then
|
|
|
|
|
echo "error: '\$INSTALL' not set! this script is not intended to be run manually"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2013-12-15 23:13:15 +00:00
|
|
|
|
|
|
|
|
|
# set defaults
|
2015-08-03 12:53:32 +00:00
|
|
|
|
PACKAGE_NAME=$(echo $1 | awk -F : '{print $1}')
|
|
|
|
|
TARGET=$(echo $1 | awk -F : '{print $2}')
|
|
|
|
|
if [ -z "$TARGET" ]; then
|
|
|
|
|
TARGET="target"
|
|
|
|
|
fi
|
2013-12-15 23:13:15 +00:00
|
|
|
|
|
|
|
|
|
STAMP=$STAMPS_INSTALL/$PACKAGE_NAME/install_$TARGET
|
|
|
|
|
mkdir -p $STAMPS_INSTALL/$PACKAGE_NAME
|
2009-03-18 12:02:53 +00:00
|
|
|
|
|
2010-11-11 16:05:47 +00:00
|
|
|
|
[ -f $STAMP -a $FORCE_INSTALL = "no" ] && exit 0
|
2009-03-18 12:02:53 +00:00
|
|
|
|
|
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 [ -n "$PKG_ARCH" -a ! "$PKG_ARCH" = "any" ]; then
|
|
|
|
|
echo "$PKG_ARCH" | grep -q "$TARGET_ARCH" || exit 0
|
|
|
|
|
echo "$PKG_ARCH" | grep -q "\-$TARGET_ARCH" && exit 0
|
2010-11-11 16:05:47 +00:00
|
|
|
|
fi
|
2010-10-19 19:26:14 +00:00
|
|
|
|
|
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}${PACKAGE_NAME}: no package.mk file found${endcolor}\n"
|
2014-01-27 02:34:44 +00:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2013-07-17 04:12:14 +00:00
|
|
|
|
$SCRIPTS/build $@
|
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
|
printf "%${BUILD_INDENT}c ${boldgreen}INSTALL${endcolor} $PACKAGE_NAME ${boldwhite}($TARGET)${endcolor}\n" ' '>&$SILENT_OUT
|
2013-12-15 23:13:15 +00:00
|
|
|
|
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
|
2013-08-08 02:18:14 +00:00
|
|
|
|
|
2013-12-15 23:13:15 +00:00
|
|
|
|
if [ "$TARGET" = target ] ; then
|
2014-02-04 19:44:18 +00:00
|
|
|
|
for p in $PKG_DEPENDS_TARGET; do
|
2013-12-15 23:13:15 +00:00
|
|
|
|
$SCRIPTS/install $p
|
|
|
|
|
done
|
|
|
|
|
elif [ "$TARGET" = init ] ; then
|
2014-02-04 19:44:18 +00:00
|
|
|
|
for p in $PKG_DEPENDS_INIT; do
|
2013-12-15 23:13:15 +00:00
|
|
|
|
$SCRIPTS/install $p
|
|
|
|
|
done
|
|
|
|
|
INSTALL=$BUILD/initramfs
|
2013-08-04 14:47:51 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2013-12-15 23:13:15 +00:00
|
|
|
|
mkdir -p $INSTALL
|
|
|
|
|
|
|
|
|
|
if [ "$TARGET" = target ] ; then
|
|
|
|
|
if [ -d $PKG_DIR/profile.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/etc/profile.d
|
|
|
|
|
cp $PKG_DIR/profile.d/*.conf $INSTALL/etc/profile.d/
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/tmpfiles.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/usr/lib/tmpfiles.d
|
|
|
|
|
cp $PKG_DIR/tmpfiles.d/*.conf $INSTALL/usr/lib/tmpfiles.d
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/system.d ]; then
|
2014-02-20 16:06:25 +00:00
|
|
|
|
mkdir -p $INSTALL/usr/lib/systemd/system
|
|
|
|
|
cp $PKG_DIR/system.d/*.* $INSTALL/usr/lib/systemd/system
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/udev.d ]; then
|
2014-02-20 16:06:25 +00:00
|
|
|
|
mkdir -p $INSTALL/usr/lib/udev/rules.d
|
|
|
|
|
cp $PKG_DIR/udev.d/*.rules $INSTALL/usr/lib/udev/rules.d
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/sleep.d ]; then
|
2014-02-20 16:06:25 +00:00
|
|
|
|
mkdir -p $INSTALL/usr/lib/systemd/system-sleep/
|
|
|
|
|
cp $PKG_DIR/sleep.d/* $INSTALL/usr/lib/systemd/system-sleep/
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/sleep.d.serial ]; then
|
2014-02-20 16:06:25 +00:00
|
|
|
|
mkdir -p $INSTALL/usr/lib/systemd/system-sleep.serial
|
|
|
|
|
cp $PKG_DIR/sleep.d.serial/* $INSTALL/usr/lib/systemd/system-sleep.serial
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/sysctl.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/usr/lib/sysctl.d/
|
|
|
|
|
cp $PKG_DIR/sysctl.d/*.conf $INSTALL/usr/lib/sysctl.d/
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/modules-load.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/usr/lib/modules-load.d/
|
|
|
|
|
cp $PKG_DIR/modules-load.d/*.conf $INSTALL/usr/lib/modules-load.d/
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/sysconf.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/etc/sysconf.d
|
|
|
|
|
cp $PKG_DIR/sysconf.d/*.conf $INSTALL/etc/sysconf.d
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/debug.d ]; then
|
|
|
|
|
mkdir -p $INSTALL/usr/share/debugconf
|
2015-08-03 12:53:32 +00:00
|
|
|
|
cp $PKG_DIR/debug.d/*.conf $INSTALL/usr/share/debugconf
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
2014-10-13 11:05:07 +00:00
|
|
|
|
|
|
|
|
|
if [ -d $PKG_DIR/modprobe.d ]; then
|
2014-11-17 21:37:26 +00:00
|
|
|
|
mkdir -p $INSTALL/lib/modprobe.d
|
|
|
|
|
cp $PKG_DIR/modprobe.d/*.conf $INSTALL/lib/modprobe.d
|
2014-10-13 11:05:07 +00:00
|
|
|
|
fi
|
2013-08-18 12:09:30 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
|
# unset functions
|
2015-08-03 12:53:32 +00:00
|
|
|
|
unset -f pre_install
|
|
|
|
|
unset -f post_install
|
2013-07-30 19:37:31 +00:00
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
|
# include buildfile
|
2015-08-03 12:53:32 +00:00
|
|
|
|
. $PKG_DIR/package.mk
|
2013-07-30 19:37:31 +00:00
|
|
|
|
|
2014-01-27 02:34:44 +00:00
|
|
|
|
# install
|
2015-08-03 12:53:32 +00:00
|
|
|
|
if [ "$TARGET" = target ] ; then
|
|
|
|
|
if [ "$(type -t pre_install)" = "function" ]; then
|
|
|
|
|
pre_install
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
2015-08-03 12:53:32 +00:00
|
|
|
|
fi
|
2014-01-27 02:34:44 +00:00
|
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
|
if [ "$TARGET" = "target" -a -d $PKG_BUILD/.install_pkg ]; then
|
|
|
|
|
mkdir -p $INSTALL
|
|
|
|
|
cp -PR $PKG_BUILD/.install_pkg/* $INSTALL
|
|
|
|
|
elif [ "$TARGET" = "init" -a -d $PKG_BUILD/.install_init ]; then
|
|
|
|
|
mkdir -p $INSTALL
|
|
|
|
|
cp -PR $PKG_BUILD/.install_init/* $INSTALL
|
|
|
|
|
fi
|
2014-01-27 02:34:44 +00:00
|
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
|
if [ "$TARGET" = target ] ; then
|
|
|
|
|
if [ "$(type -t post_install)" = "function" ]; then
|
|
|
|
|
post_install
|
2013-12-15 23:13:15 +00:00
|
|
|
|
fi
|
2015-08-03 12:53:32 +00:00
|
|
|
|
fi
|
2013-07-17 04:12:14 +00:00
|
|
|
|
|
2015-08-03 12:53:32 +00:00
|
|
|
|
touch $STAMP
|