mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
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.
This commit is contained in:
parent
eb22ab9bf2
commit
48b8510a06
@ -113,6 +113,11 @@ function do_unzip_d ()
|
|||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function add_env ()
|
||||||
|
{
|
||||||
|
echo "export $1=\"$2\"" >> $env_file;
|
||||||
|
}
|
||||||
|
|
||||||
function find_compiler ()
|
function find_compiler ()
|
||||||
{
|
{
|
||||||
local gccbin fullpath;
|
local gccbin fullpath;
|
||||||
@ -147,26 +152,27 @@ function find_compiler ()
|
|||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
export ADDR2LINE="${MINGW_TOOL_PREFIX}addr2line"
|
CC="${MINGW_TOOL_PREFIX}gcc";
|
||||||
export AS="${MINGW_TOOL_PREFIX}as"
|
add_env ADDR2LINE "${MINGW_TOOL_PREFIX}addr2line"
|
||||||
export CC="${MINGW_TOOL_PREFIX}gcc"
|
add_env AS "${MINGW_TOOL_PREFIX}as"
|
||||||
export CPP="${MINGW_TOOL_PREFIX}cpp"
|
add_env CC "${CC}"
|
||||||
export CPPFILT="${MINGW_TOOL_PREFIX}c++filt"
|
add_env CPP "${MINGW_TOOL_PREFIX}cpp"
|
||||||
export CXX="${MINGW_TOOL_PREFIX}g++"
|
add_env CPPFILT "${MINGW_TOOL_PREFIX}c++filt"
|
||||||
export DLLTOOL="${MINGW_TOOL_PREFIX}dlltool"
|
add_env CXX "${MINGW_TOOL_PREFIX}g++"
|
||||||
export DLLWRAP="${MINGW_TOOL_PREFIX}dllwrap"
|
add_env DLLTOOL "${MINGW_TOOL_PREFIX}dlltool"
|
||||||
export GCOV="${MINGW_TOOL_PREFIX}gcov"
|
add_env DLLWRAP "${MINGW_TOOL_PREFIX}dllwrap"
|
||||||
export LD="${MINGW_TOOL_PREFIX}ld"
|
add_env GCOV "${MINGW_TOOL_PREFIX}gcov"
|
||||||
export NM="${MINGW_TOOL_PREFIX}nm"
|
add_env LD "${MINGW_TOOL_PREFIX}ld"
|
||||||
export OBJCOPY="${MINGW_TOOL_PREFIX}objcopy"
|
add_env NM "${MINGW_TOOL_PREFIX}nm"
|
||||||
export OBJDUMP="${MINGW_TOOL_PREFIX}objdump"
|
add_env OBJCOPY "${MINGW_TOOL_PREFIX}objcopy"
|
||||||
export READELF="${MINGW_TOOL_PREFIX}readelf"
|
add_env OBJDUMP "${MINGW_TOOL_PREFIX}objdump"
|
||||||
export SIZE="${MINGW_TOOL_PREFIX}size"
|
add_env READELF "${MINGW_TOOL_PREFIX}readelf"
|
||||||
export STRINGS="${MINGW_TOOL_PREFIX}strings"
|
add_env SIZE "${MINGW_TOOL_PREFIX}size"
|
||||||
export WINDRES="${MINGW_TOOL_PREFIX}windres"
|
add_env STRINGS "${MINGW_TOOL_PREFIX}strings"
|
||||||
export AR="${MINGW_TOOL_PREFIX}ar"
|
add_env WINDRES "${MINGW_TOOL_PREFIX}windres"
|
||||||
export RANLIB="${MINGW_TOOL_PREFIX}ranlib"
|
add_env AR "${MINGW_TOOL_PREFIX}ar"
|
||||||
export STRIP="${MINGW_TOOL_PREFIX}strip"
|
add_env RANLIB "${MINGW_TOOL_PREFIX}ranlib"
|
||||||
|
add_env STRIP "${MINGW_TOOL_PREFIX}strip"
|
||||||
|
|
||||||
TARGET="${MINGW_TOOL_PREFIX##*/}";
|
TARGET="${MINGW_TOOL_PREFIX##*/}";
|
||||||
TARGET="${TARGET%%-}";
|
TARGET="${TARGET%%-}";
|
||||||
@ -275,15 +281,42 @@ done;
|
|||||||
# Build
|
# 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"
|
find_compiler;
|
||||||
export CPPFLAGS="-I$ROOT_DIR/include $CPPFLAGS"
|
|
||||||
export CFLAGS="-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 ${CFLAGS:-"-g"}"
|
add_env PKG_CONFIG_PATH "$ROOT_DIR/lib/pkgconfig:\$PKG_CONFIG_PATH";
|
||||||
export CXXFLAGS="-I$ROOT_DIR/include -mno-cygwin -mms-bitfields -march=i686 ${CFLAGS:-"-g"}"
|
|
||||||
|
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" <<EOF
|
||||||
|
ROOT_DIR="$ROOT_DIR";
|
||||||
|
TARGET="$TARGET";
|
||||||
|
|
||||||
|
function do_autogen()
|
||||||
|
{
|
||||||
|
./autogen.sh --prefix="\$ROOT_DIR" --host="\$TARGET" --target="\$TARGET" \\
|
||||||
|
--with-flavour=win32;
|
||||||
|
}
|
||||||
|
|
||||||
|
# If any arguments are given then execute it as a program with the
|
||||||
|
# environment we set up
|
||||||
|
|
||||||
|
if test "\$#" -ge 1; then
|
||||||
|
exec "\$@";
|
||||||
|
fi;
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod a+x "$env_file";
|
||||||
|
|
||||||
if y_or_n "Do you want to checkout and build Clutter?"; then
|
if y_or_n "Do you want to checkout and build Clutter?"; then
|
||||||
find_compiler;
|
source "$env_file";
|
||||||
|
|
||||||
guess_dir CLUTTER_BUILD_DIR "clutter" \
|
guess_dir CLUTTER_BUILD_DIR "clutter" \
|
||||||
"the build directory for clutter" "Build dir";
|
"the build directory for clutter" "Build dir";
|
||||||
@ -292,8 +325,7 @@ if y_or_n "Do you want to checkout and build Clutter?"; then
|
|||||||
echo "git failed";
|
echo "git failed";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
( cd "$CLUTTER_BUILD_DIR" && ./autogen.sh --prefix="$ROOT_DIR" \
|
( cd "$CLUTTER_BUILD_DIR" && do_autogen );
|
||||||
--host="$TARGET" --target="$TARGET" --with-flavour=win32 );
|
|
||||||
if [ "$?" -ne 0 ]; then
|
if [ "$?" -ne 0 ]; then
|
||||||
echo "autogen failed";
|
echo "autogen failed";
|
||||||
exit 1;
|
exit 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user