mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +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
|
if [ `uname -s` != Darwin ]; then
|
||||||
echo This script is for OSX only.
|
echo This script is for OS X only.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
onlyzip=0
|
# Detect and account for OS X version:
|
||||||
|
darwinversion=`uname -r | cut -d . -f 1`
|
||||||
|
|
||||||
if [ $1 ]; then
|
if [ `expr $darwinversion \< 8` == 1 ]; then
|
||||||
if [ $1 == onlyzip ]; then
|
echo OS X 10.4 is the minimum requirement for building.
|
||||||
onlyzip=1
|
exit 1
|
||||||
else
|
fi
|
||||||
echo usage: osxbuild [onlyzip]
|
if [ `expr $darwinversion \< 9` == 1 ]; then
|
||||||
exit 1
|
build64=0
|
||||||
fi
|
fi
|
||||||
|
if [ `expr $darwinversion \> 10` == 1 ]; then
|
||||||
|
buildppc=0
|
||||||
fi
|
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 }'`
|
rev=`svn info | grep Revision | awk '{ print $2 }'`
|
||||||
vc=svn
|
vc=svn
|
||||||
if [ -z "$rev" ]; then
|
if [ -z "$rev" ]; then
|
||||||
|
@ -33,67 +73,81 @@ else
|
||||||
vc=none
|
vc=none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The build process itself:
|
||||||
if [ $onlyzip -eq 0 ]; then
|
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
|
if [ $build64 == 1 ]; then
|
||||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
if [ $builddebug == 1 ]; then
|
||||||
# if [ $? ]; then
|
make veryclean
|
||||||
# echo 64-bit debug build succeeded.
|
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
||||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x64
|
if [ $? ]; then
|
||||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x64
|
echo x86_64 debug build succeeded.
|
||||||
# else
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x64
|
||||||
# echo 64-bit debug build failed.
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x64
|
||||||
# fi
|
else
|
||||||
|
echo x86_64 debug build failed.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
make veryclean
|
make veryclean
|
||||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -j 3
|
||||||
if [ $? ]; then
|
if [ $? ]; then
|
||||||
echo 64-bit release build succeeded.
|
echo x86_64 release build succeeded.
|
||||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x64
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x64
|
||||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x64
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x64
|
||||||
else
|
else
|
||||||
echo 64-bit release build failed.
|
echo x86_64 release build failed.
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make veryclean
|
if [ $build86 == 1 ]; then
|
||||||
# WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 make -j 3
|
if [ $builddebug == 1 ]; then
|
||||||
# if [ $? ]; then
|
make veryclean
|
||||||
# echo 32-bit debug build succeeded.
|
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
||||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x86
|
if [ $? ]; then
|
||||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x86
|
echo x86 debug build succeeded.
|
||||||
# else
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.x86
|
||||||
# echo 32-bit debug build failed.
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.x86
|
||||||
# fi
|
else
|
||||||
|
echo x86 debug build failed.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
make veryclean
|
make veryclean
|
||||||
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -j 3
|
||||||
if [ $? ]; then
|
if [ $? ]; then
|
||||||
echo 32-bit release build succeeded.
|
echo x86 release build succeeded.
|
||||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x86
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.x86
|
||||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x86
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.x86
|
||||||
else
|
else
|
||||||
echo 32-bit release build failed.
|
echo x86 release build failed.
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make veryclean
|
if [ $buildppc == 1 ]; then
|
||||||
# ARCH='-arch ppc' WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 make -j 3
|
if [ $builddebug == 1 ]; then
|
||||||
# if [ $? ]; then
|
make veryclean
|
||||||
# echo PowerPC debug build succeeded.
|
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
||||||
# cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.ppc
|
if [ $? ]; then
|
||||||
# cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.ppc
|
echo PowerPC debug build succeeded.
|
||||||
# else
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.debug.ppc
|
||||||
# echo PowerPC debug build failed.
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.debug.ppc
|
||||||
# fi
|
else
|
||||||
|
echo PowerPC debug build failed.
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
make veryclean
|
make veryclean
|
||||||
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
ARCH='-arch ppc' OSX_STARTUPWINDOW=1 WITHOUT_GTK=1 RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -j 3
|
||||||
if [ $? ]; then
|
if [ $? ]; then
|
||||||
echo PowerPC release build succeeded.
|
echo PowerPC release build succeeded.
|
||||||
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.ppc
|
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.ppc
|
||||||
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.ppc
|
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.ppc
|
||||||
else
|
else
|
||||||
echo PowerPC release build failed.
|
echo PowerPC release build failed.
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -105,36 +159,49 @@ elif [ "$vc" == "git" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Duplicating .app bundles for debug build:
|
# Duplicating .app bundles for debug build:
|
||||||
# if [ -d "Mapster32.app" ]; then
|
if [ $builddebug == 1 ]; then
|
||||||
# cp -RP "Mapster32.app" "Mapster32.debug.app"
|
for i in Mapster32 EDuke32; do
|
||||||
# fi
|
if [ -d "$i.app" ]; then
|
||||||
# if [ -d "EDuke32.app" ]; then
|
cp -RP "$i.app" "$i.debug.app"
|
||||||
# cp -RP "EDuke32.app" "EDuke32.debug.app"
|
fi
|
||||||
# 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...
|
# Almost done...
|
||||||
if [ -f mapster32.x64 ] && [ -f eduke32.x86 ] && [ -f eduke32.ppc ]; then
|
if [ $success == 1 ]; then
|
||||||
echo Creating fat binaries.
|
|
||||||
|
|
||||||
lipo -create mapster32.x64 mapster32.x86 mapster32.ppc -output mapster32
|
# Output README.OSX:
|
||||||
cp -f mapster32 "Mapster32.app/Contents/MacOS/mapster32"
|
let "darwinversion -= 4"
|
||||||
|
|
||||||
# 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"
|
|
||||||
echo "This archive was produced from revision $rev by the osxbuild.sh script." > README.OSX
|
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 "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 "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
|
echo "from MacPorts (http://www.macports.org/) statically linked into it." >> README.OSX
|
||||||
|
|
||||||
|
arfilename="eduke32-osx-$rev.zip"
|
||||||
rm -f "$arfilename"
|
rm -f "$arfilename"
|
||||||
zip -r -y "$arfilename" Mapster32.app EDuke32.app README.OSX -x "*.svn*" "*.git*"
|
zip -r -y "$arfilename" $arcontents -x "*.svn*" "*.git*"
|
||||||
# Mapster32.debug.app EDuke32.debug.app
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue