diff --git a/scripts/build b/scripts/build index 7b83e0d52e..bd2edb960f 100755 --- a/scripts/build +++ b/scripts/build @@ -23,7 +23,7 @@ . config/options $1 if [ -z "$1" ]; then - echo "usage: $0 package_name[:host|target]" + echo "usage: $0 package_name[:]" exit 1 fi @@ -75,8 +75,10 @@ if [ ! -f $STAMP ]; then export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE)) if [ -f $PKG_DIR/package.mk ]; then - if [ "$TARGET" = "bootstrap" ]; then + if [ "$TARGET" = "bootstrap" -o "$TARGET" = "init" ]; then setup_toolchain target + elif [ "$TARGET" = "hosttools" ]; then + setup_toolchain host else setup_toolchain $TARGET fi @@ -104,6 +106,17 @@ if [ ! -f $STAMP ]; then 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 @@ -115,6 +128,17 @@ if [ ! -f $STAMP ]; then unset -f makeinstall_bootstrap unset -f post_makeinstall_bootstrap + unset -f pre_build_hosttools + unset -f pre_configure_hosttools + unset -f configure_hosttools + unset -f post_configure_hosttools + unset -f pre_make_hosttools + unset -f make_hosttools + unset -f post_make_hosttools + unset -f pre_makeinstall_hosttools + unset -f makeinstall_hosttools + unset -f post_makeinstall_hosttools + # configure TARGET build defaults unset -v TARGET_CONFIGURE_OPTS TARGET_CONFIGURE_OPTS="--host=$TARGET_NAME \ @@ -141,6 +165,19 @@ if [ ! -f $STAMP ]; then --disable-static \ --enable-shared" + # configure INIT build defaults + unset -v INIT_CONFIGURE_OPTS + INIT_CONFIGURE_OPTS="--host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ + --sysconfdir=/etc \ + --libexecdir=/usr/lib \ + --localstatedir=/var \ + --disable-static \ + --enable-shared" + # configure BOOTSTRAP build defaults unset -v BOOTSTRAP_CONFIGURE_OPTS BOOTSTRAP_CONFIGURE_OPTS="--host=$TARGET_NAME \ @@ -154,6 +191,19 @@ if [ ! -f $STAMP ]; then --disable-static \ --enable-shared" + # configure HOSTTOOLS build defaults + unset -v HOSTTOOLS_CONFIGURE_OPTS + HOSTTOOLS_CONFIGURE_OPTS="--host=$HOST_NAME \ + --build=$HOST_NAME \ + --prefix=$ROOT/$TOOLCHAIN \ + --bindir=$ROOT/$TOOLCHAIN/bin \ + --sbindir=$ROOT/$TOOLCHAIN/sbin \ + --sysconfdir=$ROOT/$TOOLCHAIN/etc \ + --libexecdir=$ROOT/$TOOLCHAIN/lib \ + --localstatedir=$ROOT/$TOOLCHAIN/var \ + --disable-static \ + --enable-shared" + # include buildfile . $PKG_DIR/package.mk @@ -165,10 +215,18 @@ if [ ! -f $STAMP ]; then for p in $PKG_BUILD_DEPENDS_HOST; do $SCRIPTS/build $p done + elif [ "$TARGET" = "init" ]; then + for p in $PKG_BUILD_DEPENDS_INIT; do + $SCRIPTS/build $p + done elif [ "$TARGET" = "bootstrap" ]; then for p in $PKG_BUILD_DEPENDS_BOOTSTRAP; do $SCRIPTS/build $p done + elif [ "$TARGET" = "hosttools" ]; then + for p in $PKG_BUILD_DEPENDS_HOSTTOOLS; do + $SCRIPTS/build $p + done fi if [ "$PKG_AUTORECONF" = yes ]; then @@ -193,7 +251,11 @@ if [ ! -f $STAMP ]; then fi # configure other variables - INSTALL=$ROOT/$PKG_BUILD/.install_pkg + if [ "$TARGET" = "target" ]; then + INSTALL=$ROOT/$PKG_BUILD/.install_pkg + elif [ "$TARGET" = "init" ]; then + INSTALL=$ROOT/$PKG_BUILD/.install_init + fi # setup configure script if [ -z "$PKG_CONFIGURE_SCRIPT" ]; then @@ -224,11 +286,21 @@ if [ ! -f $STAMP ]; then mkdir -p .$HOST_NAME cd .$HOST_NAME fi + elif [ "$TARGET" = "init" ]; then + if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then + mkdir -p .$TARGET_NAME-init + cd .$TARGET_NAME-init + fi elif [ "$TARGET" = "bootstrap" ]; then if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then mkdir -p .$TARGET_NAME-bootstrap cd .$TARGET_NAME-bootstrap fi + elif [ "$TARGET" = "hosttools" ]; then + if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" ]; then + mkdir -p .$TARGET_NAME-hosttools + cd .$TARGET_NAME-hosttools + fi fi # configure @@ -242,8 +314,12 @@ if [ ! -f $STAMP ]; then $PKG_CONFIGURE_SCRIPT $TARGET_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_TARGET elif [ "$TARGET" = "host" ]; then $PKG_CONFIGURE_SCRIPT $HOST_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_HOST + elif [ "$TARGET" = "init" ]; then + $PKG_CONFIGURE_SCRIPT $INIT_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_INIT elif [ "$TARGET" = "bootstrap" ]; then $PKG_CONFIGURE_SCRIPT $BOOTSTRAP_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_BOOTSTRAP + elif [ "$TARGET" = "hosttools" ]; then + $PKG_CONFIGURE_SCRIPT $HOSTTOOLS_CONFIGURE_OPTS $PKG_CONFIGURE_OPTS_HOSTTOOLS fi fi if [ "$(type -t post_configure_$TARGET)" = "function" ]; then @@ -261,8 +337,12 @@ if [ ! -f $STAMP ]; then make $PKG_MAKE_OPTS_TARGET elif [ "$TARGET" = "host" ]; then make $PKG_MAKE_OPTS_HOST + elif [ "$TARGET" = "init" ]; then + make $PKG_MAKE_OPTS_INIT elif [ "$TARGET" = "bootstrap" ]; then make $PKG_MAKE_OPTS_BOOTSTRAP + elif [ "$TARGET" = "hosttools" ]; then + make $PKG_MAKE_OPTS_HOSTTOOLS fi fi if [ "$(type -t post_make_$TARGET)" = "function" ]; then @@ -281,15 +361,20 @@ if [ ! -f $STAMP ]; then make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_TARGET elif [ "$TARGET" = "host" ]; then make install $PKG_MAKEINSTALL_OPTS_HOST + elif [ "$TARGET" = "init" ]; then + $MAKEINSTALL $PKG_MAKEINSTALL_OPTS_INIT + make install DESTDIR=$INSTALL $PKG_MAKEINSTALL_OPTS_INIT elif [ "$TARGET" = "bootstrap" ]; then $MAKEINSTALL $PKG_MAKEINSTALL_OPTS_BOOTSTRAP + elif [ "$TARGET" = "hosttools" ]; then + make install $PKG_MAKEINSTALL_OPTS_HOSTTOOLS fi fi if [ "$(type -t post_makeinstall_$TARGET)" = "function" ]; then post_makeinstall_$TARGET fi - if [ "$TARGET" = "target" ]; then + if [ "$TARGET" = "target" -o "$TARGET" = "init" ]; then rm -rf $INSTALL/usr/include rm -rf $INSTALL/usr/lib/pkgconfig rm -rf $INSTALL/usr/share/aclocal