1
0
forked from 0ad/0ad

Adds gloox to OS X libs build script, with patch to fix build (fixed upstream in 5de9ed7444).

Fixes lobby build on OS X.
Fixes zlib not building as static lib.

This was SVN commit r14142.
This commit is contained in:
historic_bruno 2013-11-11 04:41:44 +00:00
parent 29ef5f3ce9
commit 3d8865f10b
4 changed files with 82 additions and 18 deletions

View File

@ -256,22 +256,6 @@ extern_lib_defs = {
})
end,
},
gloox = {
compile_settings = function()
if os.is("windows") then
add_default_include_paths("gloox")
end
end,
link_settings = function()
if os.is("windows") then
add_default_lib_paths("gloox")
end
add_default_links({
win_names = { "gloox-1.0" },
unix_names = { "gloox" },
})
end,
},
cxxtest = {
compile_settings = function()
add_source_include_paths("cxxtest")
@ -343,6 +327,38 @@ extern_lib_defs = {
})
end,
},
gloox = {
compile_settings = function()
if os.is("windows") then
add_default_include_paths("gloox")
elseif os.is("macosx") then
-- Support GLOOX_CONFIG for overriding the default PATH-based gloox-config
gloox_config_path = os.getenv("GLOOX_CONFIG")
if not gloox_config_path then
gloox_config_path = "gloox-config"
end
pkgconfig_cflags(nil, gloox_config_path.." --cflags")
end
end,
link_settings = function()
if os.is("windows") then
add_default_lib_paths("gloox")
end
if os.is("macosx") then
gloox_config_path = os.getenv("GLOOX_CONFIG")
if not gloox_config_path then
gloox_config_path = "gloox-config"
end
pkgconfig_libs(nil, gloox_config_path.." --libs")
else
-- TODO: consider using pkg-config on non-Windows (for compile_settings too)
add_default_links({
win_names = { "gloox-1.0" },
unix_names = { "gloox" },
})
end
end,
},
libcurl = {
compile_settings = function()
if os.is("windows") or os.is("macosx") then

View File

@ -64,6 +64,7 @@ cd "$(dirname $0)"
if [ "`uname -s`" = "Darwin" ]; then
# Set *_CONFIG variables on OS X, to override the path to e.g. sdl-config
export GLOOX_CONFIG=${GLOOX_CONFIG:="$(pwd)/../../libraries/osx/gloox/bin/gloox-config"}
export SDL_CONFIG=${SDL_CONFIG:="$(pwd)/../../libraries/osx/sdl/bin/sdl-config"}
export WX_CONFIG=${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"}
export XML2_CONFIG=${XML2_CONFIG:="$(pwd)/../../libraries/osx/libxml2/bin/xml2-config"}

View File

@ -36,6 +36,8 @@ JPEG_DIR="jpeg-8d" # Must match directory name inside source tarball
PNG_VERSION="libpng-1.5.13"
OGG_VERSION="libogg-1.3.0"
VORBIS_VERSION="libvorbis-1.3.3"
# gloox is necessary for multiplayer lobby
GLOOX_VERSION="gloox-1.0.9"
# --------------------------------------------------------------
# Bundled with the game:
# * SpiderMonkey 1.8.5
@ -152,7 +154,7 @@ then
# patch zlib's configure script to use our CFLAGS and LDFLAGS
# TODO: could be done with sed...
(patch -p0 -i ../../patches/zlib_flags.diff && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure --prefix="$ZLIB_DIR" && make ${JOBS} && make install) || die "zlib build failed"
(patch -p0 -i ../../patches/zlib_flags.diff && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure --prefix="$ZLIB_DIR" --static && make ${JOBS} && make install) || die "zlib build failed"
popd
touch .already-built
else
@ -181,7 +183,7 @@ then
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-ipv6 --without-gnutls --without-gssapi --without-libmetalink --without-librtmp --without-libssh2 --without-nss --without-polarssl --without-spnego --without-ssl --disable-ares --disable-ldap --disable-ldaps --with-libidn --with-zlib="${ZLIB_DIR}" --enable-shared=no && make ${JOBS} && make install) || die "libcurl build failed"
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-ipv6 --without-gnutls --without-gssapi --without-libmetalink --without-librtmp --without-libssh2 --without-nss --without-polarssl --without-spnego --without-ssl --disable-ares --disable-ldap --disable-ldaps --without-libidn --with-zlib="${ZLIB_DIR}" --enable-shared=no && make ${JOBS} && make install) || die "libcurl build failed"
popd
touch .already-built
else
@ -463,6 +465,38 @@ else
fi
popd > /dev/null
# --------------------------------------------------------------
echo -e "Building gloox..."
LIB_VERSION="${GLOOX_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.bz2"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://camaya.net/download/"
mkdir -p gloox
pushd gloox > /dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
then
INSTALL_DIR="$(pwd)"
download_lib $LIB_URL $LIB_ARCHIVE
rm -rf $LIB_DIRECTORY
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY
# patch gloox to fix build error (fixed upstream in r4529)
# TODO: pulls in libresolv dependency from /usr/lib
# TODO: if we ever use SSL/TLS, that will add yet another dependency...
(patch -p0 -i ../../patches/gloox-r4529.diff && ./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-shared=no --with-zlib="${ZLIB_DIR}" --without-libidn --without-gnutls --without-openssl --without-tests --without-examples && make ${JOBS} && make install) || die "gloox build failed"
popd
touch .already-built
else
already_built
fi
popd > /dev/null
# --------------------------------------------------------------------
# The following libraries are shared on different OSes and may
# be customzied, so we build and install them from bundled sources

View File

@ -0,0 +1,13 @@
Index: atomicrefcount.cpp
===================================================================
--- src/atomicrefcount.cpp (revision 4528)
+++ src/atomicrefcount.cpp (revision 4529)
@@ -76,7 +76,7 @@
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
::InterlockedExchange( (volatile LONG*)&m_count, (volatile LONG)0 );
#elif defined( __APPLE__ )
- OSAtomicAnd32Barrier( (int32_t)0, (volatile int32_t*)&m_count );
+ OSAtomicAnd32Barrier( (uint32_t)0, (volatile uint32_t*)&m_count );
#elif defined( HAVE_GCC_ATOMIC_BUILTINS )
// Use the gcc intrinsic for atomic decrement if supported.
__sync_fetch_and_and( &m_count, 0 );