From 48b8510a0688baef86db5b808e458c5295aee819 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Sun, 25 Apr 2010 16:20:39 +0100 Subject: [PATCH] mingw-cross-compile.sh: Write the build environment to a script The script now writes out a separate script that can be used to set up the build environment to $ROOT_DIR/share/env.sh. This can be sourced in a shell to set up the build environment or it can be given a command to directly execute in the environment. This makes it easier to build Clutter from your own source rather than checking it out from git directly. --- build/mingw/mingw-cross-compile.sh | 88 ++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 28 deletions(-) diff --git a/build/mingw/mingw-cross-compile.sh b/build/mingw/mingw-cross-compile.sh index 444c672c7..d63cc194c 100755 --- a/build/mingw/mingw-cross-compile.sh +++ b/build/mingw/mingw-cross-compile.sh @@ -113,6 +113,11 @@ function do_unzip_d () fi; } +function add_env () +{ + echo "export $1=\"$2\"" >> $env_file; +} + function find_compiler () { local gccbin fullpath; @@ -147,26 +152,27 @@ function find_compiler () fi; fi; - export ADDR2LINE="${MINGW_TOOL_PREFIX}addr2line" - export AS="${MINGW_TOOL_PREFIX}as" - export CC="${MINGW_TOOL_PREFIX}gcc" - export CPP="${MINGW_TOOL_PREFIX}cpp" - export CPPFILT="${MINGW_TOOL_PREFIX}c++filt" - export CXX="${MINGW_TOOL_PREFIX}g++" - export DLLTOOL="${MINGW_TOOL_PREFIX}dlltool" - export DLLWRAP="${MINGW_TOOL_PREFIX}dllwrap" - export GCOV="${MINGW_TOOL_PREFIX}gcov" - export LD="${MINGW_TOOL_PREFIX}ld" - export NM="${MINGW_TOOL_PREFIX}nm" - export OBJCOPY="${MINGW_TOOL_PREFIX}objcopy" - export OBJDUMP="${MINGW_TOOL_PREFIX}objdump" - export READELF="${MINGW_TOOL_PREFIX}readelf" - export SIZE="${MINGW_TOOL_PREFIX}size" - export STRINGS="${MINGW_TOOL_PREFIX}strings" - export WINDRES="${MINGW_TOOL_PREFIX}windres" - export AR="${MINGW_TOOL_PREFIX}ar" - export RANLIB="${MINGW_TOOL_PREFIX}ranlib" - export STRIP="${MINGW_TOOL_PREFIX}strip" + CC="${MINGW_TOOL_PREFIX}gcc"; + add_env ADDR2LINE "${MINGW_TOOL_PREFIX}addr2line" + add_env AS "${MINGW_TOOL_PREFIX}as" + add_env CC "${CC}" + add_env CPP "${MINGW_TOOL_PREFIX}cpp" + add_env CPPFILT "${MINGW_TOOL_PREFIX}c++filt" + add_env CXX "${MINGW_TOOL_PREFIX}g++" + add_env DLLTOOL "${MINGW_TOOL_PREFIX}dlltool" + add_env DLLWRAP "${MINGW_TOOL_PREFIX}dllwrap" + add_env GCOV "${MINGW_TOOL_PREFIX}gcov" + add_env LD "${MINGW_TOOL_PREFIX}ld" + add_env NM "${MINGW_TOOL_PREFIX}nm" + add_env OBJCOPY "${MINGW_TOOL_PREFIX}objcopy" + add_env OBJDUMP "${MINGW_TOOL_PREFIX}objdump" + add_env READELF "${MINGW_TOOL_PREFIX}readelf" + add_env SIZE "${MINGW_TOOL_PREFIX}size" + add_env STRINGS "${MINGW_TOOL_PREFIX}strings" + add_env WINDRES "${MINGW_TOOL_PREFIX}windres" + add_env AR "${MINGW_TOOL_PREFIX}ar" + add_env RANLIB "${MINGW_TOOL_PREFIX}ranlib" + add_env STRIP "${MINGW_TOOL_PREFIX}strip" TARGET="${MINGW_TOOL_PREFIX##*/}"; TARGET="${TARGET%%-}"; @@ -275,15 +281,42 @@ done; # Build ## -export PKG_CONFIG_PATH="$ROOT_DIR/lib/pkgconfig:$PKG_CONFIG_PATH"; +env_file="$ROOT_DIR/share/env.sh"; +echo "Writing build environment script to $env_file"; +echo "#!/bin/bash" > "$env_file"; -export LDFLAGS="-L$ROOT_DIR/lib -mno-cygwin $LDFLAGS" -export CPPFLAGS="-I$ROOT_DIR/include $CPPFLAGS" -export CFLAGS="-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 ${CFLAGS:-"-g"}" -export CXXFLAGS="-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 ${CFLAGS:-"-g"}" +find_compiler; + +add_env PKG_CONFIG_PATH "$ROOT_DIR/lib/pkgconfig:\$PKG_CONFIG_PATH"; + +add_env LDFLAGS "-L$ROOT_DIR/lib -mno-cygwin \$LDFLAGS" +add_env CPPFLAGS "-I$ROOT_DIR/include \$CPPFLAGS" +add_env CFLAGS "-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 \${CFLAGS:-"-g"}" +add_env CXXFLAGS "-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 \${CFLAGS:-"-g"}" + +cat >> "$env_file" <