mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
Thoroughly revised osxbuild.sh, featuring:
- Conditional disabling of the build for each architecture - Conditional enabling of debug building - Detection of the OS X version, disabling incompatible builds and establishing a minimum version - Fail-safe assembly of fat binaries and the archive (each item is checked first) - Lovely factored 'for' loops and parameter expansion git-svn-id: https://svn.eduke32.com/eduke32@2437 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
27e68e85e5
commit
fd62042489
1 changed files with 154 additions and 87 deletions
|
@ -1,23 +1,63 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# build debug/release x86/x64/ppc versions of mapster32 and eduke32 on OSX
|
||||
# build debug/release x86/x86_64/ppc versions of mapster32 and eduke32 on OS X
|
||||
|
||||
# Variable presets:
|
||||
buildppc=1
|
||||
build86=1
|
||||
build64=1
|
||||
builddebug=0
|
||||
onlyzip=0
|
||||
|
||||
# Enforce OS:
|
||||
if [ `uname -s` != Darwin ]; then
|
||||
echo This script is for OSX only.
|
||||
echo This script is for OS X only.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
onlyzip=0
|
||||
# Detect and account for OS X version:
|
||||
darwinversion=`uname -r | cut -d . -f 1`
|
||||
|
||||
if [ $1 ]; then
|
||||
if [ $1 == onlyzip ]; then
|
||||
onlyzip=1
|
||||
else
|
||||
echo usage: osxbuild [onlyzip]
|
||||
exit 1
|
||||
fi
|
||||
if [ `expr $darwinversion \< 8` == 1 ]; then
|
||||
echo OS X 10.4 is the minimum requirement for building.
|
||||
exit 1
|
||||
fi
|
||||
if [ `expr $darwinversion \< 9` == 1 ]; then
|
||||
build64=0
|
||||
fi
|
||||
if [ `expr $darwinversion \> 10` == 1 ]; then
|
||||
buildppc=0
|
||||
fi
|
||||
|
||||
# Parse arguments:
|
||||
for i in $*; do
|
||||
case $i in
|
||||
onlyzip)
|
||||
onlyzip=1
|
||||
;;
|
||||
|
||||
noppc)
|
||||
buildppc=0
|
||||
;;
|
||||
no86)
|
||||
build86=0
|
||||
;;
|
||||
no64)
|
||||
build64=0
|
||||
;;
|
||||
|
||||
--debug=*)
|
||||
builddebug=${i#*=}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo usage: osxbuild [onlyzip] [noppc] [no86] [no64] [--debug=\<0|1\>]
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Detect versioning systems and pull the revision number:
|
||||
rev=`svn info | grep Revision | awk '{ print $2 }'`
|
||||
vc=svn
|
||||
if [ -z "$rev" ]; then
|
||||
|
@ -33,67 +73,81 @@ else
|
|||
vc=none
|
||||
fi
|
||||
|
||||
# The build process itself:
|
||||
if [ $onlyzip -eq 0 ]; then
|
||||
rm -f eduke32.x86 eduke32.x64 mapster32.x86 mapster32.x64
|
||||
rm -f {eduke32,mapster32}{.debug,}{.x86,.x64,.ppc,}
|
||||
rm -rf {EDuke32,Mapster32}{.debug,}.app
|
||||
|
||||
# make veryclean
|
||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo 64-bit debug build succeeded.
|
||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x64
|
||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x64
|
||||
# else
|
||||
# echo 64-bit debug build failed.
|
||||
# fi
|
||||
if [ $build64 == 1 ]; then
|
||||
if [ $builddebug == 1 ]; then
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
||||
if [ $? ]; then
|
||||
echo x86_64 debug build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x64
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x64
|
||||
else
|
||||
echo x86_64 debug build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
||||
if [ $? ]; then
|
||||
echo 64-bit release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x64
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x64
|
||||
else
|
||||
echo 64-bit release build failed.
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
||||
if [ $? ]; then
|
||||
echo x86_64 release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x64
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x64
|
||||
else
|
||||
echo x86_64 release build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
# make veryclean
|
||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo 32-bit debug build succeeded.
|
||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x86
|
||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x86
|
||||
# else
|
||||
# echo 32-bit debug build failed.
|
||||
# fi
|
||||
if [ $build86 == 1 ]; then
|
||||
if [ $builddebug == 1 ]; then
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo x86 debug build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x86
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x86
|
||||
else
|
||||
echo x86 debug build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo 32-bit release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x86
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x86
|
||||
else
|
||||
echo 32-bit release build failed.
|
||||
make veryclean
|
||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo x86 release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x86
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x86
|
||||
else
|
||||
echo x86 release build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
# make veryclean
|
||||
# ARCH='-arch ppc' WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
||||
# if [ $? ]; then
|
||||
# echo PowerPC debug build succeeded.
|
||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.ppc
|
||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.ppc
|
||||
# else
|
||||
# echo PowerPC debug build failed.
|
||||
# fi
|
||||
if [ $buildppc == 1 ]; then
|
||||
if [ $builddebug == 1 ]; then
|
||||
make veryclean
|
||||
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo PowerPC debug build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.ppc
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.ppc
|
||||
else
|
||||
echo PowerPC debug build failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
make veryclean
|
||||
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo PowerPC release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.ppc
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.ppc
|
||||
else
|
||||
echo PowerPC release build failed.
|
||||
make veryclean
|
||||
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
||||
if [ $? ]; then
|
||||
echo PowerPC release build succeeded.
|
||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.ppc
|
||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.ppc
|
||||
else
|
||||
echo PowerPC release build failed.
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -105,36 +159,49 @@ elif [ "$vc" == "git" ]; then
|
|||
fi
|
||||
|
||||
# Duplicating .app bundles for debug build:
|
||||
# if [ -d "Mapster32.app" ]; then
|
||||
# cp -RP "Mapster32.app" "Mapster32.debug.app"
|
||||
# fi
|
||||
# if [ -d "EDuke32.app" ]; then
|
||||
# cp -RP "EDuke32.app" "EDuke32.debug.app"
|
||||
# fi
|
||||
if [ $builddebug == 1 ]; then
|
||||
for i in Mapster32 EDuke32; do
|
||||
if [ -d "$i.app" ]; then
|
||||
cp -RP "$i.app" "$i.debug.app"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Begin assembling archive contents:
|
||||
arcontents="README.OSX"
|
||||
|
||||
echo Creating fat binaries.
|
||||
success=0
|
||||
for i in {eduke32,mapster32}{.debug,}; do
|
||||
binaries=
|
||||
for j in ${i}.{x86,x64,ppc}; do
|
||||
if [ -f "$j" ]; then
|
||||
binaries="$binaries $j"
|
||||
success=1
|
||||
fi
|
||||
done
|
||||
if [ -n "$binaries" ]; then
|
||||
lipo -create $binaries -output $i
|
||||
app=${i//eduke32/EDuke32}
|
||||
app=${app//mapster32/Mapster32}.app
|
||||
cp -f $i "$app/Contents/MacOS/${i%.debug}"
|
||||
arcontents="$arcontents $app"
|
||||
fi
|
||||
done
|
||||
|
||||
# Almost done...
|
||||
if [ -f mapster32.x64 ] && [ -f eduke32.x86 ] && [ -f eduke32.ppc ]; then
|
||||
echo Creating fat binaries.
|
||||
if [ $success == 1 ]; then
|
||||
|
||||
lipo -create mapster32.x64 mapster32.x86 mapster32.ppc -output mapster32
|
||||
cp -f mapster32 "Mapster32.app/Contents/MacOS/mapster32"
|
||||
|
||||
# lipo -create mapster32.debug.x64 mapster32.debug.x86 -output mapster32.debug
|
||||
# cp -f mapster32 "Mapster32.debug.app/Contents/MacOS/mapster32"
|
||||
|
||||
lipo -create eduke32.x64 eduke32.x86 mapster32.ppc -output eduke32
|
||||
cp -f eduke32 "EDuke32.app/Contents/MacOS/eduke32"
|
||||
|
||||
# lipo -create eduke32.debug.x64 eduke32.debug.x86 -output eduke32.debug
|
||||
# cp -f eduke32 "EDuke32.debug.app/Contents/MacOS/eduke32"
|
||||
|
||||
arfilename="eduke32-osx-$rev.zip"
|
||||
# Output README.OSX:
|
||||
let "darwinversion -= 4"
|
||||
echo "This archive was produced from revision $rev by the osxbuild.sh script." > README.OSX
|
||||
echo "Built on: Mac OS X 10.$darwinversion" >> README.OSX
|
||||
echo "EDuke32 home: http://www.eduke32.com" >> README.OSX
|
||||
echo "OSX build discussion on Duke4.net: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/" >> README.OSX
|
||||
echo "OS X build discussion on Duke4.net: http://forums.duke4.net/topic/4242-building-eduke-on-mac-os-x/" >> README.OSX
|
||||
echo "The 64-bit build in this archive has LibVPX (http://www.webmproject.org/code/)" >> README.OSX
|
||||
echo "from MacPorts (http://www.macports.org/) statically linked into it." >> README.OSX
|
||||
|
||||
arfilename="eduke32-osx-$rev.zip"
|
||||
rm -f "$arfilename"
|
||||
zip -r -y "$arfilename" Mapster32.app EDuke32.app README.OSX -x "*.svn*" "*.git*"
|
||||
# Mapster32.debug.app EDuke32.debug.app
|
||||
zip -r -y "$arfilename" $arcontents -x "*.svn*" "*.git*"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue