win32: support building json-glib in mingw script
Since Tor does not currently provide win32 binaries for json-glib we need to cross compile it before we can build clutter. This extends mingw-fetch-dependencies.sh so it can fetch, unpack and cross-compile json-glib into the same prefix as the binary dependencies.
This commit is contained in:
parent
820765eea0
commit
130135a09f
@ -24,6 +24,10 @@ TOR_DEPS=( \
|
|||||||
libpng{-dev,}_1.4.0-1_win32.zip \
|
libpng{-dev,}_1.4.0-1_win32.zip \
|
||||||
zlib{-dev,}_1.2.4-2_win32.zip );
|
zlib{-dev,}_1.2.4-2_win32.zip );
|
||||||
|
|
||||||
|
GNOME_SOURCES_URL="http://ftp.gnome.org/pub/GNOME/sources/"
|
||||||
|
SOURCES_DEPS=(\
|
||||||
|
json-glib/0.12/json-glib-0.12.2.tar.gz );
|
||||||
|
|
||||||
GL_HEADER_URLS=( \
|
GL_HEADER_URLS=( \
|
||||||
http://cgit.freedesktop.org/mesa/mesa/plain/include/GL/gl.h \
|
http://cgit.freedesktop.org/mesa/mesa/plain/include/GL/gl.h \
|
||||||
http://cgit.freedesktop.org/mesa/mesa/plain/include/GL/mesa_wgl.h \
|
http://cgit.freedesktop.org/mesa/mesa/plain/include/GL/mesa_wgl.h \
|
||||||
@ -111,6 +115,24 @@ function do_unzip_d ()
|
|||||||
fi;
|
fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function do_untar_source ()
|
||||||
|
{
|
||||||
|
do_untar_source_d "$BUILD_DIR" "$@";
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_untar_source_d ()
|
||||||
|
{
|
||||||
|
local exdir="$1"; shift;
|
||||||
|
local tarfile="$1"; shift;
|
||||||
|
|
||||||
|
tar -C "$exdir" -zxvf "$tarfile" "$@";
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to extract $tarfile";
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
function add_env ()
|
function add_env ()
|
||||||
{
|
{
|
||||||
echo "export $1=\"$2\"" >> $env_file;
|
echo "export $1=\"$2\"" >> $env_file;
|
||||||
@ -156,6 +178,28 @@ function find_compiler ()
|
|||||||
echo "Using compiler ${MINGW_TOOL_PREFIX}gcc and target $TARGET";
|
echo "Using compiler ${MINGW_TOOL_PREFIX}gcc and target $TARGET";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function do_cross_compile ()
|
||||||
|
{
|
||||||
|
local dep="$1"; shift;
|
||||||
|
local builddir="$BUILD_DIR/$dep";
|
||||||
|
|
||||||
|
cd "$builddir"
|
||||||
|
. $ROOT_DIR/share/env.sh
|
||||||
|
./configure --prefix="$ROOT_DIR" --host="$TARGET" --target="$TARGET" --build="`./config.guess`"
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to configure $dep";
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
make all install
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to build $dep";
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
# If a download directory hasn't been specified then try to guess one
|
# If a download directory hasn't been specified then try to guess one
|
||||||
# but ask for confirmation first
|
# but ask for confirmation first
|
||||||
guess_dir DOWNLOAD_DIR "downloads" \
|
guess_dir DOWNLOAD_DIR "downloads" \
|
||||||
@ -187,6 +231,11 @@ guess_dir ROOT_DIR "clutter-cross" \
|
|||||||
SLASH_SCRIPT='s/\//\\\//g';
|
SLASH_SCRIPT='s/\//\\\//g';
|
||||||
quoted_root_dir=`echo "$ROOT_DIR" | sed "$SLASH_SCRIPT" `;
|
quoted_root_dir=`echo "$ROOT_DIR" | sed "$SLASH_SCRIPT" `;
|
||||||
|
|
||||||
|
# If a build directory hasn't been specified then try to guess one
|
||||||
|
# but ask for confirmation first
|
||||||
|
guess_dir BUILD_DIR "build" \
|
||||||
|
"the directory to build source dependencies in" "Build directory";
|
||||||
|
|
||||||
##
|
##
|
||||||
# Download files
|
# Download files
|
||||||
##
|
##
|
||||||
@ -210,6 +259,11 @@ for dep in "${GL_HEADER_URLS[@]}"; do
|
|||||||
download_file "$dep" "$bn";
|
download_file "$dep" "$bn";
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
for dep in "${SOURCES_DEPS[@]}"; do
|
||||||
|
src="${dep##*/}";
|
||||||
|
download_file "$GNOME_SOURCES_URL/$dep" "$src";
|
||||||
|
done;
|
||||||
|
|
||||||
##
|
##
|
||||||
# Extract files
|
# Extract files
|
||||||
##
|
##
|
||||||
@ -225,6 +279,12 @@ for dep in "${TOR_DEPS[@]}"; do
|
|||||||
do_unzip "$DOWNLOAD_DIR/$dep";
|
do_unzip "$DOWNLOAD_DIR/$dep";
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
for src in "${SOURCES_DEPS[@]}"; do
|
||||||
|
echo "Extracting $src...";
|
||||||
|
src="${src##*/}";
|
||||||
|
do_untar_source "$DOWNLOAD_DIR/$src";
|
||||||
|
done;
|
||||||
|
|
||||||
echo "Fixing pkgconfig files...";
|
echo "Fixing pkgconfig files...";
|
||||||
for x in "$ROOT_DIR/lib/pkgconfig/"*.pc; do
|
for x in "$ROOT_DIR/lib/pkgconfig/"*.pc; do
|
||||||
sed "s/^prefix=.*\$/prefix=${quoted_root_dir}/" \
|
sed "s/^prefix=.*\$/prefix=${quoted_root_dir}/" \
|
||||||
@ -254,7 +314,7 @@ for header in "${GL_HEADERS[@]}"; do
|
|||||||
done;
|
done;
|
||||||
|
|
||||||
##
|
##
|
||||||
# Build
|
# Build environment
|
||||||
##
|
##
|
||||||
|
|
||||||
env_file="$ROOT_DIR/share/env.sh";
|
env_file="$ROOT_DIR/share/env.sh";
|
||||||
@ -290,3 +350,14 @@ fi;
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod a+x "$env_file";
|
chmod a+x "$env_file";
|
||||||
|
|
||||||
|
##
|
||||||
|
# Build source dependencies
|
||||||
|
##
|
||||||
|
|
||||||
|
for dep in "${SOURCES_DEPS[@]}"; do
|
||||||
|
echo "Building $dep...";
|
||||||
|
src="${dep##*/}";
|
||||||
|
src="${src%%.tar.gz}";
|
||||||
|
do_cross_compile "$src"
|
||||||
|
done;
|
||||||
|
Loading…
Reference in New Issue
Block a user