Do a better job with fake pkg-config

This commit is contained in:
Yevgen Muntyan 2007-01-04 04:40:07 -06:00
parent c312fea107
commit d88e9b8893

View File

@ -1,29 +1,33 @@
#!/bin/sh
PKG_CONFIG_PROGRAM=${PKG_CONFIG_PROGRAM:-/usr/bin/pkg-config}
MINGW_TOOL_PREFIX=${MINGW_TOOL_PREFIX:-/usr/bin/i586-mingw32msvc}
write_pkg_config()
{
rm -f $1
cat > $1 << ENDSRIPT
#!/bin/sh
############################################################################
# pkg-config
export PKG_CONFIG_LIBDIR="$GTK_PREFIX/lib/pkgconfig":"$PYTHON_PREFIX/Lib/pkgconfig"
export PKG_CONFIG_PATH=\$PKG_CONFIG_LIBDIR
if [ x`basename $0` = xfake-pkg-config ]; then
if [ "x$1" = "x--atleast-pkgconfig-version" ]; then
exec $PKG_CONFIG_PROGRAM --atleast-pkgconfig-version $2
else
if [ "x$2" = "xpygtk-2.0" -o "x$2" = "xpygobject-2.0" -o \
"x$3" = "xpygtk-2.0" -o "x$3" = "xpygobject-2.0" ];
then
prefix=$PYTHON_PREFIX
else
prefix=$GTK_PREFIX
fi
if [ "x\$1" = "x--atleast-pkgconfig-version" -o "x\$1" = "x--atleast-version" ]; then
exec "$PKG_CONFIG_PROGRAM" \$*
else
if [ "x\$2" = "xpygtk-2.0" -o "x\$2" = "xpygobject-2.0" -o \\
"x\$3" = "xpygtk-2.0" -o "x\$3" = "xpygobject-2.0" ];
then
prefix="$PYTHON_PREFIX"
else
prefix="$GTK_PREFIX"
fi
exec $PKG_CONFIG_PROGRAM --define-variable=prefix=$prefix $*
fi
exec "$PKG_CONFIG_PROGRAM" --define-variable=prefix=\$prefix \$*
fi
ENDSRIPT
chmod +x $1
}
############################################################################
export PKG_CONFIG_PROGRAM=${PKG_CONFIG_PROGRAM:-/usr/bin/pkg-config}
export MINGW_TOOL_PREFIX=${MINGW_TOOL_PREFIX:-/usr/bin/i586-mingw32msvc}
export GTK_PREFIX=${GTK_PREFIX:-/usr/local/win/gtk}
if [ "x$1" = "x--with-python=2.5" -o "x$2" = "x--with-python=2.5" ]; then
@ -32,8 +36,6 @@ else
export PYTHON_PREFIX=${PYTHON_PREFIX:-/usr/local/win/Python24}
fi
export PKG_CONFIG_LIBDIR=$GTK_PREFIX/lib/pkgconfig:$PYTHON_PREFIX/Lib/pkgconfig
if [ x$CONFIGURE = x ]; then
CONFIGURE="configure"
if [ ! -e $CONFIGURE ]; then
@ -46,6 +48,7 @@ if [ x$CONFIGURE = x ]; then
configure_dir=`dirname "$CONFIGURE"`
configure_dir=`cd "$configure_dir" && pwd`
CONFIGURE="$configure_dir"/configure
CONFIG_GUESS="$configure_dir"/config.guess
fi
export ADDR2LINE="$MINGW_TOOL_PREFIX-addr2line"
@ -74,15 +77,12 @@ export LDFLAGS="-L$GTK_PREFIX/lib $LDFLAGS"
export CFLAGS="${CFLAGS:-"-O2 -g"} -I$GTK_PREFIX/include -mms-bitfields -march=i686"
export CXXFLAGS="${CFLAGS:-"-O2 -g"} -I$GTK_PREFIX/include -mms-bitfields -march=i686"
export PATH=$MINGW_BIN:/usr/i586-mingw32msvc/bin:/usr/local/mingw32/bin:$PATH
if [ -L fake-pkg-config ]; then
rm fake-pkg-config
fi
ln -s $0 fake-pkg-config
export PKG_CONFIG="./fake-pkg-config"
mkdir -p fake-bin
write_pkg_config fake-bin/pkg-config
export PKG_CONFIG="`pwd`/fake-bin/pkg-config"
export PATH=`pwd`/fake-bin:$MINGW_BIN:/usr/i586-mingw32msvc/bin:/usr/local/mingw32/bin:$PATH
TARGET=i586-pc-mingw32msvc
exec sh $CONFIGURE --target=$TARGET --host=$TARGET --enable-all-gcc-warnings \
--disable-static --enable-shared $*
echo sh $CONFIGURE --build=`$CONFIG_GUESS` --host=$TARGET --target=$TARGET --enable-all-warnings $*
exec sh $CONFIGURE --build=`$CONFIG_GUESS` --host=$TARGET --target=$TARGET --enable-all-warnings $*