diff --git a/extras/buildbot-os2.sh b/extras/buildbot-os2.sh new file mode 100755 index 0000000..7a96824 --- /dev/null +++ b/extras/buildbot-os2.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# This is used by the buildbot to cross-compile for OS/2 from Linux, using +# OpenWatcom. In an ideal world, we wouldn't need this, but we need a few +# things to do this "properly" ... +# +# - OS/2 running as a VMware guest on the build machine +# - Buildbot-worker running on that OS/2 guest +# - CMake for OS/2 that... +# - ... has Open Watcom compiler support and... +# - ... a Watcom WMake project generator. +# +# Some of these things are doable (there is a CMake port for OS/2, you can +# use GCC with it), but since OpenWatcom will just target OS/2 on Linux just +# like it could on OS/2, it's easier and more efficient to just have a +# buildbot script compile it here. +# +# Note that we just blast all the C files through the wcc386 compiler and +# skip CMake entirely. We should fix this at some point. + +set -e + +export WATCOM="/usr/local/share/watcom" +export PATH="$PATH:$WATCOM/binl" + +CFLAGS="-i=\"$WATCOM/h;$WATCOM/h/os2;../src\" -wx -zq -bt=os2 -fo=.obj -mf" +WLIBFLAGS="-b -c -n -q -p=512" + +cd `dirname "$0"` +cd .. +mkdir -p buildbot +cd buildbot + +rm -f test_physfs.obj + +OKAY="1" +for src in ../src/*.c ; do + echo wcc386 $src $CFLAGS + wcc386 $src $CFLAGS || OKAY="0" +done + +if [ "$OKAY" == "1" ]; then + echo wlib $WLIBFLAGS physfs.lib *.obj + wlib $WLIBFLAGS physfs.lib *.obj || OKAY="0" +fi + +echo wcc386 ../test/test_physfs.c $CFLAGS +wcc386 ../test/test_physfs.c $CFLAGS || OKAY="0" + +if [ "$OKAY" == "1" ]; then + LDFLAGS="name test_physfs d all sys os2v2 op m libr physfs op q op symf FIL test_physfs.obj" + echo wlink $LDFLAGS + wlink $LDFLAGS || OKAY="0" +fi + +if [ "$OKAY" == "1" ]; then + F=`file ../buildbot/test_physfs.exe` + echo "$F" + if [ "$F" != '../buildbot/test_physfs.exe: MS-DOS executable, LX for OS/2 (console) i80386' ]; then + echo 1>&2 "ERROR: final binary doesn't appear to be OS/2 executable." + OKAY=0 + fi +fi + +if [ "$OKAY" == "1" ]; then + echo 1>&2 "Build succeeded." +else + echo 1>&2 "Build failed." +fi +