summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2008-09-19 14:20:24 +0300
committerLauri Leukkunen <lle@rahina.org>2008-09-27 00:02:42 +0300
commita3979fa3b9b517643872efc88cd5bbaf30d5b841 (patch)
tree69ca325682a83a575708c45707d6f415bbf223fb /utils
parentd7b1eece8819c4b57ea68d855c68c3807345ea84 (diff)
Moved all "export" statements from sb2.config to "sb2" (and config version => 8) - The configuration file sb2.config, which is generated by sb2-init, is not the right place to decide what variables should be exported to the environment. All export statements are now in sb2 (and sb2-build-qemuserver) - sb2.config's version number was incremented to 8.
Diffstat (limited to 'utils')
-rwxr-xr-xutils/sb269
-rwxr-xr-xutils/sb2-build-qemuserver56
-rwxr-xr-xutils/sb2-init113
3 files changed, 169 insertions, 69 deletions
diff --git a/utils/sb2 b/utils/sb2
index c120bd4..5d41dbd 100755
--- a/utils/sb2
+++ b/utils/sb2
@@ -110,7 +110,6 @@ function sboxify_environment()
echo "Invalid target specified, aborting."
exit 2
fi
- export SBOX_TARGET
LD_LIBRARY_PATH=$SBOX_DIR/lib/libsb2:$SBOX_DIR/lib64/libsb2:$SBOX_DIR/lib32/libsb2:/emul/lib64/libsb2:/emul/lib32/libsb2
SBOX_LIBSB2="libsb2.so.1"
@@ -123,7 +122,7 @@ function sboxify_environment()
. $SBOX_DIR/share/scratchbox2/modeconf/sb2rc.$SBOX_MAPMODE starting
fi
- if [ "$SBOX_CONFIG_VERSION" != "7" ]; then
+ if [ "$SBOX_CONFIG_VERSION" != "8" ]; then
echo "Please run sb2-init for your target:"
echo "name: $SBOX_TARGET"
echo "dir: $SBOX_TARGET_ROOT"
@@ -144,8 +143,7 @@ function sboxify_environment()
write_rules_to_session_dir $SBOX_RULEFILES
- export LD_LIBRARY_PATH SBOX_LIBSB2 SBOX_TARGET_COMPILER
- export SBOX_TARGET_TOOLCHAIN_DIR=$(dirname "$SBOX_CROSS_GCC_DIR")
+ SBOX_TARGET_TOOLCHAIN_DIR=$(dirname "$SBOX_CROSS_GCC_DIR")
if [ -z "$SBOX_MODE_PATH" ]
then
@@ -472,15 +470,72 @@ else
SHELL=/bin/bash
fi
-# ------------ Temporary cleanup:
+# ------------ cleanup:
# Unset variables which used to be passed in environment,
# but have been moved to sb2-session.conf.
-# Once all variables have been moved, "export" statements can be removed
-# from sb2-init...
unset SBOX_MAPMODE
unset SBOX_TARGET_ROOT
unset SBOX_TOOLS_ROOT
# ------------
+# Export variables that need to be available in environment;
+# don't export anything unnecessary!
+#
+# FIXME: Currently this list contains many variables that should not
+# be in the environment. Cleanup continues...
+
+export SBOX_TARGET
+
+export SBOX_CPU
+export SBOX_GCC_TARGET
+export SBOX_CPUTRANSPARENCY_METHOD
+export SBOX_UNAME_MACHINE
+
+export SBOX_DEFAULT_GCC_PREFIX
+
+export SBOX_CROSS_GCC_NAME
+export SBOX_CROSS_GCC_PREFIX_LIST
+export SBOX_CROSS_GCC_SUBST_PREFIX
+export SBOX_CROSS_GCC_SPECS_FILE
+export SBOX_CROSS_GCC_DIR
+export SBOX_CROSS_GCC_LD_ARGS
+export SBOX_EXTRA_CROSS_COMPILER_ARGS
+export SBOX_EXTRA_CROSS_COMPILER_STDINC
+export SBOX_EXTRA_CROSS_LD_ARGS
+
+export DEB_BUILD_ARCH
+export DEB_BUILD_ARCH_CPU
+export DEB_BUILD_ARCH_ABI
+export DEB_BUILD_GNU_CPU
+export DEB_BUILD_GNU_TYPE
+export DEB_BUILD_GNU_SYSTEM
+
+export DEB_HOST_ARCH
+export DEB_HOST_ARCH_OS
+export DEB_HOST_ARCH_CPU
+
+export DEB_HOST_GNU_CPU
+export DEB_HOST_GNU_TYPE
+export DEB_HOST_GNU_SYSTEM
+
+export SBOX_HOST_GCC_NAME
+export SBOX_HOST_GCC_PREFIX_LIST
+export SBOX_HOST_GCC_SUBST_PREFIX
+export SBOX_HOST_GCC_SPECS_FILE
+export SBOX_HOST_GCC_DIR
+export SBOX_HOST_GCC_LD_ARGS
+export SBOX_EXTRA_HOST_COMPILER_ARGS
+
+export SBRSH_CONFIG
+
+export SBOX_REDIR_LD_SO
+export SBOX_REDIR_LD_LIBRARY_PATH
+
+export LD_LIBRARY_PATH
+
+export SBOX_LIBSB2
+export SBOX_TARGET_COMPILER
+export SBOX_TARGET_TOOLCHAIN_DIR
+# ------------
if [ $# -gt 0 -o "$STDIN" = true ] ; then
binary="$1"
diff --git a/utils/sb2-build-qemuserver b/utils/sb2-build-qemuserver
index 0a6203c..a3f4480 100755
--- a/utils/sb2-build-qemuserver
+++ b/utils/sb2-build-qemuserver
@@ -6,6 +6,62 @@
. ~/.scratchbox2/$SBOX_TARGET/sb2.config
+# ------------
+# FIXME: / LTA 2008-09-18:
+# Export variables from sb2.config; These used to be exported from sb2.config,
+# but the export statements were moved out from the config file.
+# I'm not sure how many of these are really needed by this script.
+
+export SBOX_CONFIG_VERSION
+
+export SBOX_CPU
+export SBOX_GCC_TARGET
+export SBOX_CPUTRANSPARENCY_METHOD
+export SBOX_UNAME_MACHINE
+
+export SBOX_DEFAULT_GCC_PREFIX
+
+export SBOX_CROSS_GCC_NAME
+export SBOX_CROSS_GCC_PREFIX_LIST
+export SBOX_CROSS_GCC_SUBST_PREFIX
+export SBOX_CROSS_GCC_SPECS_FILE
+export SBOX_CROSS_GCC_DIR
+export SBOX_CROSS_GCC_LD_ARGS
+export SBOX_EXTRA_CROSS_COMPILER_ARGS
+export SBOX_EXTRA_CROSS_COMPILER_STDINC
+export SBOX_EXTRA_CROSS_LD_ARGS
+
+export DEB_BUILD_ARCH
+export DEB_BUILD_ARCH_CPU
+export DEB_BUILD_ARCH_ABI
+export DEB_BUILD_GNU_CPU
+export DEB_BUILD_GNU_TYPE
+export DEB_BUILD_GNU_SYSTEM
+
+export DEB_HOST_ARCH
+export DEB_HOST_ARCH_OS
+export DEB_HOST_ARCH_CPU
+
+export DEB_HOST_GNU_CPU
+export DEB_HOST_GNU_TYPE
+export DEB_HOST_GNU_SYSTEM
+
+export SBOX_HOST_GCC_NAME
+export SBOX_HOST_GCC_PREFIX_LIST
+export SBOX_HOST_GCC_SUBST_PREFIX
+export SBOX_HOST_GCC_SPECS_FILE
+export SBOX_HOST_GCC_DIR
+export SBOX_HOST_GCC_LD_ARGS
+export SBOX_EXTRA_HOST_COMPILER_ARGS
+
+export SBRSH_CONFIG
+
+export SBOX_REDIR_LD_SO
+export SBOX_REDIR_LD_LIBRARY_PATH
+
+export LD_LIBRARY_PATH
+# ------------
+
export COMPILER=$SBOX_CROSS_GCC_DIR/$SBOX_CROSS_GCC_SUBST_PREFIX
# uh evil hack sb2 need --copy-clibrary
diff --git a/utils/sb2-init b/utils/sb2-init
index 350f146..b2d2394 100755
--- a/utils/sb2-init
+++ b/utils/sb2-init
@@ -85,14 +85,6 @@ function version()
function write_target_config()
{
- # FIXME: SBOX_MAPMODE and other variables that are not used anymore
- # from the environment have been marked with [*].
- # These should not be exported. However, we'll keep them here until
- # it is time to clean all exported variables (to avoid
- # frequent changes to configuration system; incrementing
- # SBOX_CONFIG_VERSION forces everyone to re-initialize their
- # sb2 environment)
-
cat - > $HOME/.scratchbox2/$TARGET/sb2.config <<EOF
# Scratchbox2 configuration file generated by sb2-init.
@@ -100,68 +92,65 @@ SBOX_INIT_ORIG_ARGS="$SBOX_INIT_ORIG_ARGS"
SBOX_INIT_TIME=$SBOX_INIT_TIME
SBOX_INIT_ID="$SBOX_INIT_ID"
-export SBOX_CONFIG_VERSION=7
-
-# [*] SBOX_TARGET_ROOT
-export SBOX_TARGET_ROOT=$SBOX_TARGET_ROOT
-
-export SBOX_CPU=$ARCH
-export SBOX_GCC_TARGET=$GCC_TARGET
-export SBOX_CPUTRANSPARENCY_METHOD="$CPUTRANSP"
-export SBOX_UNAME_MACHINE=$ARCH
-
-export SBOX_DEFAULT_GCC_PREFIX=$GCC_PREFIX
-
-export SBOX_CROSS_GCC_NAME=cross-gcc
-export SBOX_CROSS_GCC_PREFIX_LIST=$GCC_TARGET-:$SB2INIT_CROSS_GCC_PREFIX_LIST:$GCC_PREFIX
-export SBOX_CROSS_GCC_SUBST_PREFIX=$GCC_PREFIX
-export SBOX_CROSS_GCC_SPECS_FILE="$SBOX_CROSS_GCC_SPECS_FILE"
-export SBOX_CROSS_GCC_DIR=$GCC_PATH
-export SBOX_CROSS_GCC_LD_ARGS=
-export SBOX_EXTRA_CROSS_COMPILER_ARGS="$SBOX_EXTRA_CROSS_COMPILER_ARGS"
-export SBOX_EXTRA_CROSS_COMPILER_STDINC="$SBOX_EXTRA_CROSS_COMPILER_STDINC"
-export SBOX_EXTRA_CROSS_LD_ARGS="-rpath-link $SBOX_TARGET_ROOT/usr/lib:$SBOX_TARGET_ROOT/lib"
-
-export DEB_BUILD_ARCH=$SB2INIT_DEB_BUILD_ARCH
-export DEB_BUILD_ARCH_CPU=$SB2INIT_DEB_BUILD_ARCH_CPU
-export DEB_BUILD_ARCH_ABI=$SB2INIT_DEB_BUILD_ARCH_ABI
-export DEB_BUILD_GNU_CPU=$ARCH
-export DEB_BUILD_GNU_TYPE=$SB2INIT_DEB_BUILD_GNU_TYPE
-export DEB_BUILD_GNU_SYSTEM=$SB2INIT_DEB_BUILD_GNU_SYSTEM
-
-export DEB_HOST_ARCH=$DEBIAN_CPU
-export DEB_HOST_ARCH_OS=$SB2INIT_DEB_HOST_ARCH_OS
-export DEB_HOST_ARCH_CPU=$SB2INIT_DEB_HOST_ARCH_CPU
-
-export DEB_HOST_GNU_CPU=$ARCH
-export DEB_HOST_GNU_TYPE=$SB2INIT_DEB_HOST_GNU_TYPE
-export DEB_HOST_GNU_SYSTEM=$SB2INIT_DEB_HOST_GNU_SYSTEM
-
-export SBOX_HOST_GCC_NAME=host-gcc
-export SBOX_HOST_GCC_PREFIX_LIST=host-
-export SBOX_HOST_GCC_SUBST_PREFIX=
-export SBOX_HOST_GCC_SPECS_FILE=
-export SBOX_HOST_GCC_DIR=/usr/bin
-export SBOX_HOST_GCC_LD_ARGS=
-export SBOX_EXTRA_HOST_COMPILER_ARGS="$HOST_GCC_INC"
-
-export SBRSH_CONFIG=$HOME/.scratchbox2/$TARGET/sbrsh.config
+SBOX_CONFIG_VERSION=8
+
+SBOX_TARGET_ROOT=$SBOX_TARGET_ROOT
+
+SBOX_CPU=$ARCH
+SBOX_GCC_TARGET=$GCC_TARGET
+SBOX_CPUTRANSPARENCY_METHOD="$CPUTRANSP"
+SBOX_UNAME_MACHINE=$ARCH
+
+SBOX_DEFAULT_GCC_PREFIX=$GCC_PREFIX
+
+SBOX_CROSS_GCC_NAME=cross-gcc
+SBOX_CROSS_GCC_PREFIX_LIST=$GCC_TARGET-:$SB2INIT_CROSS_GCC_PREFIX_LIST:$GCC_PREFIX
+SBOX_CROSS_GCC_SUBST_PREFIX=$GCC_PREFIX
+SBOX_CROSS_GCC_SPECS_FILE="$SBOX_CROSS_GCC_SPECS_FILE"
+SBOX_CROSS_GCC_DIR=$GCC_PATH
+SBOX_CROSS_GCC_LD_ARGS=
+SBOX_EXTRA_CROSS_COMPILER_ARGS="$SBOX_EXTRA_CROSS_COMPILER_ARGS"
+SBOX_EXTRA_CROSS_COMPILER_STDINC="$SBOX_EXTRA_CROSS_COMPILER_STDINC"
+SBOX_EXTRA_CROSS_LD_ARGS="-rpath-link $SBOX_TARGET_ROOT/usr/lib:$SBOX_TARGET_ROOT/lib"
+
+DEB_BUILD_ARCH=$SB2INIT_DEB_BUILD_ARCH
+DEB_BUILD_ARCH_CPU=$SB2INIT_DEB_BUILD_ARCH_CPU
+DEB_BUILD_ARCH_ABI=$SB2INIT_DEB_BUILD_ARCH_ABI
+DEB_BUILD_GNU_CPU=$ARCH
+DEB_BUILD_GNU_TYPE=$SB2INIT_DEB_BUILD_GNU_TYPE
+DEB_BUILD_GNU_SYSTEM=$SB2INIT_DEB_BUILD_GNU_SYSTEM
+
+DEB_HOST_ARCH=$DEBIAN_CPU
+DEB_HOST_ARCH_OS=$SB2INIT_DEB_HOST_ARCH_OS
+DEB_HOST_ARCH_CPU=$SB2INIT_DEB_HOST_ARCH_CPU
+
+DEB_HOST_GNU_CPU=$ARCH
+DEB_HOST_GNU_TYPE=$SB2INIT_DEB_HOST_GNU_TYPE
+DEB_HOST_GNU_SYSTEM=$SB2INIT_DEB_HOST_GNU_SYSTEM
+
+SBOX_HOST_GCC_NAME=host-gcc
+SBOX_HOST_GCC_PREFIX_LIST=host-
+SBOX_HOST_GCC_SUBST_PREFIX=
+SBOX_HOST_GCC_SPECS_FILE=
+SBOX_HOST_GCC_DIR=/usr/bin
+SBOX_HOST_GCC_LD_ARGS=
+SBOX_EXTRA_HOST_COMPILER_ARGS="$HOST_GCC_INC"
+
+SBRSH_CONFIG=$HOME/.scratchbox2/$TARGET/sbrsh.config
if [ -z "\$SBOX_MAPMODE" ]; then
- # [*] SBOX_MAPMODE
- export SBOX_MAPMODE=$MAPPING_MODE
+ SBOX_MAPMODE=$MAPPING_MODE
fi
-# [*] SBOX_TOOLS_ROOT
-export SBOX_TOOLS_ROOT=$TOOLS_ROOT
+SBOX_TOOLS_ROOT=$TOOLS_ROOT
-export SBOX_REDIR_LD_SO=$REDIR_LD_SO
-export SBOX_REDIR_LD_LIBRARY_PATH=$REDIR_LD_LIBRARY_PATH
+SBOX_REDIR_LD_SO=$REDIR_LD_SO
+SBOX_REDIR_LD_LIBRARY_PATH=$REDIR_LD_LIBRARY_PATH
if [ -n "\$SBOX_TOOLS_ROOT" ]; then
- export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/:/usr/lib64:/lib:/lib64:\$SBOX_TOOLS_ROOT/usr/lib/libfakeroot:\$SBOX_TOOLS_ROOT/usr/lib64/libfakeroot:\$SBOX_TOOLS_ROOT/usr/lib32/libfakeroot:\$SBOX_REDIR_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH
+ LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/:/usr/lib64:/lib:/lib64:\$SBOX_TOOLS_ROOT/usr/lib/libfakeroot:\$SBOX_TOOLS_ROOT/usr/lib64/libfakeroot:\$SBOX_TOOLS_ROOT/usr/lib32/libfakeroot:\$SBOX_REDIR_LD_LIBRARY_PATH:\$LD_LIBRARY_PATH
else
# SBOX_TOOLS_ROOT not set, include the fakeroot lib path in any case.
- export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/lib/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot
+ LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/lib/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot
fi
EOF
echo "Finished writing sb2.config"