NOTE: Requires update-workspaces!

Adds build script for OS X dependencies, fixes #1112. OS X builds no
longer use MacPorts/Homebrew, check BuildInstructions.
Adds build script for OS X bundles. Adds OS X icon and DMG background
image.
Moves bundled libraries to libraries/source.
Moves most headers and precompiled static libs for Windows to
libraries/win32.
Updates Premake and packaging scripts to support this.

This was SVN commit r13148.
This commit is contained in:
historic_bruno 2013-02-03 23:49:29 +00:00
parent b96009dafc
commit 14f1917a34
11 changed files with 947 additions and 163 deletions

View File

@ -6,17 +6,33 @@
-- 2) add library name to extern_libs tables in premake.lua for all 'projects' that want to use it
-- directory in which all library subdirectories reside.
libraries_dir = rootdir.."/libraries/"
-- directory in which OS-specific library subdirectories reside.
if os.is("macosx") then
libraries_dir = rootdir.."/libraries/osx/"
elseif os.is("windows") then
libraries_dir = rootdir.."/libraries/win32/"
else
-- No Unix-specific libs yet (use source directory instead!)
end
-- directory for shared, bundled libraries
libraries_source_dir = rootdir.."/libraries/source/"
local function add_default_lib_paths(extern_lib)
libdirs { libraries_dir .. extern_lib .. "/lib" }
end
local function add_source_lib_paths(extern_lib)
libdirs { libraries_source_dir .. extern_lib .. "/lib" }
end
local function add_default_include_paths(extern_lib)
includedirs { libraries_dir .. extern_lib .. "/include" }
end
local function add_source_include_paths(extern_lib)
includedirs { libraries_source_dir .. extern_lib .. "/include" }
end
-- For unixes: add buildflags and linkflags using pkg-config or another similar command.
-- By default, pkg-config is used. Other commands can be passed as "alternative_cmd".
@ -208,7 +224,7 @@ end
extern_lib_defs = {
boost = {
compile_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_include_paths("boost")
end
if os.getversion().description == "OpenBSD" then
@ -216,7 +232,7 @@ extern_lib_defs = {
end
end,
link_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_lib_paths("boost")
end
add_default_links({
@ -255,10 +271,10 @@ extern_lib_defs = {
},
cxxtest = {
compile_settings = function()
add_default_include_paths("cxxtest")
add_source_include_paths("cxxtest")
end,
link_settings = function()
add_default_lib_paths("cxxtest")
add_source_lib_paths("cxxtest")
end,
},
comsuppw = {
@ -273,12 +289,12 @@ extern_lib_defs = {
enet = {
compile_settings = function()
if not _OPTIONS["with-system-enet"] then
add_default_include_paths("enet")
add_source_include_paths("enet")
end
end,
link_settings = function()
if not _OPTIONS["with-system-enet"] then
add_default_lib_paths("enet")
add_source_lib_paths("enet")
end
add_default_links({
win_names = { "enet" },
@ -288,10 +304,10 @@ extern_lib_defs = {
},
fcollada = {
compile_settings = function()
add_default_include_paths("fcollada")
add_source_include_paths("fcollada")
end,
link_settings = function()
add_default_lib_paths("fcollada")
add_source_lib_paths("fcollada")
if os.is("windows") then
configuration "Debug"
links { "FColladaD" }
@ -342,12 +358,12 @@ extern_lib_defs = {
},
libjpg = {
compile_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_include_paths("libjpg")
end
end,
link_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_lib_paths("libjpg")
end
add_default_links({
@ -358,7 +374,7 @@ extern_lib_defs = {
},
libpng = {
compile_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_include_paths("libpng")
end
if os.getversion().description == "OpenBSD" then
@ -366,12 +382,15 @@ extern_lib_defs = {
end
end,
link_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_lib_paths("libpng")
end
add_default_links({
win_names = { "libpng15" },
unix_names = { "png" },
-- Otherwise ld will sometimes pull in ancient 1.2 from the SDK, which breaks the build :/
-- TODO: Figure out why that happens
osx_names = { "png15" },
})
end,
},
@ -379,13 +398,20 @@ extern_lib_defs = {
compile_settings = function()
if os.is("windows") then
add_default_include_paths("libxml2")
else
pkgconfig_cflags("libxml-2.0")
elseif os.is("macosx") then
-- Support XML2_CONFIG for overriding for the default PATH-based xml2-config
xml2_config_path = os.getenv("XML2_CONFIG")
if not xml2_config_path then
xml2_config_path = "xml2-config"
end
-- use xml2-config instead of pkg-config on OS X
pkgconfig_cflags(nil, xml2_config_path.." --cflags")
-- libxml2 needs _REENTRANT or __MT__ for thread support;
-- OS X doesn't get either set by default, so do it manually
if os.is("macosx") then
defines { "_REENTRANT" }
end
defines { "_REENTRANT" }
else
pkgconfig_cflags("libxml-2.0")
end
end,
link_settings = function()
@ -396,6 +422,12 @@ extern_lib_defs = {
configuration "Release"
links { "libxml2" }
configuration { }
elseif os.is("macosx") then
xml2_config_path = os.getenv("XML2_CONFIG")
if not xml2_config_path then
xml2_config_path = "xml2-config"
end
pkgconfig_libs(nil, xml2_config_path.." --libs")
else
pkgconfig_libs("libxml-2.0")
end
@ -404,17 +436,18 @@ extern_lib_defs = {
nvtt = {
compile_settings = function()
if not _OPTIONS["with-system-nvtt"] then
add_default_include_paths("nvtt")
add_source_include_paths("nvtt")
end
defines { "NVTT_SHARED=1" }
end,
link_settings = function()
if not _OPTIONS["with-system-nvtt"] then
add_default_lib_paths("nvtt")
add_source_lib_paths("nvtt")
end
add_default_links({
win_names = { "nvtt" },
unix_names = { "nvcore", "nvmath", "nvimage", "nvtt" },
osx_names = { "nvcore", "nvmath", "nvimage", "nvtt", "squish" },
dbg_suffix = "", -- for performance we always use the release-mode version
})
end,
@ -502,13 +535,15 @@ extern_lib_defs = {
else
if os.is("windows") then
include_dir = "include-win32"
elseif os.is("macosx") then
include_dir = "include"
else
include_dir = "include-unix"
end
configuration "Debug"
includedirs { libraries_dir.."spidermonkey/"..include_dir }
includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
configuration "Release"
includedirs { libraries_dir.."spidermonkey/"..include_dir }
includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
configuration { }
end
end,
@ -521,30 +556,30 @@ extern_lib_defs = {
end
else
configuration "Debug"
links { "mozjs185-ps-debug" }
links { "mozjs185-ps-debug" }
configuration "Release"
links { "mozjs185-ps-release" }
configuration { }
add_default_lib_paths("spidermonkey")
add_source_lib_paths("spidermonkey")
end
end,
},
valgrind = {
compile_settings = function()
add_default_include_paths("valgrind")
add_source_include_paths("valgrind")
end,
link_settings = function()
add_default_lib_paths("valgrind")
add_source_lib_paths("valgrind")
end,
},
vorbis = {
compile_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_include_paths("vorbis")
end
end,
link_settings = function()
if os.is("windows") then
if os.is("windows") or os.is("macosx") then
add_default_lib_paths("vorbis")
end
-- TODO: We need to force linking with these as currently
@ -558,6 +593,7 @@ extern_lib_defs = {
add_default_links({
win_names = { "vorbisfile" },
unix_names = { "vorbisfile" },
osx_names = { "vorbis", "vorbisenc", "vorbisfile", "ogg" },
dbg_suffix = "_d",
})
end,
@ -653,19 +689,4 @@ function project_add_extern_libs(extern_libs, target_type)
def.link_settings()
end
end
if os.is("macosx") then
-- MacPorts uses /opt/local as the prefix for most of its libraries,
-- which isn't on the default compiler's default include path.
-- This needs to come after we add our own external libraries, so that
-- our versions take precedence over the system versions (especially
-- for SpiderMonkey), which means we have to do it per-config
configuration "Debug"
includedirs { "/opt/local/include" }
libdirs { "/opt/local/lib" }
configuration "Release"
includedirs { "/opt/local/include" }
libdirs { "/opt/local/lib" }
configuration { }
end
end

View File

@ -13,6 +13,9 @@ newoption { trigger = "without-pch", description = "Disable generation and usage
newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" }
newoption { trigger = "with-system-enet", description = "Search standard paths for libenet, instead of using bundled copy" }
newoption { trigger = "with-system-mozjs185", description = "Search standard paths for libmozjs185, instead of using bundled copy" }
newoption { trigger = "sysroot", description = "Set compiler system root path, used for building against a non-system SDK. For example /usr/local becomes SYSROOT/user/local" }
newoption { trigger = "macosx-version-min", description = "Set minimum required version of the OS X API, the build will possibly fail if an older SDK is used, while newer API functions will be weakly linked (i.e. resolved at runtime)" }
newoption { trigger = "macosx-bundle", description = "Enable OSX bundle, the argument is the bundle identifier string (e.g. com.wildfiregames.0ad)" }
newoption { trigger = "bindir", description = "Directory for executables (typically '/usr/games'); default is to be relocatable" }
newoption { trigger = "datadir", description = "Directory for data files (typically '/usr/share/games/0ad'); default is ../data/ relative to executable" }
@ -50,7 +53,6 @@ else
end
end
-- Set up the Solution
solution "pyrogenesis"
targetdir(rootdir.."/binaries/system")
@ -274,6 +276,23 @@ function project_set_build_flags()
if os.is("macosx") then
buildoptions { "-msse2" }
end
-- Check if SDK path should be used
if _OPTIONS["sysroot"] then
buildoptions { "-isysroot " .. _OPTIONS["sysroot"] }
linkoptions { "-Wl,-syslibroot," .. _OPTIONS["sysroot"] }
end
-- On OS X, sometimes we need to specify the minimum API version to use
if _OPTIONS["macosx-version-min"] then
buildoptions { "-mmacosx-version-min=" .. _OPTIONS["macosx-version-min"] }
linkoptions { "-mmacosx-version-min=" .. _OPTIONS["macosx-version-min"] }
end
-- Check if we're building a bundle
if _OPTIONS["macosx-bundle"] then
defines { "BUNDLE_IDENTIFIER=" .. _OPTIONS["macosx-bundle"] }
end
end
if not _OPTIONS["minimal-flags"] then
@ -284,15 +303,6 @@ function project_set_build_flags()
}
end
-- X11 includes may be installed in one of a gadzillion of three places
-- Famous last words: "You can't include too much! ;-)"
includedirs {
"/usr/X11R6/include/X11",
"/usr/X11R6/include",
"/usr/include/X11"
}
libdirs { "/usr/X11R6/lib" }
if _OPTIONS["bindir"] then
defines { "INSTALLED_BINDIR=" .. _OPTIONS["bindir"] }
end
@ -326,6 +336,20 @@ function project_set_build_flags()
end
end
-- add X11 includes paths after all the others so they don't conflict with
-- bundled libs
function project_add_x11_dirs()
if not os.is("windows") and not os.is("macosx") then
-- X11 includes may be installed in one of a gadzillion of three places
-- Famous last words: "You can't include too much! ;-)"
includedirs {
"/usr/X11R6/include/X11",
"/usr/X11R6/include",
"/usr/include/X11"
}
libdirs { "/usr/X11R6/lib" }
end
end
-- create a project and set the attributes that are common to all projects.
function project_create(project_name, target_type)
@ -462,6 +486,7 @@ function setup_static_lib_project (project_name, rel_source_dirs, extern_libs, e
project_create(project_name, target_type)
project_add_contents(source_root, rel_source_dirs, {}, extra_params)
project_add_extern_libs(extern_libs, target_type)
project_add_x11_dirs()
if not extra_params["no_default_link"] then
table.insert(static_lib_names, project_name)
@ -750,6 +775,7 @@ function setup_main_exe ()
}
project_add_contents(source_root, {}, {}, extra_params)
project_add_extern_libs(used_extern_libs, target_type)
project_add_x11_dirs()
-- Platform Specifics
if os.is("windows") then
@ -835,6 +861,7 @@ function setup_atlas_project(project_name, target_type, rel_source_dirs, rel_inc
project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
project_add_extern_libs(extern_libs, target_type)
project_add_x11_dirs()
-- Platform Specifics
if os.is("windows") then
@ -852,7 +879,12 @@ function setup_atlas_project(project_name, target_type, rel_source_dirs, rel_inc
-- install_name settings aren't really supported yet by premake, but there are plans for the future.
-- we currently use this hack to work around some bugs with wrong install_names.
if target_type == "SharedLib" then
linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
if _OPTIONS["macosx-bundle"] then
-- If we're building a bundle, it will be in ../Frameworks
linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name..".dylib" }
else
linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
end
end
end
@ -963,6 +995,7 @@ function setup_atlas_frontend_project (project_name)
"spidermonkey",
},
target_type)
project_add_x11_dirs()
local source_root = rootdir.."/source/tools/atlas/AtlasFrontends/"
files { source_root..project_name..".cpp" }
@ -1007,6 +1040,7 @@ function setup_collada_project(project_name, target_type, rel_source_dirs, rel_i
extra_params["pch_dir"] = source_root
project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
project_add_extern_libs(extern_libs, target_type)
project_add_x11_dirs()
-- Platform Specifics
if os.is("windows") then
@ -1049,7 +1083,12 @@ function setup_collada_project(project_name, target_type, rel_source_dirs, rel_i
-- install_name settings aren't really supported yet by premake, but there are plans for the future.
-- we currently use this hack to work around some bugs with wrong install_names.
if target_type == "SharedLib" then
linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
if _OPTIONS["macosx-bundle"] then
-- If we're building a bundle, it will be in ../Frameworks
linkoptions { "-install_name @executable_path/../Frameworks/lib"..project_name..".dylib" }
else
linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
end
end
buildoptions { "-fno-strict-aliasing" }
@ -1180,6 +1219,7 @@ function setup_tests()
project_add_contents(source_root, {}, {}, extra_params)
project_add_extern_libs(used_extern_libs, target_type)
project_add_x11_dirs()
-- TODO: should fix the duplication between this OS-specific linking
-- code, and the similar version in setup_main_exe

BIN
build/resources/0ad.icns (Stored with Git LFS) Normal file

Binary file not shown.

BIN
build/resources/dmgbackground.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,43 @@
Steps to cross-compile a 32-bit Leopard compatible binary on 64-bit Snow Leopard:
* install Xcode 3.x with 10.5 SDK (may work on later OS X and Xcode versions as well, but no longer supported by Apple)
* force arch to "x86", may need to override detection in premake4.lua
* may need to unset HOSTTYPE before running update-workspaces.sh, since that variable is used in hacky arch detection
In libraries/osx/build-osx-lbs.sh:
* set ARCH="i386"
* for Spidermonkey build, add "--target=i386-apple-darwin9.0.0" configure option, it seems to use this value to determine the correct target arch (otherwise defaults to x86_64 which breaks the cross-compile)
In build/workspaces/build-osx-bundle.sh:
* set ARCH="i386"
* set SYSROOT="/Developer/SDKs/MacOSX10.5.sdk"
* set MIN_OSX_VERSION="10.5"
One of the files in the 10.5 SDK's OpenAL library needs to be patched to build with GCC 4.2. Specifically, open "/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h" and replace every instance of "ALCvoid" with "void" except the first typedef. Xcode might refuse to modify this protected file.
For 32-bit GCC 4.2 build, there will be an error about not finding a register in class BREG, in the cpuid() function of source/lib/sysdep/arch/x86_64/x86_64.cpp. This is due to PIC. Apply the following patch to fix it:
Index: source/lib/sysdep/arch/x86_x64/x86_x64.cpp
===================================================================
--- source/lib/sysdep/arch/x86_x64/x86_x64.cpp (revision 11863)
+++ source/lib/sysdep/arch/x86_x64/x86_x64.cpp (working copy)
@@ -50,8 +50,12 @@
// VC10+ and VC9 SP1: __cpuidex is already available
#elif GCC_VERSION
# define __cpuidex(regsArray, level, index)\
- __asm__ __volatile__ ("cpuid"\
- : "=a" ((regsArray)[0]), "=b" ((regsArray)[1]), "=c" ((regsArray)[2]), "=d" ((regsArray)[3])\
+ __asm__ __volatile__ (\
+ "pushl %%ebx\n"\
+ "cpuid\n"\
+ "movl %%ebx, %1\n"\
+ "popl %%ebx\n"\
+ : "=a" ((regsArray)[0]), "=r" ((regsArray)[1]), "=c" ((regsArray)[2]), "=d" ((regsArray)[3])\
: "0" (level), "2" (index));
#else
# error "compiler not supported"
Finally run build-osx-bundle.sh, if it works a bundle will be produced.
You can use the "file" command to verify binaries and dylibs were built for i386 arch. If there were missing symbols in the linking stage, then probably one of the dependencies was built as the wrong arch (likely x86_64), which could be a config problem.

View File

@ -0,0 +1,192 @@
#!/bin/sh
#
# This script will build an OSX app bundle for 0 A.D.
#
# 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).
#
# 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
# 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)
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
#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 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
export CC=${CC:="gcc"} CXX=${CXX:="g++"}
# Check that we're actually on OS X
if [ "`uname -s`" != "Darwin" ]; then
die "This script is intended for OS X only"
fi
# Check SDK exists
if [ ! -d "$SYSROOT" ]; then
die "$SYSROOT does not exist! You probably need to install Xcode"
fi
cd "$(dirname $0)"
# Now in build/workspaces/ (where we assume this script resides)
BUNDLE_OUTPUT=${BUNDLE_OUTPUT:="$(pwd)/0ad.app"}
BUNDLE_CONTENTS=$BUNDLE_OUTPUT/Contents
BUNDLE_BIN=$BUNDLE_CONTENTS/MacOS
BUNDLE_RESOURCES=$BUNDLE_CONTENTS/Resources
BUNDLE_FRAMEWORKS=$BUNDLE_CONTENTS/Frameworks
BUNDLE_PLUGINS=$BUNDLE_CONTENTS/PlugIns
BUNDLE_SHAREDSUPPORT=$BUNDLE_CONTENTS/SharedSupport
# Unique identifier string for this bundle (reverse-DNS style)
BUNDLE_IDENTIFIER=${BUNDLE_IDENTIFIER:="com.wildfiregames.0ad"}
# Minimum version of OSX on which the bundle will run
BUNDLE_MIN_OSX_VERSION="${MIN_OSX_VERSION}.0"
JOBS=${JOBS:="-j5"}
# Parse command-line options:
for i in "$@"
do
case $i in
-j* ) JOBS=$i ;;
esac
done
# TODO: Do we really want to regenerate everything? (consider if one task fails)
# Build libraries against SDK
echo "\nBuilding libaries\n"
pushd ../../libraries/osx
./build-osx-libs.sh $JOBS --force-rebuild || die "Libraries build script failed"
popd
# Clean and update workspaces
echo "\nGenerating workspaces\n"
# Pass OSX options through to Premake
(./clean-workspaces.sh && SYSROOT="$SYSROOT" MIN_OSX_VERSION="$MIN_OSX_VERSION" ./update-workspaces.sh --macosx-bundle="$BUNDLE_IDENTIFIER" --sysroot="$SYSROOT" --macosx-version-min="$MIN_OSX_VERSION") || die "update-workspaces.sh failed!"
# Get SVN revision and update svn_revision.txt
SVNREV=`svnversion -n .`
echo L\"${SVNREV}-release\" > ../svn_revision/svn_revision.txt
pushd gcc
echo "\nBuilding game\n"
(make clean && CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" make ${JOBS}) || die "Game build failed!"
popd
# TODO: This is yucky - should we first export our working copy, like source\tools\dist\build.sh?
svn revert ../svn_revision/svn_revision.txt
# Create bundle structure
echo "\nCreating bundle directories\n"
rm -rf ${BUNDLE_OUTPUT}
mkdir -p ${BUNDLE_BIN}
mkdir -p ${BUNDLE_FRAMEWORKS}
mkdir -p ${BUNDLE_PLUGINS}
mkdir -p ${BUNDLE_RESOURCES}
mkdir -p ${BUNDLE_SHAREDSUPPORT}
pushd ../../binaries/system
# Run test to confirm all is OK
echo "\nRunning tests\n"
./test || die "Test(s) failed!"
# Build archive(s) - don't archive the _test.* mods
# (and we should exclude internal)
pushd ../data/mods
archives=""
for modname in [a-zA-Z0-9]*
do
if [ "${modname}" = "internal" ]; then continue; fi
archives="${archives} ${modname}"
done
popd
for modname in $archives
do
echo "\nBuilding archive for '${modname}'\n"
ARCHIVEBUILD_INPUT="$(pwd)/../data/mods/${modname}"
ARCHIVEBUILD_OUTPUT="${BUNDLE_RESOURCES}/data/mods/${modname}"
# For some reason the output directory has to exist?
mkdir -p ${ARCHIVEBUILD_OUTPUT}
(./pyrogenesis -archivebuild=${ARCHIVEBUILD_INPUT} -archivebuild-output=${ARCHIVEBUILD_OUTPUT}/${modname}.zip) || die "Archive build for '${modname}' failed!"
done
popd
# Copy binaries
echo "\nCopying binaries\n"
# Only pyrogenesis for now, until we find a way to load
# multiple binaries from one app bundle
# TODO: Would be nicer if we could set this path in premake
cp ../../binaries/system/pyrogenesis ${BUNDLE_BIN}
# Copy libs
echo "\nCopying libs\n"
# TODO: Should probably make it so these libs get built in place
cp -v ../../binaries/system/libAtlasUI.dylib ${BUNDLE_FRAMEWORKS}
cp -v ../../binaries/system/libCollada.dylib ${BUNDLE_FRAMEWORKS}
# Copy data
echo "\nCopying non-archived game data\n"
cp -v ../resources/0ad.icns ${BUNDLE_RESOURCES}
cp -R -v ../../binaries/data/config ${BUNDLE_RESOURCES}/data/
cp -R -v ../../binaries/data/tools ${BUNDLE_RESOURCES}/data/
# Copy license/readmes
# TODO: Also want copies in the DMG - decide on layout
echo "\nCopying readmes\n"
cp -v ../../*.txt ${BUNDLE_RESOURCES}
# Create Info.plist
echo "\nCreating Info.plist\n"
alias PlistBuddy=/usr/libexec/PlistBuddy
INFO_PLIST="${BUNDLE_CONTENTS}/Info.plist"
PlistBuddy -c "Add :CFBundleName string 0 A.D." ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleIdentifier string ${BUNDLE_IDENTIFIER}" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleVersion string ${BUNDLE_VERSION}" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundlePackageType string APPL" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleSignature string none" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleExecutable string pyrogenesis" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleShortVersionString string ${BUNDLE_VERSION}" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleDevelopmentRegion string English" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleInfoDictionaryVersion string 6.0" ${INFO_PLIST}
PlistBuddy -c "Add :CFBundleIconFile string 0ad" ${INFO_PLIST}
PlistBuddy -c "Add :LSMinimumSystemVersion string ${BUNDLE_MIN_OSX_VERSION}" ${INFO_PLIST}
PlistBuddy -c "Add :NSHumanReadableCopyright string Copyright © 2013 Wildfire Games" ${INFO_PLIST}
# TODO: Automatically create compressed DMG with hditutil?
# (this is a bit complicated so I do it manually for now)
# (also we need to have good icon placement, background image, etc)
echo "\nBundle complete! Located in ${BUNDLE_OUTPUT}"

View File

@ -18,12 +18,15 @@ esac
cd "$(dirname $0)"
# Now in build/workspaces/ (where we assume this script resides)
echo "Cleaning bundled third-party dependencies..."
# We don't want to clean bundled libs on OS X
if [ "`uname -s`" != "Darwin" ]; then
echo "Cleaning bundled third-party dependencies..."
(cd ../../libraries/fcollada/src && rm -rf ./output)
(cd ../../libraries/spidermonkey && rm -f .already-built)
(cd ../../libraries/spidermonkey && rm -rf ./js-1.8.5)
(cd ../../libraries/nvtt/src && rm -rf ./build)
(cd ../../libraries/source/fcollada/src && rm -rf ./output)
(cd ../../libraries/source/spidermonkey && rm -f .already-built)
(cd ../../libraries/source/spidermonkey && rm -rf ./js-1.8.5)
(cd ../../libraries/source/nvtt/src && rm -rf ./build)
fi
(cd ../premake/premake4/build/gmake.bsd && ${MAKE} clean)
(cd ../premake/premake4/build/gmake.macosx && ${MAKE} clean)

View File

@ -59,28 +59,37 @@ if [ "$enable_atlas" = "true" ]; then
premake_args="${premake_args} --atlas"
fi
cd "$(dirname $0)"
# Now in build/workspaces/ (where we assume this script resides)
echo "Updating bundled third-party dependencies..."
echo
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"}
fi
# Build/update bundled external libraries
(cd ../../libraries/fcollada/src && ${MAKE} ${JOBS}) || die "FCollada build failed"
echo
if [ "$with_system_mozjs185" = "false" ]; then
(cd ../../libraries/spidermonkey && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "SpiderMonkey build failed"
# Don't want to build bundled libs on OS X
# (build-osx-libs.sh is used instead)
if [ "`uname -s`" != "Darwin" ]; then
echo "Updating bundled third-party dependencies..."
echo
# Build/update bundled external libraries
(cd ../../libraries/source/fcollada/src && ${MAKE} ${JOBS}) || die "FCollada build failed"
echo
if [ "$with_system_mozjs185" = "false" ]; then
(cd ../../libraries/source/spidermonkey && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "SpiderMonkey build failed"
fi
echo
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
(cd ../../libraries/source/nvtt && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "NVTT build failed"
fi
echo
if [ "$with_system_enet" = "false" ]; then
(cd ../../libraries/source/enet && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "ENet build failed"
fi
echo
fi
echo
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
(cd ../../libraries/nvtt && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "NVTT build failed"
fi
echo
if [ "$with_system_enet" = "false" ]; then
(cd ../../libraries/enet && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "ENet build failed"
fi
echo
# Now build premake and run it to create the makefiles
cd ../premake/premake4
@ -106,12 +115,13 @@ cd ..
# If we're in bash then make HOSTTYPE available to Premake, for primitive arch-detection
export HOSTTYPE="$HOSTTYPE"
echo "Premake args: ${premake_args}"
premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die "Premake failed"
premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die "Premake failed"
# Also generate xcode workspaces if on OS X
if [ "`uname -s`" = "Darwin" ]
then
if [ "`uname -s`" = "Darwin" ]; then
premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/xcode3" ${premake_args} xcode3 || die "Premake failed"
premake4/bin/release/premake4 --file="premake4.lua" --outpath="../workspaces/xcode4" ${premake_args} xcode4 || die "Premake failed"
fi

View File

@ -1,56 +1,61 @@
This directory contains libraries that are used by the game, mostly
precompiled for Windows developers, but a few are bundled with source
when the game requires a specific version that may not be available
in package managers.
This directory contains libraries that are used by the game:
boost
Boost Software License
osx/ contains a script for download and building required libraries on OS X.
source/ contains bundled source, when the game requires a specific library
version that may not be available in package managers.
win32/ contains headers and precompiled static libs for Windows builds.
cryptopp
Crypto++ License (files are public domain)
cxxtest
LGPL v2.1 (see COPYING)
enet
MIT (see src/LICENSE)
fcollada
MIT (see src/FCollada/Copyright.txt)
libcurl
osx/build-osx-libs.sh
MIT
libjpg
source/cxxtest
LGPL v2.1 (see COPYING)
source/enet
MIT (see src/LICENSE)
source/fcollada
MIT (see src/FCollada/Copyright.txt)
source/nvtt
MIT (see src/NVIDIA_Texture_Tools_LICENSE.txt)
source/spidermonkey
MPL / GPL / LGPL
source/valgrind
BSD
win32/boost
Boost Software License
win32/cryptopp
Crypto++ License (files are public domain)
win32/libcurl
MIT
win32/libjpg
libjpeg license
libpng
win32/libpng
libpng license
libxml2
win32/libxml2
MIT
LGPL v2.0 (include/iconv.h)
nvtt
MIT (see src/NVIDIA_Texture_Tools_LICENSE.txt)
openal
win32/openal
LGPL v2.0
opengl
win32/opengl
MIT
sdl
win32/sdl
LGPL v2.1
spidermonkey
MPL / GPL / LGPL
valgrind
win32/vorbis
BSD
vorbis
BSD
zlib
win32/zlib
zlib license

466
libraries/osx/build-osx-libs.sh Executable file
View File

@ -0,0 +1,466 @@
#!/bin/bash
#
# Script for acquiring and building OS X dependencies for 0 A.D.
#
# The script checks whether a source tarball exists for each
# dependency, if not it will download the correct version from
# the project's website, then it removes previous build files,
# extracts the tarball, configures and builds the lib. The script
# should die on any errors to ease troubleshooting.
#
# make install is used to copy the compiled libs to each specific
# directory and also the config tools (e.g. sdl-config). Because
# of this, OS X developers must run this script at least once,
# to configure the correct lib directories. It must be run again
# if the libraries are moved.
#
# Building against an SDK is an option, though not required,
# 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
SDL_VERSION="SDL-1.2.15"
BOOST_VERSION="boost_1_52_0"
# * wxWidgets 2.9+ is necessary for 64-bit OS X build w/ OpenGL support
WXWIDGETS_VERSION="wxWidgets-2.9.4"
JPEG_VERSION="jpegsrc.v8d"
JPEG_DIR="jpeg-8d" # Must match directory name inside source tarball
# * libpng was included as part of X11 but that's removed from Mountain Lion
# (also the Snow Leopard version was ancient 1.2)
PNG_VERSION="libpng-1.5.13"
OGG_VERSION="libogg-1.3.0"
VORBIS_VERSION="libvorbis-1.3.3"
# --------------------------------------------------------------
# Bundled with the game:
# * SpiderMonkey 1.8.5
# * ENet
# * NVTT
# * FCollada
# --------------------------------------------------------------
# Provided by OS X:
# * curl
# * libxml2
# * OpenAL
# * OpenGL
# * 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)
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.
export CC=${CC:="gcc"} CXX=${CXX:="g++"}
# The various libs offer inconsistent configure options, some allow
# setting sysroot and OS X-specific options, others don't. Adding to
# the confusion, Apple moved /Developer/SDKs into the Xcode app bundle
# so the path can't be guessed by clever build tools (like Boost.Build).
# Sometimes configure gets it wrong anyway, especially on cross compiles.
# This is why we prefer using CFLAGS, CPPFLAGS, and LDFLAGS.
# Check if SYSROOT is set and not empty
if [[ $SYSROOT && ${SYSROOT-_} ]]; then
CFLAGS="$CFLAGS -isysroot $SYSROOT"
LDFLAGS="$LDFLAGS -Wl,-syslibroot,$SYSROOT"
fi
# Check if MIN_OSX_VERSION is set and not empty
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
CFLAGS="$CFLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
LDFLAGS="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
fi
CFLAGS="$CFLAGS -arch $ARCH"
CPPFLAGS="$CPPFLAGS $CFLAGS"
LDFLAGS="$LDFLAGS -arch $ARCH"
JOBS=${JOBS:="-j2"}
# Check that we're actually on OS X
if [ "`uname -s`" != "Darwin" ]; then
die "This script is intended for OS X only"
fi
# Parse command-line options:
force_rebuild=false
for i in "$@"
do
case $i in
--force-rebuild ) force_rebuild=true;;
-j* ) JOBS=$i ;;
esac
done
cd "$(dirname $0)"
# Now in libraries/osx/ (where we assume this script resides)
# --------------------------------------------------------------
echo -e "\nBuilding SDL...\n"
LIB_VERSION="${SDL_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY=$LIB_VERSION
LIB_URL="http://www.libsdl.org/release/"
mkdir -p sdl
pushd sdl
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
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-shared=no && make $JOBS && make install) || die "SDL build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding Boost...\n"
LIB_VERSION="${BOOST_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.bz2"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://download.sourceforge.net/boost/"
mkdir -p boost
pushd boost
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
# Can't use macosx-version, see above comment.
(./bootstrap.sh --with-libraries=filesystem,system,signals --prefix=$INSTALL_DIR && ./b2 cflags="$CFLAGS" cxxflags="$CPPFLAGS" linkflags="$LDFLAGS" ${JOBS} -d2 --layout=tagged --debug-configuration link=static threading=multi variant=release,debug install) || die "Boost build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
# TODO: This build takes ages, anything we can exlude?
echo -e "\nBuilding wxWidgets...\n"
LIB_VERSION="${WXWIDGETS_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.bz2"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://download.sourceforge.net/wxwindows/"
mkdir -p wxwidgets
pushd wxwidgets
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
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
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding libjpg...\n"
LIB_VERSION="${JPEG_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY="${JPEG_DIR}"
LIB_URL="http://www.ijg.org/files/"
mkdir -p libjpg
pushd libjpg
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
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix=$INSTALL_DIR --enable-shared=no && make ${JOBS} && make install) || die "libjpg build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding libpng...\n"
LIB_VERSION="${PNG_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://download.sourceforge.net/libpng/"
mkdir -p libpng
pushd libpng
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
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix=$INSTALL_DIR --enable-shared=no && make ${JOBS} && make install) || die "libpng build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding libogg...\n"
LIB_VERSION="${OGG_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://downloads.xiph.org/releases/ogg/"
# Dependency of vorbis
# we can install them in the same directory for convenience
mkdir -p libogg
mkdir -p vorbis
INSTALL_DIR="$(pwd)/vorbis"
pushd libogg
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
then
download_lib $LIB_URL $LIB_ARCHIVE
rm -rf $LIB_DIRECTORY
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix=$INSTALL_DIR --enable-shared=no && make ${JOBS} && make install) || die "libogg build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding libvorbis...\n"
LIB_VERSION="${VORBIS_VERSION}"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY="$LIB_VERSION"
LIB_URL="http://downloads.xiph.org/releases/vorbis/"
pushd vorbis
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
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix="$INSTALL_DIR" --enable-shared=no --with-ogg="$INSTALL_DIR" && make ${JOBS} && make install) || die "libvorbis build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------------
# The following libraries are shared on different OSes and may
# be customzied, so we build and install them from bundled sources
# --------------------------------------------------------------------
echo -e "\nBuilding Spidermonkey...\n"
LIB_VERSION="js185-1.0.0"
LIB_ARCHIVE="$LIB_VERSION.tar.gz"
LIB_DIRECTORY="js-1.8.5"
pushd ../source/spidermonkey/
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]]
then
INSTALL_DIR="$(pwd)"
rm -f lib/*.a
rm -rf $LIB_DIRECTORY
tar -xf $LIB_ARCHIVE
pushd $LIB_DIRECTORY/js/src
# We want separate debug/release versions of the library, so change their install name in the Makefile
sed -i.bak -e 's/\(STATIC_LIBRARY_NAME),mozjs185-\)\(\$(SRCREL_ABI_VERSION)\)\{0,1\}/\1ps-debug/' Makefile.in
CONF_OPTS="--prefix=${INSTALL_DIR} --disable-tests --disable-shared-js"
# Uncomment this line for 32-bit 10.5 cross compile:
#CONF_OPTS="$CONF_OPTS --target=i386-apple-darwin9.0.0"
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
CONF_OPTS="$CONF_OPTS --enable-macos-target=$MIN_OSX_VERSION"
fi
if [[ $SYSROOT && ${SYSROOT-_} ]]; then
CONF_OPTS="$CONF_OPTS --with-macosx-sdk=$SYSROOT"
fi
mkdir -p build-debug
pushd build-debug
(CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS --enable-debug --disable-optimize && make ${JOBS} && make install) || die "Spidermonkey build failed"
popd
mv Makefile.in.bak Makefile.in
sed -i.bak -e 's/\(STATIC_LIBRARY_NAME),mozjs185-\)\(\$(SRCREL_ABI_VERSION)\)\{0,1\}/\1ps-release/' Makefile.in
mkdir -p build-release
pushd build-release
(CC="$CC -arch $ARCH" CXX="$CXX -arch $ARCH" AR=ar CROSS_COMPILE=1 ../configure $CONF_OPTS && make ${JOBS} && make install) || die "Spidermonkey build failed"
popd
mv Makefile.in.bak Makefile.in
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
echo -e "\nBuilding ENet...\n"
pushd ../source/enet/
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]]
then
INSTALL_DIR="$(pwd)"
pushd src
(./configure CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" --prefix=${INSTALL_DIR} --enable-shared=no && make clean && make ${JOBS} && make install) || die "ENet build failed"
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
# NVTT - no install
echo -e "\nBuilding NVTT...\n"
pushd ../source/nvtt
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]]
then
pushd src
rm -rf build
mkdir -p build
pushd build
# Could use CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT
# but they're not as flexible for cross-compiling
(cmake .. -DCMAKE_LINK_FLAGS="$LDFLAGS" -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CPPFLAGS" -DCMAKE_BUILD_TYPE=Release -DBINDIR=bin -DLIBDIR=lib -DGLUT=0 -DGLEW=0 -DCG=0 -DCUDA=0 -DOPENEXR=0 -G "Unix Makefiles" && make clean && make nvtt ${JOBS}) || die "NVTT build failed"
popd
mkdir -p ../lib
cp build/src/nv*/libnv*.a ../lib/
cp build/src/nvtt/squish/libsquish.a ../lib/
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd
# --------------------------------------------------------------
# FCollada - no install
echo -e "\nBuilding FCollada...\n"
pushd ../source/fcollada
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]]
then
pushd src
rm -rf output
mkdir -p ../lib
# The Makefile refers to pkg-config for libxml2, but we
# don't have that (replace with xml2-config instead)
sed -i.bak -e 's/pkg-config libxml-2.0/xml2-config/' Makefile
(make clean && CXXFLAGS=$CPPFLAGS make ${JOBS}) || die "FCollada build failed"
# Undo Makefile change
mv Makefile.bak Makefile
popd
touch .already-built
else
echo -e "\nSkipping - already built\n"
fi
popd

View File

@ -35,12 +35,10 @@ cp export-unix/binaries/data/mods/public/public.zip export-win32/binaries/data/m
# Collect the relevant files
ln -Tsf export-unix ${PREFIX}
tar cf $PREFIX-unix-build.tar \
--exclude='*.bat' --exclude='*.dll' --exclude='*.exe' \
--exclude='libraries/enet/lib/*.lib' \
--exclude='libraries/fcollada/lib/*' --exclude='libraries/fcollada/src/FCollada/FColladaTest' \
--exclude='libraries/nvtt/lib/*' \
--exclude='libraries/spidermonkey/lib/*' --exclude='libraries/spidermonkey/include-win32' \
${PREFIX}/{source,build,libraries/{cxxtest,enet,fcollada,spidermonkey,valgrind,nvtt},binaries/system/readme.txt,binaries/data/tests,binaries/data/mods/_test.*,*.txt}
--exclude='*.bat' --exclude='*.dll' --exclude='*.exe' --exclude='*.lib' \
--exclude='libraries/source/fcollada/src/FCollada/FColladaTest' \
--exclude='libraries/source/spidermonkey/include-win32' \
${PREFIX}/{source,build,libraries/source,binaries/system/readme.txt,binaries/data/tests,binaries/data/mods/_test.*,*.txt}
tar cf $PREFIX-unix-data.tar ${PREFIX}/binaries/data/{config,mods/public/public.zip,tools}
# TODO: ought to include generated docs in here, perhaps?