osxbuild.sh: factor out building commands and exit 1 on failure

git-svn-id: https://svn.eduke32.com/eduke32@2851 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-07-29 23:35:09 +00:00
parent 109457994e
commit b1f98d241e

View file

@ -138,6 +138,34 @@ else
vc=none vc=none
fi fi
function dobuildtools ()
{
make veryclean
local cmdline="$2"
eval $cmdline
if [ $? ]; then
echo buildtools: "$1" build succeeded.
else
echo buildtools: "$1" build failed.
exit 1
fi
}
function dobuildem() # build EDuke32 and Mapster32
{
make veryclean
local cmdline="$2"
eval $cmdline
if [ $? ]; then
echo $1 build succeeded.
cp "Mapster32.app/Contents/MacOS/mapster32" mapster32.$1
cp "EDuke32.app/Contents/MacOS/eduke32" eduke32.$1
else
echo $1 build failed.
exit 1
fi
}
# A little factoring: # A little factoring:
commonargs="OSX_STARTUPWINDOW=1 WITHOUT_GTK=1" commonargs="OSX_STARTUPWINDOW=1 WITHOUT_GTK=1"
if [ $buildppc == 1 ]; then if [ $buildppc == 1 ]; then
@ -154,68 +182,32 @@ if [ $buildtools == 1 ] && [ -d "build" ]; then
if [ $build64 == 1 ]; then if [ $build64 == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildtools "x86_64 debug" \
cmdline="ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.debug.x64 $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make -k utils" "ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.debug.x64 $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: x86_64 debug build succeeded.
else
echo buildtools: x86_64 debug build failed.
fi
fi fi
make veryclean dobuildtools "x86_64 release" \
cmdline="ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.x64 $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -k utils" "ARCH='-arch x86_64' EXESUFFIX_OVERRIDE=.x64 $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: x86_64 release build succeeded.
else
echo buildtools: x86_64 release build failed.
fi
fi fi
if [ $build86 == 1 ]; then if [ $build86 == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildtools "x86 debug" \
cmdline="EXESUFFIX_OVERRIDE=.debug.x86 $commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make -k utils" "EXESUFFIX_OVERRIDE=.debug.x86 $commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: x86 debug build succeeded.
else
echo buildtools: x86 debug build failed.
fi
fi fi
make veryclean dobuildtools "x86 release" \
cmdline="EXESUFFIX_OVERRIDE=.x86 $commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -k utils" "EXESUFFIX_OVERRIDE=.x86 $commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: x86 release build succeeded.
else
echo buildtools: x86 release build failed.
fi
fi fi
if [ $buildppc == 1 ]; then if [ $buildppc == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildtools "PowerPC debug" \
cmdline="ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.debug.ppc $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make -k utils" "ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.debug.ppc $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: PowerPC debug build succeeded.
else
echo buildtools: PowerPC debug build failed.
fi
fi fi
make veryclean dobuildtools "PowerPC release" \
cmdline="ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.ppc $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -k utils" "ARCH='-arch ppc' EXESUFFIX_OVERRIDE=.ppc $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make -k utils"
eval $cmdline
if [ $? ]; then
echo buildtools: PowerPC release build succeeded.
else
echo buildtools: PowerPC release build failed.
fi
fi fi
echo buildtools: Creating fat binaries. echo buildtools: Creating fat binaries.
@ -260,80 +252,26 @@ if [ $buildmain == 1 ]; then
if [ $build64 == 1 ]; then if [ $build64 == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildem debug.x64 "ARCH='-arch x86_64' $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make"
cmdline="ARCH='-arch x86_64' $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=1 make"
eval $cmdline
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 fi
make veryclean dobuildem x64 "ARCH='-arch x86_64' $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make"
cmdline="ARCH='-arch x86_64' $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=1 make"
eval $cmdline
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 fi
if [ $build86 == 1 ]; then if [ $build86 == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildem debug.x86 "$commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make"
cmdline="$commonargs RELEASE=0 BUILD32_ON_64=1 USE_LIBVPX=0 make"
eval $cmdline
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 fi
make veryclean dobuildem x86 "$commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make"
cmdline="$commonargs RELEASE=1 BUILD32_ON_64=1 USE_LIBVPX=0 make"
eval $cmdline
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 fi
if [ $buildppc == 1 ]; then if [ $buildppc == 1 ]; then
if [ $builddebug == 1 ]; then if [ $builddebug == 1 ]; then
make veryclean dobuildem debug.ppc "ARCH='-arch ppc' $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make"
cmdline="ARCH='-arch ppc' $commonargs RELEASE=0 BUILD32_ON_64=0 USE_LIBVPX=0 make"
eval $cmdline
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 fi
make veryclean dobuildem ppc "ARCH='-arch ppc' $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make"
cmdline="ARCH='-arch ppc' $commonargs RELEASE=1 BUILD32_ON_64=0 USE_LIBVPX=0 make"
eval $cmdline
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
fi fi