1
0
forked from 0ad/0ad

Suppresses noisy Boost header warnings on OS X by including them as system headers, refs #1076.

Bumps default SDK in build-osx-bundle.sh to 10.7 (newer Xcode doesn't
include 10.6).
Fixes using xml2-config from SDK when needed.
Fixes more linker warnings about symbol visibility by compiling libs
with fvisibility=hidden.
Updates some comments in the build scripts.

This was SVN commit r13172.
This commit is contained in:
historic_bruno 2013-02-15 22:43:28 +00:00
parent ee4b2ccab4
commit 7cf7ae769c
4 changed files with 55 additions and 52 deletions

View File

@ -224,8 +224,11 @@ end
extern_lib_defs = {
boost = {
compile_settings = function()
if os.is("windows") or os.is("macosx") then
if os.is("windows") then
add_default_include_paths("boost")
elseif os.is("macosx") then
-- Suppress all the Boost warnings on OS X by including it as a system directory
buildoptions { "-isystem../" .. libraries_dir .. "boost/include" }
end
if os.getversion().description == "OpenBSD" then
includedirs { "/usr/local/include" }

View File

@ -5,44 +5,46 @@
# App bundles are intended to be self-contained and portable.
# An SDK is required, usually included with Xcode. The SDK ensures
# that only those system libraries are used which are available on
# the chosen target and compatible systems (10.6 by default).
# the chosen target and compatible systems.
#
# Steps to build a 0 A.D. bundle are:
# 1. confirm ARCH is set to desired target architecture
# 2. confirm SYSROOT points to the target SDK
# 2. confirm SYSROOT points to the correct target SDK
# 3. confirm MIN_OSX_VERSION matches the target OS X version
# 4. update BUNDLE_VERSION to match current 0 A.D. version
# 5. if building 32-bit 10.5 bundle, read the accompanying documentation
# 6. run this script
#
die()
{
echo ERROR: $*
exit 1
}
# Force build architecture, as sometimes environment is broken.
# Using multiple values would in theory produce a "universal"
# or fat binary, but this is untested.
# Choices are: x86_64 i386 (ppc and ppc64 not supported)
# For a universal fat binary, the approach would be to build every
# dependency with both archs and combine them with lipo, then do the
# same thing with the game itself.
# Choices are "x86_64" or "i386" (ppc and ppc64 not supported)
export ARCH=${ARCH:="x86_64"}
# Set SDK and mimimum required OSX version
# (As of Xcode 4.3, the SDKs are located directly in Xcode.app,
# but previously they were in /Developer/SDKs)
# TODO: we could get this from xcode-select but the user must set that up
# (As of Xcode 4.3, the SDKs are located directly in Xcode.app,
# but previously they were in /Developer/SDKs)
# TODO: we could get this from xcode-select but the user must set that up
#export SYSROOT=${SYSROOT="/Developer/SDKs/MacOSX10.5.sdk"}
export SYSROOT=${SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"}
export SYSROOT=${SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"}
export MIN_OSX_VERSION=${MIN_OSX_VERSION="10.6"}
# 0 A.D. release version, e.g. Alpha 12 is 0.0.12
BUNDLE_VERSION=${BUNDLE_VERSION:="0.0.0"}
# Define compiler as GCC (in case anything expects e.g. gcc-4.2)
# TODO: should use the compiler provided by the SDK
# Define compiler as "gcc" (in case anything expects e.g. gcc-4.2)
# On newer OS X versions, this will be a symbolic link to LLVM GCC
# TODO: don't rely on that
export CC=${CC:="gcc"} CXX=${CXX:="g++"}
die()
{
echo ERROR: $*
exit 1
}
# Check that we're actually on OS X
if [ "`uname -s`" != "Darwin" ]; then
die "This script is intended for OS X only"

View File

@ -66,6 +66,8 @@ if [ "`uname -s`" = "Darwin" ]; then
# Set *_CONFIG variables on OS X, to override the path to e.g. sdl-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"}
# use xml2-config from system or SDK
export XML2_CONFIG=${XML2_CONFIG:="$SYSROOT/usr/bin/xml2-config"}
fi
# Don't want to build bundled libs on OS X

View File

@ -18,26 +18,6 @@
# as not all build environments contain the Developer SDKs
# (Xcode does, but the Command Line Tools package does not)
#
set -e
die()
{
echo ERROR: $*
exit 1
}
download_lib()
{
local url=$1
local filename=$2
if [ ! -e $filename ]; then
echo "Downloading $filename"
curl -L -O ${url}${filename} || die "Download of $url$filename failed"
fi
}
# --------------------------------------------------------------
# Library versions for ease of updating:
# * SDL 1.2.15+ required for Lion support
@ -55,7 +35,7 @@ VORBIS_VERSION="libvorbis-1.3.3"
# --------------------------------------------------------------
# Bundled with the game:
# * SpiderMonkey 1.8.5
# * ENet
# * ENet 1.3.3
# * NVTT
# * FCollada
# --------------------------------------------------------------
@ -67,18 +47,16 @@ VORBIS_VERSION="libvorbis-1.3.3"
# * zlib
# --------------------------------------------------------------
# Force build architecture, as sometimes configure is broken.
# (Using multiple values would in theory produce a "universal"
# or fat binary, but this is untested)
#
# Choices are: x86_64 i386 (ppc and ppc64 NOT supported)
# Force build architecture, as sometimes environment is broken.
# For a universal fat binary, the approach would be to build every
# dependency with both archs and combine them with lipo, then do the
# same thing with the game itself.
# Choices are "x86_64" or "i386" (ppc and ppc64 not supported)
ARCH=${ARCH:="x86_64"}
# Define compiler as simply gcc (if anything expects e.g. gcc-4.2)
# sometimes the OS X build environment will be messed up because
# Apple dropped GCC support and removed the symbolic links, but
# after everyone complained they added them again. Now it is
# merely a GCC-like frontend to LLVM.
# Define compiler as "gcc" (in case anything expects e.g. gcc-4.2)
# On newer OS X versions, this will be a symbolic link to LLVM GCC
# TODO: don't rely on that
export CC=${CC:="gcc"} CXX=${CXX:="g++"}
# The various libs offer inconsistent configure options, some allow
@ -99,11 +77,31 @@ if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
LDFLAGS="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
fi
CFLAGS="$CFLAGS -arch $ARCH"
CPPFLAGS="$CPPFLAGS $CFLAGS"
# Avoid linker warnings about compiling translation units with different visibility settings
CPPFLAGS="$CPPFLAGS $CFLAGS -fvisibility=hidden"
LDFLAGS="$LDFLAGS -arch $ARCH"
JOBS=${JOBS:="-j2"}
set -e
die()
{
echo ERROR: $*
exit 1
}
download_lib()
{
local url=$1
local filename=$2
if [ ! -e $filename ]; then
echo "Downloading $filename"
curl -L -O ${url}${filename} || die "Download of $url$filename failed"
fi
}
# Check that we're actually on OS X
if [ "`uname -s`" != "Darwin" ]; then
die "This script is intended for OS X only"
@ -210,8 +208,6 @@ then
mkdir -p build-release
pushd build-release
# Avoid linker warnings about compiling translation units with different visibility settings
CPPFLAGS="$CPPFLAGS -fvisibility=hidden"
(../configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix=$INSTALL_DIR --disable-shared --enable-unicode --with-cocoa --with-opengl && make ${JOBS} && make install) || die "wxWidgets build failed"
popd
popd