2013-07-19 00:35:52 +00:00
|
|
|
#!/bin/bash
|
2009-03-18 12:02:53 +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
|
|
|
################################################################################
|
|
|
|
|
2010-07-21 16:54:45 +00:00
|
|
|
. config/options $1
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2018-02-22 12:11:39 +00:00
|
|
|
if [ "$1" = "--all" ]; then
|
|
|
|
if [ ! -z "$2" ]; then
|
|
|
|
for build_dir in $(ls -1d ${ROOT}/build.*); do
|
|
|
|
load_build_config ${build_dir} && ./scripts/build $2
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-03-18 12:02:53 +00:00
|
|
|
if [ -z "$1" ]; then
|
2014-01-27 21:12:15 +00:00
|
|
|
echo "usage: $0 package_name[:<host|target|init|bootstrap>]"
|
2009-03-18 12:02:53 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-01-27 13:05:34 +00:00
|
|
|
if [ ! -f $PKG_DIR/package.mk ]; then
|
2017-08-11 00:57:26 +00:00
|
|
|
printf "$(print_color CLR_ERROR "$1: no package.mk file found")\n"
|
2014-01-27 13:05:34 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-07-17 04:12:14 +00:00
|
|
|
# set defaults
|
2017-10-09 04:25:52 +00:00
|
|
|
PKG_CONFIGURE_SCRIPT=""
|
|
|
|
PKG_MAKE_OPTS=""
|
|
|
|
PKG_MAKEINSTALL_OPTS=""
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2017-10-09 04:25:52 +00:00
|
|
|
if [ "${1//:/}" != "${1}" ]; then
|
|
|
|
PACKAGE_NAME="${1%:*}"
|
|
|
|
TARGET="${1#*:}"
|
|
|
|
else
|
|
|
|
PACKAGE_NAME=$1
|
|
|
|
TARGET=
|
|
|
|
fi
|
|
|
|
[ -z "$TARGET" ] && TARGET="target"
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2017-10-29 11:01:52 +00:00
|
|
|
if [ -n "$PKG_ARCH" ]; then
|
|
|
|
listcontains "$PKG_ARCH" "!$TARGET_ARCH" && exit 0
|
|
|
|
listcontains "$PKG_ARCH" "$TARGET_ARCH" || listcontains "$PKG_ARCH" "any" || exit 0
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
unset INSTALL
|
|
|
|
|
2013-07-17 04:12:14 +00:00
|
|
|
mkdir -p $STAMPS/$PACKAGE_NAME
|
|
|
|
STAMP=$STAMPS/$PACKAGE_NAME/build_$TARGET
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2013-07-17 04:12:14 +00:00
|
|
|
$SCRIPTS/unpack $PACKAGE_NAME
|
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-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
|
|
|
|
|
|
|
if [ -f $STAMP ] ; then
|
|
|
|
. $STAMP
|
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
|
|
|
|
rm -f $STAMP
|
|
|
|
fi
|
2017-05-01 01:45:00 +00:00
|
|
|
|
2018-02-19 07:08:48 +00:00
|
|
|
if [ ! "$BUILD_WITH_DEBUG" = "$STAMP_BUILD_WITH_DEBUG" ]; then
|
|
|
|
rm -f $STAMP
|
|
|
|
fi
|
|
|
|
|
2017-05-01 01:45:00 +00:00
|
|
|
if [ "$1" = "u-boot" -a ! "$UBOOT_SYSTEM" = "$STAMP_UBOOT_SYSTEM" ]; then
|
|
|
|
rm -f $STAMP
|
|
|
|
fi
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
if [ -f $STAMP ]; then
|
|
|
|
# already build, do nothing
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
rm -f $STAMP
|
|
|
|
|
|
|
|
setup_toolchain $TARGET
|
|
|
|
|
|
|
|
# unset functions
|
2017-12-18 11:09:55 +00:00
|
|
|
unset -f configure_package
|
2017-10-27 16:39:14 +00:00
|
|
|
unset -f pre_build_target
|
|
|
|
unset -f pre_configure_target
|
|
|
|
unset -f configure_target
|
|
|
|
unset -f post_configure_target
|
|
|
|
unset -f pre_make_target
|
|
|
|
unset -f make_target
|
|
|
|
unset -f post_make_target
|
|
|
|
unset -f pre_makeinstall_target
|
|
|
|
unset -f makeinstall_target
|
|
|
|
unset -f post_makeinstall_target
|
|
|
|
|
|
|
|
unset -f pre_build_host
|
|
|
|
unset -f pre_configure_host
|
|
|
|
unset -f configure_host
|
|
|
|
unset -f post_configure_host
|
|
|
|
unset -f pre_make_host
|
|
|
|
unset -f make_host
|
|
|
|
unset -f post_make_host
|
|
|
|
unset -f pre_makeinstall_host
|
|
|
|
unset -f makeinstall_host
|
|
|
|
unset -f post_makeinstall_host
|
|
|
|
|
|
|
|
unset -f pre_build_init
|
|
|
|
unset -f pre_configure_init
|
|
|
|
unset -f configure_init
|
|
|
|
unset -f post_configure_init
|
|
|
|
unset -f pre_make_init
|
|
|
|
unset -f make_init
|
|
|
|
unset -f post_make_init
|
|
|
|
unset -f pre_makeinstall_init
|
|
|
|
unset -f makeinstall_init
|
|
|
|
unset -f post_makeinstall_init
|
|
|
|
|
|
|
|
unset -f pre_build_bootstrap
|
|
|
|
unset -f pre_configure_bootstrap
|
|
|
|
unset -f configure_bootstrap
|
|
|
|
unset -f post_configure_bootstrap
|
|
|
|
unset -f pre_make_bootstrap
|
|
|
|
unset -f make_bootstrap
|
|
|
|
unset -f post_make_bootstrap
|
|
|
|
unset -f pre_makeinstall_bootstrap
|
|
|
|
unset -f makeinstall_bootstrap
|
|
|
|
unset -f post_makeinstall_bootstrap
|
|
|
|
|
2018-02-19 07:08:48 +00:00
|
|
|
# configure debug build defaults
|
|
|
|
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
|
|
|
|
CMAKE_BUILD_TYPE="Debug"
|
|
|
|
MESON_BUILD_TYPE="debug"
|
|
|
|
else
|
|
|
|
CMAKE_BUILD_TYPE="MinSizeRel"
|
|
|
|
MESON_BUILD_TYPE="plain"
|
|
|
|
fi
|
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
# configure TARGET build defaults
|
|
|
|
TARGET_CONFIGURE_OPTS="--host=$TARGET_NAME \
|
|
|
|
--build=$HOST_NAME \
|
|
|
|
--prefix=/usr \
|
2017-10-07 19:32:39 +00:00
|
|
|
--bindir=/usr/bin \
|
|
|
|
--sbindir=/usr/sbin \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--libdir=/usr/lib \
|
|
|
|
--libexecdir=/usr/lib \
|
|
|
|
--localstatedir=/var \
|
2017-10-27 16:39:14 +00:00
|
|
|
--disable-static \
|
|
|
|
--enable-shared"
|
|
|
|
|
|
|
|
CMAKE_GENERATOR_NINJA="-GNinja \
|
|
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
|
|
|
|
|
|
|
TARGET_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
|
|
|
|
|
|
|
|
TARGET_MESON_OPTS="--prefix=/usr \
|
|
|
|
--bindir=/usr/bin \
|
|
|
|
--sbindir=/usr/sbin \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--libdir=/usr/lib \
|
|
|
|
--libexecdir=/usr/lib \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--buildtype=$MESON_BUILD_TYPE \
|
|
|
|
--cross-file=$MESON_CONF"
|
|
|
|
|
|
|
|
# configure HOST build defaults
|
|
|
|
HOST_CONFIGURE_OPTS="--host=$HOST_NAME \
|
|
|
|
--build=$HOST_NAME \
|
|
|
|
--prefix=$TOOLCHAIN \
|
2017-10-07 19:32:39 +00:00
|
|
|
--bindir=$TOOLCHAIN/bin \
|
|
|
|
--sbindir=$TOOLCHAIN/sbin \
|
|
|
|
--sysconfdir=$TOOLCHAIN/etc \
|
|
|
|
--libexecdir=$TOOLCHAIN/lib \
|
|
|
|
--localstatedir=$TOOLCHAIN/var \
|
2017-10-27 16:39:14 +00:00
|
|
|
--disable-static \
|
|
|
|
--enable-shared"
|
|
|
|
|
|
|
|
HOST_CMAKE_OPTS="$CMAKE_GENERATOR \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$TOOLCHAIN"
|
|
|
|
|
|
|
|
HOST_MESON_OPTS="--prefix=$TOOLCHAIN \
|
|
|
|
--bindir=$TOOLCHAIN/bin \
|
|
|
|
--sbindir=$TOOLCHAIN/sbin \
|
|
|
|
--sysconfdir=$TOOLCHAIN/etc \
|
|
|
|
--libdir=$TOOLCHAIN/lib \
|
|
|
|
--libexecdir=$TOOLCHAIN/lib \
|
|
|
|
--localstatedir=$TOOLCHAIN/var \
|
|
|
|
--buildtype=plain \
|
|
|
|
--cross-file=$MESON_CONF"
|
|
|
|
|
|
|
|
# configure INIT build defaults
|
|
|
|
INIT_CONFIGURE_OPTS="$TARGET_CONFIGURE_OPTS"
|
|
|
|
INIT_CMAKE_OPTS="$TARGET_CMAKE_OPTS"
|
|
|
|
INIT_MESON_OPTS="$TARGET_MESON_OPTS"
|
|
|
|
|
|
|
|
# configure BOOTSTRAP build defaults
|
|
|
|
BOOTSTRAP_CONFIGURE_OPTS="$HOST_CONFIGURE_OPTS"
|
|
|
|
BOOTSTRAP_CMAKE_OPTS="$HOST_CMAKE_OPTS"
|
|
|
|
BOOTSTRAP_MESON_OPTS="$HOST_MESON_OPTS"
|
|
|
|
|
|
|
|
# include buildfile
|
|
|
|
. $PKG_DIR/package.mk
|
|
|
|
|
2017-12-18 11:09:55 +00:00
|
|
|
# finalise package configuration
|
|
|
|
if [ "$(type -t configure_package)" = "function" ]; then
|
|
|
|
configure_package
|
|
|
|
fi
|
|
|
|
|
2017-10-27 21:15:40 +00:00
|
|
|
# build dependencies, only when PKG_DEPENDS_? is filled
|
|
|
|
unset _pkg_depends
|
2017-10-27 16:39:14 +00:00
|
|
|
case "$TARGET" in
|
|
|
|
"target") _pkg_depends="$PKG_DEPENDS_TARGET";;
|
|
|
|
"host") _pkg_depends="$PKG_DEPENDS_HOST";;
|
|
|
|
"init") _pkg_depends="$PKG_DEPENDS_INIT";;
|
|
|
|
"bootstrap") _pkg_depends="$PKG_DEPENDS_BOOTSTRAP";;
|
|
|
|
esac
|
|
|
|
for p in $_pkg_depends; do
|
|
|
|
$SCRIPTS/build $p
|
|
|
|
done
|
|
|
|
|
2018-02-19 07:08:48 +00:00
|
|
|
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
|
|
|
|
printf "%${BUILD_INDENT}c $(print_color CLR_BUILD "BUILD") $PACKAGE_NAME $(print_color CLR_TARGET "($TARGET)") [DEBUG]\n" ' '>&$SILENT_OUT
|
|
|
|
else
|
|
|
|
printf "%${BUILD_INDENT}c $(print_color CLR_BUILD "BUILD") $PACKAGE_NAME $(print_color CLR_TARGET "($TARGET)")\n" ' '>&$SILENT_OUT
|
|
|
|
fi
|
2017-10-27 16:39:14 +00:00
|
|
|
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
|
|
|
|
|
|
|
|
# virtual packages dont must be build, they only contains dependencies, so dont go further here
|
|
|
|
if [ "$PKG_SECTION" = "virtual" ]; then
|
|
|
|
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
|
2018-02-19 07:08:48 +00:00
|
|
|
for i in PKG_NAME PKG_DEEPMD5 BUILD_WITH_DEBUG; do
|
2017-10-27 16:39:14 +00:00
|
|
|
echo "STAMP_$i=\"${!i}\"" >> $STAMP
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# configure other variables
|
|
|
|
if [ "$TARGET" = "target" ]; then
|
|
|
|
INSTALL=$PKG_BUILD/.install_pkg
|
|
|
|
elif [ "$TARGET" = "init" ]; then
|
|
|
|
INSTALL=$PKG_BUILD/.install_init
|
|
|
|
fi
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
if [ ! -z "$INSTALL" ] ; then
|
|
|
|
if [ -d "$INSTALL" ] ; then
|
|
|
|
rm -rf $INSTALL
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# setup configure script
|
|
|
|
if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then
|
|
|
|
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/configure"
|
|
|
|
else
|
|
|
|
PKG_CONFIGURE_SCRIPT="$PKG_BUILD/$PKG_CONFIGURE_SCRIPT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$PKG_CMAKE_SCRIPT" ]; then
|
|
|
|
PKG_CMAKE_SCRIPT="$PKG_BUILD/CMakeLists.txt"
|
|
|
|
fi
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
if [ -z "$PKG_MESON_SCRIPT" ]; then
|
|
|
|
PKG_MESON_SCRIPT="$PKG_BUILD/meson.build"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# auto detect toolchain
|
|
|
|
_auto_toolchain=""
|
|
|
|
if [ -z "$PKG_TOOLCHAIN" -o "$PKG_TOOLCHAIN" = "auto" ]; then
|
|
|
|
if [ -f "$PKG_MESON_SCRIPT" ]; then
|
|
|
|
PKG_TOOLCHAIN="meson"
|
2017-10-27 21:15:40 +00:00
|
|
|
elif [ -f "$PKG_CMAKE_SCRIPT" ]; then
|
2017-10-27 16:39:14 +00:00
|
|
|
PKG_TOOLCHAIN="cmake"
|
|
|
|
elif [ -f "$PKG_CONFIGURE_SCRIPT" ]; then
|
|
|
|
PKG_TOOLCHAIN="configure"
|
|
|
|
elif [ -f $PKG_BUILD/Makefile ]; then
|
|
|
|
PKG_TOOLCHAIN="make"
|
|
|
|
else
|
|
|
|
echo "Not possible to detect toolchain automatically. Add PKG_TOOLCHAIN= to package.mk"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
_auto_toolchain=" (auto-detect)"
|
|
|
|
fi
|
|
|
|
if ! listcontains "meson cmake cmake-make configure ninja make autotools manual" "$PKG_TOOLCHAIN"; then
|
|
|
|
printf "$(print_color bold-red "ERROR:") unknown toolchain $PKG_TOOLCHAIN"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
printf "%${BUILD_INDENT}c $(print_color CLR_TOOLCHAIN "TOOLCHAIN") $PKG_TOOLCHAIN${_auto_toolchain}\n" ' '>&$SILENT_OUT
|
|
|
|
|
|
|
|
# make autoreconf
|
|
|
|
if [ "$PKG_TOOLCHAIN" = "autotools" ]; then
|
|
|
|
$SCRIPTS/autoreconf $PACKAGE_NAME
|
|
|
|
fi
|
|
|
|
|
|
|
|
# include build template and build
|
|
|
|
if [ "$(type -t pre_build_$TARGET)" = "function" ]; then
|
|
|
|
pre_build_$TARGET
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure $PKG_BUILD is there. (installer? PKG_URL="")
|
|
|
|
if [ ! -d $PKG_BUILD ] ; then
|
|
|
|
mkdir -p $PKG_BUILD
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $PKG_BUILD
|
|
|
|
|
|
|
|
if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" -o -f "$PKG_MESON_SCRIPT" ]; then
|
|
|
|
case "$TARGET" in
|
|
|
|
"target")
|
|
|
|
mkdir -p .$TARGET_NAME
|
|
|
|
cd .$TARGET_NAME
|
|
|
|
;;
|
|
|
|
"host")
|
|
|
|
mkdir -p .$HOST_NAME
|
|
|
|
cd .$HOST_NAME
|
|
|
|
;;
|
|
|
|
"init")
|
|
|
|
mkdir -p .$TARGET_NAME-$TARGET
|
|
|
|
cd .$TARGET_NAME-$TARGET
|
|
|
|
;;
|
|
|
|
"bootstrap")
|
|
|
|
mkdir -p .$HOST_NAME-$TARGET
|
|
|
|
cd .$HOST_NAME-$TARGET
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# configure
|
|
|
|
if [ "$(type -t pre_configure_$TARGET)" = "function" ]; then
|
|
|
|
pre_configure_$TARGET
|
|
|
|
fi
|
|
|
|
if [ "$(type -t configure_$TARGET)" = "function" ]; then
|
|
|
|
configure_$TARGET
|
|
|
|
else
|
|
|
|
case "$PKG_TOOLCHAIN:$TARGET" in
|
|
|
|
# meson builds
|
|
|
|
"meson:target")
|
|
|
|
echo "Executing (target): meson $TARGET_MESON_OPTS $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
|
2017-12-30 19:57:15 +00:00
|
|
|
CC="$HOST_CC" CXX="$HOST_CXX" meson $TARGET_MESON_OPTS $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)
|
2017-10-27 16:39:14 +00:00
|
|
|
;;
|
|
|
|
"meson:host")
|
|
|
|
echo "Executing (host): meson $HOST_MESON_OPTS $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
|
|
|
|
meson $HOST_MESON_OPTS $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)
|
|
|
|
;;
|
|
|
|
"meson:init")
|
|
|
|
echo "Executing (init): meson $INIT_MESON_OPTS $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
|
|
|
|
meson $INIT_MESON_OPTS $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)
|
|
|
|
;;
|
|
|
|
"meson:bootstrap")
|
|
|
|
echo "Executing (bootstrap): meson $BOOTSTRAP_MESON_OPTS $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
|
|
|
|
meson $BOOTSTRAP_MESON_OPTS $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)
|
|
|
|
;;
|
|
|
|
|
|
|
|
# cmake builds with ninja
|
|
|
|
"cmake:target")
|
|
|
|
echo "Executing (target): cmake $CMAKE_GENERATOR_NINJA $TARGET_CMAKE_OPTS $PKG_CMAKE_OPTS_TARGET $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $CMAKE_GENERATOR_NINJA $TARGET_CMAKE_OPTS $PKG_CMAKE_OPTS_TARGET $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake:host")
|
|
|
|
echo "Executing (host): cmake $CMAKE_GENERATOR_NINJA $HOST_CMAKE_OPTS $PKG_CMAKE_OPTS_HOST $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $CMAKE_GENERATOR_NINJA $HOST_CMAKE_OPTS $PKG_CMAKE_OPTS_HOST $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake:init")
|
|
|
|
echo "Executing (init): cmake $CMAKE_GENERATOR_NINJA $INIT_CMAKE_OPTS $PKG_CMAKE_OPTS_INIT $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $CMAKE_GENERATOR_NINJA $INIT_CMAKE_OPTS $PKG_CMAKE_OPTS_INIT $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake:bootstrap")
|
|
|
|
echo "Executing (bootstrap): cmake $CMAKE_GENERATOR_NINJA $BOOTSTRAP_CMAKE_OPTS $PKG_CMAKE_OPTS_BOOTSTRAP $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $CMAKE_GENERATOR_NINJA $BOOTSTRAP_CMAKE_OPTS $PKG_CMAKE_OPTS_BOOTSTRAP $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
|
|
|
|
# cmake builds with make
|
|
|
|
"cmake-make:target")
|
|
|
|
echo "Executing (target): cmake $TARGET_CMAKE_OPTS $PKG_CMAKE_OPTS_TARGET $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $TARGET_CMAKE_OPTS $PKG_CMAKE_OPTS_TARGET $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake-make:host")
|
|
|
|
echo "Executing (host): cmake $HOST_CMAKE_OPTS $PKG_CMAKE_OPTS_HOST $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $HOST_CMAKE_OPTS $PKG_CMAKE_OPTS_HOST $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake-make:init")
|
|
|
|
echo "Executing (init): cmake $INIT_CMAKE_OPTS $PKG_CMAKE_OPTS_INIT $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $INIT_CMAKE_OPTS $PKG_CMAKE_OPTS_INIT $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
"cmake-make:bootstrap")
|
|
|
|
echo "Executing (bootstrap): cmake $BOOTSTRAP_CMAKE_OPTS $PKG_CMAKE_OPTS_BOOTSTRAP $(dirname $PKG_CMAKE_SCRIPT)" | tr -s " "
|
|
|
|
cmake $BOOTSTRAP_CMAKE_OPTS $PKG_CMAKE_OPTS_BOOTSTRAP $(dirname $PKG_CMAKE_SCRIPT)
|
|
|
|
;;
|
|
|
|
|
|
|
|
# configure builds
|
|
|
|
"configure:target"|"autotools:target")
|
|
|
|
echo "Executing (target): $PKG_CONFIGURE_SCRIPT $TARGET_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_TARGET" | tr -s " "
|
|
|
|
$PKG_CONFIGURE_SCRIPT $TARGET_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_TARGET
|
|
|
|
;;
|
|
|
|
"configure:host"|"autotools:host")
|
|
|
|
echo "Executing (host): $PKG_CONFIGURE_SCRIPT $HOST_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_HOST" | tr -s " "
|
|
|
|
$PKG_CONFIGURE_SCRIPT $HOST_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_HOST
|
|
|
|
;;
|
|
|
|
"configure:init"|"autotools:init")
|
|
|
|
echo "Executing (init): $PKG_CONFIGURE_SCRIPT $INIT_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_INIT" | tr -s " "
|
|
|
|
$PKG_CONFIGURE_SCRIPT $INIT_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_INIT
|
|
|
|
;;
|
|
|
|
"configure:bootstrap"|"autotools:bootstrap")
|
|
|
|
echo "Executing (bootstrap): $PKG_CONFIGURE_SCRIPT $BOOTSTRAP_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_BOOTSTRAP" | tr -s " "
|
|
|
|
$PKG_CONFIGURE_SCRIPT $BOOTSTRAP_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_BOOTSTRAP
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
if [ "$(type -t post_configure_$TARGET)" = "function" ]; then
|
|
|
|
post_configure_$TARGET
|
|
|
|
fi
|
2013-07-17 04:12:14 +00:00
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
# make
|
|
|
|
if [ "$(type -t pre_make_$TARGET)" = "function" ]; then
|
|
|
|
pre_make_$TARGET
|
|
|
|
fi
|
|
|
|
if [ "$(type -t make_$TARGET)" = "function" ]; then
|
|
|
|
make_$TARGET
|
|
|
|
else
|
|
|
|
case "$PKG_TOOLCHAIN:$TARGET" in
|
|
|
|
# ninja based builds
|
|
|
|
"meson:target"|"cmake:target"|"ninja:target")
|
|
|
|
echo "Executing (target): ninja $PKG_MAKE_OPTS_TARGET" | tr -s " "
|
|
|
|
ninja $PKG_MAKE_OPTS_TARGET
|
|
|
|
;;
|
|
|
|
"meson:host"|"cmake:host"|"ninja:host")
|
|
|
|
echo "Executing (host): ninja $PKG_MAKE_OPTS_HOST" | tr -s " "
|
|
|
|
ninja $PKG_MAKE_OPTS_HOST
|
|
|
|
;;
|
|
|
|
"meson:init"|"cmake:init"|"ninja:init")
|
|
|
|
echo "Executing (init): ninja $PKG_MAKE_OPTS_INIT" | tr -s " "
|
|
|
|
ninja $PKG_MAKE_OPTS_INIT
|
|
|
|
;;
|
|
|
|
"meson:bootstrap"|"cmake:bootstrap"|"ninja:bootstrap")
|
|
|
|
echo "Executing (bootstrap): ninja $PKG_MAKE_OPTS_BOOTSTRAP" | tr -s " "
|
|
|
|
ninja $PKG_MAKE_OPTS_BOOTSTRAP
|
|
|
|
;;
|
|
|
|
|
|
|
|
# make based builds
|
|
|
|
"configure:target"|"cmake-make:target"|"autotools:target"|"make:target")
|
|
|
|
echo "Executing (target): make $PKG_MAKE_OPTS_TARGET" | tr -s " "
|
|
|
|
make $PKG_MAKE_OPTS_TARGET
|
|
|
|
;;
|
|
|
|
"configure:host"|"cmake-make:host"|"autotools:host"|"make:host")
|
|
|
|
echo "Executing (host): make $PKG_MAKE_OPTS_HOST" | tr -s " "
|
|
|
|
make $PKG_MAKE_OPTS_HOST
|
|
|
|
;;
|
|
|
|
"configure:init"|"cmake-make:init"|"autotools:init"|"make:init")
|
|
|
|
echo "Executing (init): make $PKG_MAKE_OPTS_INIT" | tr -s " "
|
|
|
|
make $PKG_MAKE_OPTS_INIT
|
|
|
|
;;
|
|
|
|
"configure:bootstrap"|"cmake-make:bootstrap"|"autotools:bootstrap"|"make:bootstrap")
|
|
|
|
echo "Executing (bootstrap): make $PKG_MAKE_OPTS_BOOTSTRAP" | tr -s " "
|
|
|
|
make $PKG_MAKE_OPTS_BOOTSTRAP
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
if [ "$(type -t post_make_$TARGET)" = "function" ]; then
|
|
|
|
post_make_$TARGET
|
|
|
|
fi
|
2009-03-18 12:02:53 +00:00
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
# make install
|
|
|
|
if [ "$(type -t pre_makeinstall_$TARGET)" = "function" ]; then
|
|
|
|
pre_makeinstall_$TARGET
|
|
|
|
fi
|
|
|
|
if [ "$(type -t makeinstall_$TARGET)" = "function" ]; then
|
|
|
|
makeinstall_$TARGET
|
|
|
|
else
|
|
|
|
case "$PKG_TOOLCHAIN:$TARGET" in
|
|
|
|
# ninja based builds
|
|
|
|
"meson:target"|"cmake:target")
|
|
|
|
DESTDIR=$SYSROOT_PREFIX ninja install $PKG_MAKEINSTALL_OPTS_TARGET
|
|
|
|
DESTDIR=$INSTALL ninja install $PKG_MAKEINSTALL_OPTS_TARGET
|
|
|
|
;;
|
|
|
|
"meson:host"|"cmake:host")
|
|
|
|
ninja install $PKG_MAKEINSTALL_OPTS_HOST
|
|
|
|
;;
|
|
|
|
"meson:init"|"cmake:init")
|
|
|
|
DESTDIR=$INSTALL ninja install $PKG_MAKEINSTALL_OPTS_INIT
|
|
|
|
;;
|
|
|
|
"meson:bootstrap"|"cmake:bootstrap")
|
|
|
|
ninja install $PKG_MAKEINSTALL_OPTS_BOOTSTRAP
|
|
|
|
;;
|
|
|
|
|
|
|
|
# make based builds
|
|
|
|
"configure:target"|"cmake-make:target"|"autotools:target"|"make:target")
|
|
|
|
$MAKEINSTALL $PKG_MAKEINSTALL_OPTS_TARGET
|
|
|
|
make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET
|
|
|
|
;;
|
|
|
|
"configure:host"|"cmake-make:host"|"autotools:host"|"make:host")
|
|
|
|
make install $PKG_MAKEINSTALL_OPTS_HOST
|
|
|
|
;;
|
|
|
|
"configure:init"|"cmake-make:init"|"autotools:init"|"make:init")
|
|
|
|
make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_INIT
|
|
|
|
;;
|
|
|
|
"configure:bootstrap"|"cmake-make:bootstrap"|"autotools:bootstrap"|"make:bootstrap")
|
|
|
|
make install $PKG_MAKEINSTALL_OPTS_BOOTSTRAP
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
if [ "$(type -t post_makeinstall_$TARGET)" = "function" ]; then
|
|
|
|
post_makeinstall_$TARGET
|
|
|
|
fi
|
2017-05-01 01:45:00 +00:00
|
|
|
|
2017-10-27 16:39:14 +00:00
|
|
|
if [ "$TARGET" = "target" -o "$TARGET" = "init" ]; then
|
|
|
|
if [ -d $INSTALL ] ; then
|
|
|
|
rm -rf $INSTALL/{usr/,}include
|
|
|
|
rm -rf $INSTALL/{usr/,}lib/cmake
|
|
|
|
rm -rf $INSTALL/{usr/,}lib/pkgconfig
|
|
|
|
rm -rf $INSTALL/{usr/,}man
|
|
|
|
rm -rf $INSTALL/{usr/,}share/aclocal
|
|
|
|
rm -rf $INSTALL/{usr/,}share/bash-completion
|
|
|
|
rm -rf $INSTALL/{usr/,}share/doc
|
|
|
|
rm -rf $INSTALL/{usr/,}share/gtk-doc
|
|
|
|
rm -rf $INSTALL/{usr/,}share/info
|
|
|
|
rm -rf $INSTALL/{usr/,}share/locale
|
|
|
|
rm -rf $INSTALL/{usr/,}share/man
|
|
|
|
rm -rf $INSTALL/{usr/,}share/pkgconfig
|
|
|
|
rm -rf $INSTALL/{usr/,}share/zsh
|
|
|
|
rm -rf $INSTALL/{usr/,}var
|
|
|
|
find $INSTALL \( -name "*.orig" \
|
|
|
|
-o -name "*.rej" \
|
|
|
|
-o -name "*.a" \
|
|
|
|
-o -name "*.la" \
|
|
|
|
-o -name "*.o" \
|
|
|
|
-o -name "*.in" \
|
|
|
|
-o -name ".git*" \) \
|
|
|
|
-exec rm -f {} \; 2>/dev/null || :
|
|
|
|
find $INSTALL -type d -exec rmdir -p {} \; 2>/dev/null || :
|
|
|
|
|
2018-02-19 07:08:48 +00:00
|
|
|
if [ ! "${BUILD_WITH_DEBUG}" = "yes" ]; then
|
2017-10-27 16:39:14 +00:00
|
|
|
$STRIP `find $INSTALL \
|
|
|
|
-type f -name "*.so*" \
|
|
|
|
! -name "ld-*.so" \
|
|
|
|
! -name "libc-*.so" \
|
|
|
|
! -name "libpthread-*.so" \
|
|
|
|
! -name "libthread_db-*so" \
|
|
|
|
2>/dev/null` 2>/dev/null || :
|
|
|
|
if [ "$TARGET" = "init" ]; then
|
|
|
|
$STRIP `find $INSTALL -type f -name "*.so*" 2>/dev/null` 2>/dev/null || :
|
|
|
|
fi
|
|
|
|
$STRIP `find $INSTALL/bin $INSTALL/usr/bin $INSTALL/sbin $INSTALL/usr/sbin \
|
|
|
|
-type f -executable 2>/dev/null` 2>/dev/null || :
|
2017-05-01 01:45:00 +00:00
|
|
|
fi
|
2017-10-27 16:39:14 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $ROOT
|
|
|
|
|
|
|
|
for i in `find $SYSROOT_PREFIX/usr/lib/ -name "*.la" 2>/dev/null`; do \
|
|
|
|
$SED "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" $i; \
|
|
|
|
done
|
|
|
|
|
|
|
|
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
|
2018-02-19 07:08:48 +00:00
|
|
|
for i in PKG_NAME PKG_DEEPMD5 BUILD_WITH_DEBUG; do
|
2017-10-27 16:39:14 +00:00
|
|
|
echo "STAMP_$i=\"${!i}\"" >> $STAMP
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$1" = "u-boot" ]; then
|
|
|
|
echo "STAMP_UBOOT_SYSTEM=\"${UBOOT_SYSTEM}\"" >> $STAMP
|
2009-03-18 12:02:53 +00:00
|
|
|
fi
|