From e0b3e9cc7d938534bf0c62f232ae80dad15e0c2d Mon Sep 17 00:00:00 2001 From: Lauri Aarnio Date: Sat, 7 Jun 2008 08:07:23 +0300 Subject: Use mode-specific "specs" files for the cross-gcc + a "specs" file for "maemo" - Chages the way how the cross compiler is started: if a "specs" file exists, uses that, otherwise adds "-I/usr/include" to gcc's arguments (which was the "old way", used until this change) - Added a "specs" file for the "maemo" mode; this file comes directly from the old scratchbox ("SB1") configuration. --- lua_scripts/argvenvp_gcc.lua | 4 ++++ modeconf/gcc-specs.maemo | 9 +++++++++ utils/sb2-init | 13 +++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 modeconf/gcc-specs.maemo diff --git a/lua_scripts/argvenvp_gcc.lua b/lua_scripts/argvenvp_gcc.lua index 48249a0..0f4fb34 100644 --- a/lua_scripts/argvenvp_gcc.lua +++ b/lua_scripts/argvenvp_gcc.lua @@ -38,6 +38,7 @@ gcc_tools = { gcc_bindir = os.getenv("SBOX_CROSS_GCC_DIR") gcc_subst_prefix = os.getenv("SBOX_CROSS_GCC_SUBST_PREFIX") gcc_extra_args = os.getenv("SBOX_EXTRA_CROSS_COMPILER_ARGS") +gcc_specs = os.getenv("SBOX_CROSS_GCC_SPECS_FILE") gcc_extra_stdinc = os.getenv("SBOX_EXTRA_CROSS_COMPILER_STDINC") gcc_block_args = os.getenv("SBOX_BLOCK_CROSS_COMPILER_ARGS") ld_extra_args = os.getenv("SBOX_EXTRA_CROSS_LD_ARGS") @@ -55,6 +56,9 @@ for prefix in string.gmatch(":" .. os.getenv("SBOX_CROSS_GCC_PREFIX_LIST"), "[^: tmp.new_filename = gcc_bindir .. "/" .. gcc_subst_prefix .. gcc_compilers[i] tmp.add_tail = {} tmp.remove = {} + if (gcc_specs) then + table.insert(tmp.add_tail, "-specs="..gcc_specs) + end if (gcc_extra_args) then for gcc_extra in string.gmatch(gcc_extra_args, "[^ ]+") do table.insert(tmp.add_tail, gcc_extra) diff --git a/modeconf/gcc-specs.maemo b/modeconf/gcc-specs.maemo new file mode 100644 index 0000000..43e9997 --- /dev/null +++ b/modeconf/gcc-specs.maemo @@ -0,0 +1,9 @@ + +*cross_compile: +0 + +%rename cpp old_cpp + +*cpp: +-isystem /usr/local/include -isystem /usr/include %(old_cpp) + diff --git a/utils/sb2-init b/utils/sb2-init index 5e9ddbb..73dfdcd 100755 --- a/utils/sb2-init +++ b/utils/sb2-init @@ -104,7 +104,7 @@ export SBOX_DEFAULT_GCC_PREFIX=$GCC_PREFIX export SBOX_CROSS_GCC_NAME=cross-gcc export SBOX_CROSS_GCC_PREFIX_LIST=$GCC_TARGET-:$ARCH-linux-:$GCC_PREFIX export SBOX_CROSS_GCC_SUBST_PREFIX=$GCC_PREFIX -export SBOX_CROSS_GCC_SPECS_FILE= +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" @@ -363,7 +363,16 @@ if [ -n "$TOOLS_ROOT" ]; then fi fi -SBOX_EXTRA_CROSS_COMPILER_STDINC="-I/usr/include" +# Use "specs" file for gcc if it exists, otherwise add -I/usr/include to params +SBOX_CROSS_GCC_SPECS_FILE="" +SBOX_EXTRA_CROSS_COMPILER_STDINC="" +if [ -f $SBOX_DIR/share/scratchbox2/modeconf/gcc-specs.$MAPPING_MODE ] +then + SBOX_CROSS_GCC_SPECS_FILE="$SBOX_DIR/share/scratchbox2/modeconf/gcc-specs.$MAPPING_MODE" +else + SBOX_EXTRA_CROSS_COMPILER_STDINC="-I/usr/include" +fi + SBOX_EXTRA_CROSS_COMPILER_ARGS="$SBOX_EXTRA_CROSS_COMPILER_ARGS -L$SBOX_TARGET_ROOT/usr/lib -L$SBOX_TARGET_ROOT/lib" # test if the cross compiler needs to be silenced about /usr/include -- cgit v1.2.3