|
| 1 | +name: Lua for Watcom |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + DOS: |
| 7 | + name: Lua for DOS |
| 8 | + runs-on: ubuntu-latest |
| 9 | + env: |
| 10 | + LUA_VERSION: 5.4.6 |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: open-watcom/setup-watcom@v0 |
| 14 | + with: |
| 15 | + version: "1.9" |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Download Lua Sources |
| 19 | + run: | |
| 20 | + wget https://lua.org/ftp/lua-$LUA_VERSION.tar.gz |
| 21 | +
|
| 22 | + - name: Verify Lua Sources |
| 23 | + env: |
| 24 | + HASH: 25a429319dff20dfbfb9956c2b5be911 |
| 25 | + |
| 26 | + run: | |
| 27 | + echo "$HASH lua-$LUA_VERSION.tar.gz" > hash |
| 28 | + md5sum -c hash |
| 29 | + rm hash |
| 30 | +
|
| 31 | + - name: Extract Lua Sources |
| 32 | + run: | |
| 33 | + tar -xzf lua-$LUA_VERSION.tar.gz |
| 34 | + mv lua-$LUA_VERSION/src/* . |
| 35 | + rm -R lua-$LUA_VERSION* |
| 36 | +
|
| 37 | + - name: Prepare Lua Sources for Watcom |
| 38 | + run: | |
| 39 | + patch luaconf.h luaconf.pat |
| 40 | + patch lopcodes.h lopcodes.pat |
| 41 | + patch lutf8lib.c lutf8lib.pat |
| 42 | +
|
| 43 | + - name: Build Lua for DOS 16-bit |
| 44 | + run: | |
| 45 | + export INCLUDE=$WATCOM/h |
| 46 | + wmake -f watcom_l.mak |
| 47 | + wmake -f watcom_l.mak clean |
| 48 | +
|
| 49 | + - name: Build Lua for DOS4GW |
| 50 | + run: | |
| 51 | + export INCLUDE=$WATCOM/h |
| 52 | + wmake -f watcom_f.mak |
| 53 | + wmake -f watcom_f.mak clean |
| 54 | +
|
| 55 | + - name: UPX Binary Compression |
| 56 | + uses: crazy-max/ghaction-upx@v3 |
| 57 | + with: |
| 58 | + version: latest |
| 59 | + args: -9 --8086 |
| 60 | + files: | |
| 61 | + dist/bin/*.exe |
| 62 | +
|
| 63 | + - name: Copy DOS4GW Binary |
| 64 | + run: | |
| 65 | + cp $WATCOM/binw/dos4gw.exe dist/bin/ |
| 66 | +
|
| 67 | + - name: Install Post Build Tools (Dos2unix, GNU Mtools, Zip) |
| 68 | + run: | |
| 69 | + sudo apt-get update |
| 70 | + sudo apt-get install -y dos2unix mtools zip |
| 71 | +
|
| 72 | + - name: Create Example Lua Script for Diskette Images |
| 73 | + run: | |
| 74 | + echo "-- This is a single line comment" > example.lua |
| 75 | + echo "-- Run this script with 'LUA16.EXE EXAMPLE.LUA'" >> example.lua |
| 76 | + echo "" >> example.lua |
| 77 | + echo "-- Get hour of the day, convert it from string to number" >> example.lua |
| 78 | + echo "hour = tonumber(os.date('%H'))" >> example.lua |
| 79 | + echo "" >> example.lua |
| 80 | + echo "-- Set the string 'timeOfDay' depending on the hour" >> example.lua |
| 81 | + echo "if hour < 4 or hour > 20 then timeOfDay = 'night'" >> example.lua |
| 82 | + echo "elseif hour < 9 then timeOfDay = 'morning'" >> example.lua |
| 83 | + echo "elseif hour > 16 then timeOfDay = 'evening'" >> example.lua |
| 84 | + echo "else timeOfDay = 'day'" >> example.lua |
| 85 | + echo "end" >> example.lua |
| 86 | + echo "" >> example.lua |
| 87 | + echo "-- Concatinate and print timeOfDay to screen as part of a greeting" >> example.lua |
| 88 | + echo "print('Good ' .. timeOfDay .. ' DOS! From Lua.')" >> example.lua |
| 89 | + echo "" >> example.lua |
| 90 | + echo "os.exit() -- Exit script. Will also exit a interactive shell" >> example.lua |
| 91 | + echo "" >> example.lua |
| 92 | + echo "--[[ This is a multi-line comment" >> example.lua |
| 93 | + echo " For full Lua language documentation" >> example.lua |
| 94 | + echo " visit https://www.lua.org/docs.html" >> example.lua |
| 95 | + echo "--]]" >> example.lua |
| 96 | + unix2dos example.lua |
| 97 | +
|
| 98 | + - name: Create 160k Floppy Diskette Image |
| 99 | + run: | |
| 100 | + mformat -C -i dist/Lua5DD8.ima -v LUA -f 160 |
| 101 | + mcopy -i dist/Lua5DD8.ima dist/bin/lua16.exe example.lua :: |
| 102 | +
|
| 103 | + - name: Create 1.4M Floppy Diskette Image |
| 104 | + run: | |
| 105 | + mformat -C -i dist/Lua3HD18.ima -v LUA -f 1440 |
| 106 | + mcopy -i dist/Lua3HD18.ima dist/bin/*.exe example.lua :: |
| 107 | +
|
| 108 | + - name: Zip Binaries |
| 109 | + run: | |
| 110 | + zip -j9 "dist/Lua DOS Bin.zip" dist/bin/*.exe |
| 111 | +
|
| 112 | + - name: Zip Disk Images |
| 113 | + run: | |
| 114 | + zip -j9 "dist/Lua DOS Ima.zip" dist/*.ima |
| 115 | +
|
| 116 | + - name: Upload Artifacts |
| 117 | + uses: actions/upload-artifact@v4 |
| 118 | + with: |
| 119 | + name: 'Lua Binaries' |
| 120 | + path: dist/*.zip |
| 121 | + compression-level: 0 |
0 commit comments