mingw-fetch-dependencies.sh: Add a wrapper for pkg-config

On a Fedora system (and maybe others) there is a wrapper script called
i686-pc-mingw32-pkg-config. This script unsets the PKG_CONFIG_PATH
variable and then sets the PKG_CONFIG_LIBDIR variable so that it won't
pick up the native system .pc files. This breaks cross compiling in
mingw-fetch-dependencies.sh because it ends up removing its attempts
to set a local search path.

To fix this, the mingw-fetch-dependencies script now generates its own
wrapper script which instead sets PKG_CONFIG_LIBDIR to the local
clutter-cross prefix and then runs the original pkg-config program
from the search path. This should have the same benefit of preventing
it from finding native system .pc files on systems that don't provide
a cross pkg-config. The cross compiling for json-glib and the
recommend args to pass to configure when building clutter are updated
to set the PKG_CONFIG varible to point to this wrapper script.
This commit is contained in:
Neil Roberts 2011-03-16 12:27:22 +00:00
parent 4dc8ccf9ea
commit f23a7583e1

View File

@ -184,7 +184,7 @@ function do_cross_compile ()
local builddir="$BUILD_DIR/$dep";
cd "$builddir"
./configure --prefix="$ROOT_DIR" --host="$TARGET" --target="$TARGET" --build="`./config.guess`" CFLAGS="-mms-bitfields" PKG_CONFIG_PATH="$ROOT_DIR/lib/pkgconfig"
./configure --prefix="$ROOT_DIR" --host="$TARGET" --target="$TARGET" --build="`./config.guess`" CFLAGS="-mms-bitfields" PKG_CONFIG="$RUN_PKG_CONFIG";
if [ "$?" -ne 0 ]; then
echo "Failed to configure $dep";
@ -312,6 +312,26 @@ for header in "${GL_HEADERS[@]}"; do
fi;
done;
RUN_PKG_CONFIG="$BUILD_DIR/run-pkg-config.sh";
echo "Generating $BUILD_DIR/run-pkg-config.sh";
cat > "$RUN_PKG_CONFIG" <<EOF
# This is a wrapper script for pkg-config that overrides the
# PKG_CONFIG_LIBDIR variable so that it won't pick up the local system
# .pc files.
# The MinGW compiler on Fedora tries to do a similar thing except that
# it also unsets PKG_CONFIG_PATH. This breaks any attempts to add a
# local search path so we need to avoid using that script.
export PKG_CONFIG_LIBDIR="$ROOT_DIR/lib/pkgconfig"
exec pkg-config "\$@"
EOF
chmod a+x "$RUN_PKG_CONFIG";
##
# Build environment
##
@ -337,7 +357,7 @@ echo
echo "To get started, you should be able to configure and build from"
echo "the top of your clutter source directory as follows:"
echo
echo "./configure --host=\"$TARGET\" --target=\"$TARGET\" --build=\"`./config.guess`\" --with-flavour=win32 CFLAGS=\"-mms-bitfields\" PKG_CONFIG_PATH=\"$ROOT_DIR/lib/pkgconfig\""
echo "./configure --host=\"$TARGET\" --target=\"$TARGET\" --build=\"`./config.guess`\" --with-flavour=win32 CFLAGS=\"-mms-bitfields\" PKG_CONFIG=\"$RUN_PKG_CONFIG\""
echo "make"
echo
echo "Note: the explicit --build option is often necessary to ensure autoconf"