forked from 0ad/0ad
Updates OS X bundle build script. Adds --release flag which can be used to build a proper release bundle, including SVN export, at the expense of time and disk space. Moves SVN-specific logic to this mode, otherwise the script works with git or no source control at all.
Removes obsolete instructions for building a 32-bit 10.5 bundle. This was SVN commit r15801.
This commit is contained in:
parent
d1a31b3f54
commit
b155d4f7e3
@ -1,43 +0,0 @@
|
||||
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.
|
@ -12,8 +12,7 @@
|
||||
# 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
|
||||
# 5. run this script
|
||||
#
|
||||
|
||||
# Force build architecture, as sometimes environment is broken.
|
||||
@ -26,19 +25,24 @@ 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.9.sdk"}
|
||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION="10.9"}
|
||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION="10.7"}
|
||||
|
||||
# 0 A.D. release version, e.g. Alpha 12 is 0.0.12
|
||||
# 0 A.D. release version, e.g. Alpha 17 is 0.0.17
|
||||
BUNDLE_VERSION=${BUNDLE_VERSION:="0.0.0"}
|
||||
|
||||
# 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
|
||||
# Define compiler as "clang", this is all Mavericks supports.
|
||||
# gcc symlinks may still exist, but they are simply clang with
|
||||
# slightly different config, which confuses build scripts.
|
||||
# llvm-gcc and gcc 4.2 are no longer supported by SpiderMonkey.
|
||||
export CC=${CC:="clang"} CXX=${CXX:="clang++"}
|
||||
|
||||
# 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"
|
||||
|
||||
die()
|
||||
{
|
||||
echo ERROR: $*
|
||||
@ -58,6 +62,33 @@ fi
|
||||
cd "$(dirname $0)"
|
||||
# Now in build/workspaces/ (where we assume this script resides)
|
||||
|
||||
JOBS=${JOBS:="-j5"}
|
||||
build_release=false
|
||||
build_path="$HOME/0ad-export"
|
||||
|
||||
# Parse command-line options:
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
-j* ) JOBS=$i ;;
|
||||
--release ) build_release=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# For release, export an SVN copy
|
||||
if [ "$build_release" = "true" ]; then
|
||||
BUNDLE_OUTPUT="$build_path/0ad.app"
|
||||
SVN_REV=`svnversion -n ../..`
|
||||
rm -rf $build_path
|
||||
svn export ../.. $build_path || die "Error exporting SVN working directory"
|
||||
cd $build_path
|
||||
rm binaries/data/config/dev.cfg
|
||||
# Only include translations for a subset of languages
|
||||
find binaries/data -name "*.po" | grep -v '.*/\(ca\|cs\|de\|en_GB\|es\|fr\|gd\|gl\|it\|nl\|pt_PT\|pt_BR\)\.[A-Za-z0-9_.]\+\.po' | xargs rm
|
||||
echo L\"${SVNREV}-release\" > build/svn_revision/svn_revision.txt
|
||||
cd build/workspaces
|
||||
fi
|
||||
|
||||
BUNDLE_OUTPUT=${BUNDLE_OUTPUT:="$(pwd)/0ad.app"}
|
||||
BUNDLE_CONTENTS=$BUNDLE_OUTPUT/Contents
|
||||
BUNDLE_BIN=$BUNDLE_CONTENTS/MacOS
|
||||
@ -66,21 +97,6 @@ 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
|
||||
@ -95,17 +111,16 @@ 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
|
||||
# Run test to confirm all is OK
|
||||
pushd ../../binaries/system
|
||||
echo "\nRunning tests\n"
|
||||
./test || die "Post-build testing failed!"
|
||||
popd
|
||||
|
||||
# Create bundle structure
|
||||
echo "\nCreating bundle directories\n"
|
||||
@ -116,13 +131,8 @@ 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
|
||||
pushd ../data/mods
|
||||
pushd ../../binaries/data/mods
|
||||
archives=""
|
||||
for modname in [a-zA-Z0-9]*
|
||||
do
|
||||
@ -130,6 +140,8 @@ do
|
||||
done
|
||||
popd
|
||||
|
||||
pushd ../../binaries/system
|
||||
|
||||
for modname in $archives
|
||||
do
|
||||
echo "\nBuilding archive for '${modname}'\n"
|
||||
@ -141,30 +153,35 @@ do
|
||||
|
||||
(./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}
|
||||
cp 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}
|
||||
# TODO: Would be nicer if we could set this path in premake
|
||||
cp -v libAtlasUI.dylib ${BUNDLE_FRAMEWORKS}
|
||||
cp -v libCollada.dylib ${BUNDLE_FRAMEWORKS}
|
||||
|
||||
popd
|
||||
|
||||
# Copy data
|
||||
echo "\nCopying non-archived game data\n"
|
||||
# Removing it now and restoring it later, cp has no exclusion switch
|
||||
# and using find is a bit over-the-top
|
||||
rm ../../binaries/data/config/dev.cfg
|
||||
pushd ../../binaries/data
|
||||
if [ "$build_release" = "false"]; then
|
||||
mv config/dev.cfg config/dev.bak
|
||||
fi
|
||||
cp -R -v config ${BUNDLE_RESOURCES}/data/
|
||||
cp -R -v tools ${BUNDLE_RESOURCES}/data/
|
||||
if [ "$build_release" = "false"]; then
|
||||
mv config/dev.bak config/dev.cfg
|
||||
fi
|
||||
popd
|
||||
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/
|
||||
svn revert ../../binaries/data/config/dev.cfg
|
||||
|
||||
# Copy license/readmes
|
||||
# TODO: Also want copies in the DMG - decide on layout
|
||||
@ -187,9 +204,9 @@ 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}
|
||||
PlistBuddy -c "Add :NSHumanReadableCopyright string Copyright © 2014 Wildfire Games" ${INFO_PLIST}
|
||||
|
||||
# TODO: Automatically create compressed DMG with hditutil?
|
||||
# TODO: Automatically create compressed DMG with hdiutil?
|
||||
# (this is a bit complicated so I do it manually for now)
|
||||
# (also we need to have good icon placement, background image, etc)
|
||||
|
||||
|
@ -63,9 +63,10 @@ ENET_VERSION="enet-1.3.12"
|
||||
# Choices are "x86_64" or "i386" (ppc and ppc64 not supported)
|
||||
ARCH=${ARCH:="x86_64"}
|
||||
|
||||
# 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
|
||||
# Define compiler as "clang", this is all Mavericks supports.
|
||||
# gcc symlinks may still exist, but they are simply clang with
|
||||
# slightly different config, which confuses build scripts.
|
||||
# llvm-gcc and gcc 4.2 are no longer supported by SpiderMonkey.
|
||||
export CC=${CC:="clang"} CXX=${CXX:="clang++"}
|
||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.9"}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user