2009-12-21 14:04:24 -08:00
|
|
|
#!/bin/sh -e
|
2008-04-13 11:48:18 -07:00
|
|
|
|
2009-12-21 14:04:24 -08:00
|
|
|
cd "`dirname "$0"`"
|
2008-04-13 11:48:18 -07:00
|
|
|
|
2009-12-21 14:04:24 -08:00
|
|
|
##
|
|
|
|
# Function that provides make-like behaviour for executed commands. It prints
|
|
|
|
# the commandline used to execute them before execution.
|
|
|
|
##
|
|
|
|
execute()
|
|
|
|
{
|
|
|
|
local r
|
|
|
|
|
|
|
|
echo "$@"
|
|
|
|
"$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Some default configuration settings
|
|
|
|
HOST_TRIPLET=mingw32
|
2009-12-22 08:48:16 -08:00
|
|
|
INSTALLER_VERSION="2.2.0.999"
|
2008-04-17 08:02:53 -07:00
|
|
|
DEBUGFLAG="--disable-debug"
|
2009-12-21 14:04:24 -08:00
|
|
|
CC_FOR_BUILD="gcc"
|
|
|
|
CXX_FOR_BUILD="g++"
|
2009-12-22 11:20:19 -08:00
|
|
|
CFLAGS="-gstabs -g3"
|
|
|
|
CXXFLAGS="-gstabs -g3"
|
2009-12-21 14:04:24 -08:00
|
|
|
CFLAGS_FOR_BUILD=" "
|
|
|
|
CXXFLAGS_FOR_BUILD=" "
|
|
|
|
CPPFLAGS_FOR_BUILD=" "
|
|
|
|
|
|
|
|
if [ -f __BUILD_CONFIG.USER ]; then
|
2010-01-01 07:51:05 -08:00
|
|
|
. ./__BUILD_CONFIG.USER
|
2009-12-21 14:04:24 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
case "$arg" in
|
|
|
|
*=*) val=`expr "X$arg" : '[^=]*=\(.*\)'` ;;
|
|
|
|
*) val=yes ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$arg" in
|
|
|
|
--enable-debug* | --disable-debug)
|
|
|
|
unset DEBUGFLAG
|
|
|
|
;;
|
|
|
|
--enable-installer | --enable-installer=yes)
|
2009-12-22 08:29:36 -08:00
|
|
|
INSTALLERFLAG="--enable-data --enable-installer --with-installer-extdir=\"$PWD/build/libs\"
|
2009-12-21 14:04:24 -08:00
|
|
|
${INSTALLER_VERSION:+--with-installer-version=$INSTALLER_VERSION}"
|
|
|
|
;;
|
|
|
|
-with-* | --with-* | -enable-* | --enable-*)
|
|
|
|
;;
|
|
|
|
*=*)
|
|
|
|
var=`expr "x$arg" : 'x\([^=]*\)='`
|
|
|
|
# Reject names that are not valid shell variable names.
|
|
|
|
expr "x$var" : ".*[^_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]" >/dev/null && {
|
|
|
|
echo "$0: error: invalid variable name: $var" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
eval $var=\$val
|
|
|
|
export $var
|
|
|
|
;;
|
2009-12-22 07:04:38 -08:00
|
|
|
clean | very-clean | preclean | very-preclean)
|
|
|
|
execute rm -rf build
|
2009-12-21 15:07:15 -08:00
|
|
|
execute make -C libs clean
|
2009-12-22 07:04:38 -08:00
|
|
|
expr "$arg" : 'very-' >/dev/null && execute rm -rf downloads
|
2010-01-01 11:09:22 -08:00
|
|
|
expr "$arg" : '.*pre' || exit 0
|
2009-12-21 15:07:15 -08:00
|
|
|
;;
|
2009-12-21 14:04:24 -08:00
|
|
|
*)
|
|
|
|
echo "$0: error: unknown command line option: $arg" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2008-04-17 08:02:53 -07:00
|
|
|
done
|
|
|
|
|
2009-12-22 06:54:35 -08:00
|
|
|
__BOTHFLAGS="-pipe -m32 -march=i686 -O2 -g"
|
|
|
|
CFLAGS="$__BOTHFLAGS $CFLAGS"
|
|
|
|
CXXFLAGS="$__BOTHFLAGS $CXXFLAGS"
|
|
|
|
CPPFLAGS="-I$PWD/build/libs/include $CPPFLAGS"
|
|
|
|
LDFLAGS="-L$PWD/build/libs/lib $LDFLAGS"
|
|
|
|
unset __BOTHFLAGS
|
|
|
|
|
2009-12-21 14:04:24 -08:00
|
|
|
if [ -z "$PKG_CONFIG_PATH" ] ; then
|
2009-12-22 08:20:19 -08:00
|
|
|
PKG_CONFIG_PATH="$PWD/build/libs/lib/pkgconfig"
|
2009-12-21 14:04:24 -08:00
|
|
|
fi
|
|
|
|
export PKG_CONFIG_PATH
|
|
|
|
|
|
|
|
if [ -f "/proc/cpuinfo" ] ; then
|
|
|
|
MAKE_FLAGS=-j$((`grep '^processor' /proc/cpuinfo | wc -l` + 1))
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure we've got a build directory
|
|
|
|
if [ ! -d build ] ; then
|
|
|
|
mkdir build
|
|
|
|
fi
|
|
|
|
|
2010-01-01 11:09:22 -08:00
|
|
|
set -x
|
|
|
|
|
2009-12-21 14:04:24 -08:00
|
|
|
# Make sure that the dependencies have been built
|
2010-01-01 11:09:22 -08:00
|
|
|
make $MAKE_FLAGS -C libs "HOST_TRIPLET=$HOST_TRIPLET"
|
2009-12-21 14:04:24 -08:00
|
|
|
|
|
|
|
cd build
|
|
|
|
|
2010-01-01 11:09:22 -08:00
|
|
|
[ -x ../../configure ] || ../../autogen.sh
|
|
|
|
../../configure "$@" \
|
2009-12-22 06:54:35 -08:00
|
|
|
"--host=$HOST_TRIPLET" --enable-static --disable-shared ${DEBUGFLAG:+$DEBUGFLAG} \
|
2009-12-21 14:04:24 -08:00
|
|
|
${INSTALLERFLAG:+$INSTALLERFLAG} \
|
|
|
|
CFLAGS="$CFLAGS" \
|
|
|
|
CXXFLAGS="$CXXFLAGS" \
|
2009-12-22 06:54:35 -08:00
|
|
|
CPPFLAGS="$CPPFLAGS" \
|
|
|
|
LDFLAGS="$LDFLAGS" \
|
2009-12-21 14:04:24 -08:00
|
|
|
CC_FOR_BUILD="$CC_FOR_BUILD" \
|
|
|
|
CXX_FOR_BUILD="$CXX_FOR_BUILD" \
|
|
|
|
CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD" \
|
|
|
|
CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD" \
|
|
|
|
CPPFLAGS_FOR_BUILD="$CPPFLAGS_FOR_BUILD" \
|
2009-12-22 08:20:19 -08:00
|
|
|
PKGCONFIG_DEFAULT_PREFIX=${PKGCONFIG_DEFAULT_PREFIX:-$PWD/build/libs} \
|
2009-12-22 06:54:35 -08:00
|
|
|
${PKG_CONFIG_PATH:+PKG_CONFIG_PATH=$PKG_CONFIG_PATH}
|
2010-01-01 11:09:22 -08:00
|
|
|
make $MAKE_FLAGS
|