2005-06-22 11:20:32 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-06-24 10:56:20 -07:00
|
|
|
#
|
|
|
|
# mignw-configure - configure for cross-compiling with mingw
|
2007-07-01 23:57:10 -07:00
|
|
|
# by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2007-06-24 10:56:20 -07:00
|
|
|
# Ditributed under the terms of WTFL license
|
|
|
|
#
|
|
|
|
|
2007-07-01 23:57:10 -07:00
|
|
|
#
|
|
|
|
# If you are not using this script, do not forget to use --build.
|
|
|
|
# If you think --build is not needed because blah blah blah, then
|
|
|
|
# read docs. Or just use --build. Or just use this script damn it.
|
|
|
|
#
|
|
|
|
|
2007-01-04 02:40:07 -08:00
|
|
|
write_pkg_config()
|
|
|
|
{
|
|
|
|
rm -f $1
|
|
|
|
cat > $1 << ENDSRIPT
|
|
|
|
#!/bin/sh
|
2006-06-16 06:25:53 -07:00
|
|
|
|
2007-01-04 02:40:07 -08:00
|
|
|
export PKG_CONFIG_LIBDIR="$GTK_PREFIX/lib/pkgconfig":"$PYTHON_PREFIX/Lib/pkgconfig"
|
|
|
|
export PKG_CONFIG_PATH=\$PKG_CONFIG_LIBDIR
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2007-01-10 02:15:27 -08:00
|
|
|
# pkg-config doesn't like --define-variable with these
|
|
|
|
if [ "x\`echo "\$*" | grep -- --atleast-pkgconfig-version\`" != x -o \\
|
|
|
|
"x\`echo "\$*" | grep -- --atleast-version\`" != x ]; then
|
2007-01-04 02:40:07 -08:00
|
|
|
exec "$PKG_CONFIG_PROGRAM" \$*
|
2007-07-01 23:57:10 -07:00
|
|
|
elif [ "x\`echo "\$*" | grep -- codegendir\`" != x ]; then
|
|
|
|
exec "$PKG_CONFIG_PROGRAM" --define-variable=prefix="$PYTHON_PREFIX" \$*
|
2007-01-04 02:40:07 -08:00
|
|
|
else
|
2007-01-10 02:15:27 -08:00
|
|
|
exec "$PKG_CONFIG_PROGRAM" --define-variable=prefix="$GTK_PREFIX" \$*
|
2005-06-22 11:20:32 -07:00
|
|
|
fi
|
2007-01-04 02:40:07 -08:00
|
|
|
ENDSRIPT
|
|
|
|
chmod +x $1
|
|
|
|
}
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2007-04-17 10:49:20 -07:00
|
|
|
# Path to host pkg-config
|
2007-01-10 02:15:27 -08:00
|
|
|
PKG_CONFIG_PROGRAM=${PKG_CONFIG_PROGRAM:-/usr/bin/pkg-config}
|
2007-04-17 10:49:20 -07:00
|
|
|
# Prefix of mingw tools. prefix + tool should make up full path
|
|
|
|
# to the tool, e.g. prefix is '/usr/bin/i586-mingw32msvc-' on Debian
|
|
|
|
# or '/usr/local/mingw32/bin/' on FreeBSD.
|
2007-01-10 02:15:27 -08:00
|
|
|
MINGW_TOOL_PREFIX=${MINGW_TOOL_PREFIX:-/usr/bin/i586-mingw32msvc-}
|
|
|
|
|
2007-04-17 10:49:20 -07:00
|
|
|
# Where gtk libraries are installed
|
2006-08-01 12:49:57 -07:00
|
|
|
export GTK_PREFIX=${GTK_PREFIX:-/usr/local/win/gtk}
|
|
|
|
|
2007-06-07 13:12:23 -07:00
|
|
|
if [ "x$1" = "x--with-python=2.4" -o "x$2" = "x--with-python=2.4" ]; then
|
2007-01-10 02:15:27 -08:00
|
|
|
export PYTHON_PREFIX=${PYTHON_PREFIX:-/usr/local/win/Python24}
|
2007-06-07 13:12:23 -07:00
|
|
|
else
|
|
|
|
export PYTHON_PREFIX=${PYTHON_PREFIX:-/usr/local/win/Python25}
|
2006-08-01 12:49:57 -07:00
|
|
|
fi
|
2007-01-10 02:15:27 -08:00
|
|
|
export PYTHON_HOME=$PYTHON_PREFIX
|
2007-07-01 23:57:10 -07:00
|
|
|
export PYTHON=${PYTHON:-python}
|
2007-01-10 02:15:27 -08:00
|
|
|
|
2007-04-17 10:49:20 -07:00
|
|
|
# Find configure script to run
|
2005-06-22 11:20:32 -07:00
|
|
|
if [ x$CONFIGURE = x ]; then
|
|
|
|
CONFIGURE="configure"
|
|
|
|
if [ ! -e $CONFIGURE ]; then
|
|
|
|
CONFIGURE=`dirname $0`/configure
|
|
|
|
fi
|
|
|
|
if [ ! -e $CONFIGURE ]; then
|
|
|
|
echo "Can't find configure script"
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-06-08 08:48:20 -07:00
|
|
|
configure_dir=`dirname "$CONFIGURE"`
|
|
|
|
configure_dir=`cd "$configure_dir" && pwd`
|
|
|
|
CONFIGURE="$configure_dir"/configure
|
2007-01-04 02:40:07 -08:00
|
|
|
CONFIG_GUESS="$configure_dir"/config.guess
|
2005-06-22 11:20:32 -07:00
|
|
|
fi
|
|
|
|
|
2007-01-10 02:15:27 -08:00
|
|
|
# autoconf is not intelligent enough to guess that
|
|
|
|
# i586-pc-mingw32msvc target has anything to do with
|
|
|
|
# debian /usr/bin/i586-mingw32msvc-gcc or freebsd
|
|
|
|
# /usr/local/mingw32/bin/gcc, hence these variables
|
|
|
|
export ADDR2LINE="${MINGW_TOOL_PREFIX}addr2line"
|
|
|
|
export AS="${MINGW_TOOL_PREFIX}as"
|
|
|
|
export CC="${MINGW_TOOL_PREFIX}gcc"
|
2007-07-04 19:12:04 -07:00
|
|
|
export OBJC="${MINGW_TOOL_PREFIX}gcc"
|
2007-01-10 02:15:27 -08:00
|
|
|
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"
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2007-07-04 19:12:04 -07:00
|
|
|
export LDFLAGS="-L$GTK_PREFIX/lib $LDFLAGS"
|
2007-01-26 08:00:05 -08:00
|
|
|
export CPPFLAGS="-I$GTK_PREFIX/include $CPPFLAGS"
|
2007-07-04 19:12:04 -07:00
|
|
|
export CFLAGS="-I$GTK_PREFIX/include -mms-bitfields -march=i686 ${CFLAGS:-"-O2"}"
|
|
|
|
export CXXFLAGS="-I$GTK_PREFIX/include -mms-bitfields -march=i686 ${CXXFLAGS:-"-O2"}"
|
|
|
|
export OBJCFLAGS="-I$GTK_PREFIX/include -mms-bitfields -march=i686 ${OBJCFLAGS:-"-O2"}"
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2007-04-17 10:49:20 -07:00
|
|
|
# Set up pkg-config invocation. Some broken packages do not use PKG_CONFIG macros
|
|
|
|
# to find pkg-config, so the script must be named 'pkg-config'. Hence it's put
|
|
|
|
# into a separate directory and the directory is pushed in front of PATH
|
2007-01-04 02:40:07 -08:00
|
|
|
mkdir -p fake-bin
|
|
|
|
write_pkg_config fake-bin/pkg-config
|
|
|
|
export PKG_CONFIG="`pwd`/fake-bin/pkg-config"
|
2007-04-17 10:49:20 -07:00
|
|
|
# Some stupid packages try to run stuff like 'gcc' and 'ld' even when cross-compiling, so
|
|
|
|
# cross-tools bin directory should better be in PATH. /usr/i586-mingw32msvc/bin and
|
|
|
|
# /usr/local/mingw32/bin are Debian's and FreeBSD's, add yours if needed.
|
2007-01-04 02:40:07 -08:00
|
|
|
export PATH=`pwd`/fake-bin:$MINGW_BIN:/usr/i586-mingw32msvc/bin:/usr/local/mingw32/bin:$PATH
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-11-05 04:34:09 -08:00
|
|
|
TARGET=i586-pc-mingw32msvc
|
2007-07-04 19:12:04 -07:00
|
|
|
libs_flags="--enable-shared --disable-static"
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2007-04-17 10:49:20 -07:00
|
|
|
# Now actually run configure. FOO=foo arguments *must* be there if you
|
|
|
|
# want automatic re-configuring (which happens if you modify configure.ac and
|
|
|
|
# run make) work.
|
|
|
|
# NOTE: --build *must* be here, it's autoconf bug (aka 'feature'), confirmed and
|
|
|
|
# *documented*.
|
2007-06-07 13:12:23 -07:00
|
|
|
echo sh $CONFIGURE --prefix=$GTK_PREFIX --build=`$CONFIG_GUESS` --host=$TARGET --target=$TARGET \
|
2007-07-04 19:12:04 -07:00
|
|
|
--enable-all-warnings --enable-maintainer-mode $libs_flags \
|
2007-01-10 02:15:27 -08:00
|
|
|
PKG_CONFIG="$PKG_CONFIG" GTK_PREFIX="$GTK_PREFIX" \
|
|
|
|
PYTHON_PREFIX="$PYTHON_PREFIX" PYTHON_HOME="$PYTHON_HOME" \
|
|
|
|
PYTHON24_HOME="$PYTHON24_HOME" PYTHON25_HOME="$PYTHON25_HOME" \
|
|
|
|
AR="$AR" RANLIB="$RANLIB" STRIP="$STRIP" AS="$AS" DLLTOOL="$DLLTOOL" \
|
2007-01-11 18:28:11 -08:00
|
|
|
OBJDUMP="$OBJDUMP" NM="$NM" WINDRES="$WINDRES" $@
|
2007-06-07 13:12:23 -07:00
|
|
|
exec sh $CONFIGURE --prefix=$GTK_PREFIX --build=`$CONFIG_GUESS` --host=$TARGET --target=$TARGET \
|
2007-07-04 19:12:04 -07:00
|
|
|
--enable-all-warnings --enable-maintainer-mode $libs_flags \
|
2007-01-10 02:15:27 -08:00
|
|
|
PKG_CONFIG="$PKG_CONFIG" GTK_PREFIX="$GTK_PREFIX" \
|
|
|
|
PYTHON_PREFIX="$PYTHON_PREFIX" PYTHON_HOME="$PYTHON_HOME" \
|
|
|
|
PYTHON24_HOME="$PYTHON24_HOME" PYTHON25_HOME="$PYTHON25_HOME" \
|
|
|
|
AR="$AR" RANLIB="$RANLIB" STRIP="$STRIP" AS="$AS" DLLTOOL="$DLLTOOL" \
|
2007-01-11 18:28:11 -08:00
|
|
|
OBJDUMP="$OBJDUMP" NM="$NM" WINDRES="$WINDRES" $@
|