buildbot-os2.sh 2.2 KB

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