Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #!/bin/bash
  2.  
  3. # This is used by the buildbot to cross-compile for OS/2 from Linux, using
  4. #  OpenWatcom. In an ideal world, we wouldn't need this, but we need a few
  5. #  things to do this "properly" ...
  6. #
  7. #  - OS/2 running as a VMware guest on the build machine
  8. #  - Buildbot-worker running on that OS/2 guest
  9. #  - CMake for OS/2 that...
  10. #  -  ... has Open Watcom compiler support and...
  11. #  -  ... a Watcom WMake project generator.
  12. #
  13. # Some of these things are doable (there is a CMake port for OS/2, you can
  14. #  use GCC with it), but since OpenWatcom will just target OS/2 on Linux just
  15. #  like it could on OS/2, it's easier and more efficient to just have a
  16. #  buildbot script compile it here.
  17. #
  18. # Note that we just blast all the C files through the wcc386 compiler and
  19. #  skip CMake entirely. We should fix this at some point.
  20.  
  21. set -e
  22.  
  23. ZIPFILE="$1"
  24. if [ -z $ZIPFILE ]; then
  25.     ZIPFILE=physfs-os2.zip
  26. fi
  27.  
  28. export WATCOM="/usr/local/share/watcom"
  29. export PATH="$PATH:$WATCOM/binl"
  30.  
  31. CFLAGS="-i=\"$WATCOM/h;$WATCOM/h/os2;../src\" -wx -d0 -otexan -6r -zq -bt=os2 -fo=.obj -mf"
  32. WLIBFLAGS="-b -c -n -q -p=512"
  33.  
  34. cd `dirname "$0"`
  35. cd ..
  36. mkdir -p buildbot
  37. cd buildbot
  38.  
  39. rm -f test_physfs.obj
  40.  
  41. OKAY="1"
  42. for src in ../src/*.c ; do
  43.     echo wcc386 $src $CFLAGS
  44.     wcc386 $src $CFLAGS || OKAY="0"
  45. done
  46.  
  47. if [ "$OKAY" == "1" ]; then
  48.     echo wlib $WLIBFLAGS physfs.lib *.obj
  49.     wlib $WLIBFLAGS physfs.lib *.obj || OKAY="0"
  50. fi
  51.  
  52. echo wcc386 ../test/test_physfs.c $CFLAGS
  53. wcc386 ../test/test_physfs.c $CFLAGS || OKAY="0"
  54.  
  55. if [ "$OKAY" == "1" ]; then
  56.     LDFLAGS="name test_physfs d all sys os2v2 op m libr physfs op q op symf FIL test_physfs.obj"
  57.     echo wlink $LDFLAGS
  58.     wlink $LDFLAGS || OKAY="0"
  59. fi
  60.  
  61. if [ "$OKAY" == "1" ]; then
  62.     F=`file test_physfs.exe`
  63.     echo "$F"
  64.     if [ "$F" != 'test_physfs.exe: MS-DOS executable, LX for OS/2 (console) i80386' ]; then
  65.         echo 1>&2 "ERROR: final binary doesn't appear to be OS/2 executable."
  66.         OKAY=0
  67.     fi
  68. fi
  69.  
  70. if [ "$OKAY" == "1" ]; then
  71.     echo 1>&2 "Build succeeded."
  72.     set -e
  73.     rm -rf "$ZIPFILE" physfs-os2
  74.     mkdir -p physfs-os2
  75.     echo "Zipping to '$ZIPFILE' ..."
  76.     cp ../src/physfs.h physfs.lib physfs-os2
  77.     chmod -R a+r physfs-os2
  78.     chmod a+x physfs-os2
  79.     chmod -R go-w physfs-os2
  80.     zip -9r "$ZIPFILE" physfs-os2
  81.     echo "Done."
  82.     exit 0
  83. else
  84.     echo 1>&2 "Build failed."
  85.     exit 1
  86. fi
  87.  
  88.