-
Notifications
You must be signed in to change notification settings - Fork 2
245 lines (207 loc) · 7.94 KB
/
LuaWatcom.yml
File metadata and controls
245 lines (207 loc) · 7.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Lua for Watcom
on: push
jobs:
Watcom:
name: Build Lua with Open Watcom
runs-on: ubuntu-latest
steps:
- name: Install Open Watcom 1.9
uses: open-watcom/setup-watcom@v0
with:
version: "1.9"
- name: Install Other Tools
run: |
sudo apt-get update
sudo apt-get install -y gcc libfaketime libreadline-dev lua5.4 make mtools zip
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Test libfaketime works
run: |
export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd")
export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1)
DATE=$(date +"%Y-%m-%d %H:%M:%S")
echo "Date: $DATE"
echo "Faketime: $FAKETIME"
echo "ld-preload: $LD_PRELOAD"
if [ "$FAKETIME" != "$DATE" ]; then
exit 1
fi
- name: Patch Lua Source Code for Open Watcom
run: |
lua scripts/dev/PATCH.LUA lua.pat luac.pat
- name: Check GCC can build Lua after patches
run: |
cd lua
make -j`nproc`
cd ..
- name: Build Lua for DOS 16-bit
env:
INCLUDE: "${{ env.WATCOM }}/h"
run: |
wmake -f wm_dos16.mak lua luac
- name: Build Lua for DOS4GW 32-bit Extender
env:
INCLUDE: "${{ env.WATCOM }}/h"
run: |
wmake -f wm_dos4g.mak lua luac
- name: Build Lua for Linux
env:
INCLUDE: "${{ env.WATCOM }}/lh"
run: |
wmake -f wm_linux.mak lua luac
- name: Build Lua for OS/2 16-bit
env:
INCLUDE: "${{ env.WATCOM }}/h/os2:${{ env.WATCOM }}/h"
run: |
wmake -f wm_os216.mak lua luac
- name: Build Lua for OS/2 32-bit
env:
INCLUDE: "${{ env.WATCOM }}/h/os2:${{ env.WATCOM }}/h"
run: |
wmake -f wm_os232.mak lua luac
- name: Build Lua for Windows 95
env:
INCLUDE: "${{ env.WATCOM }}/h/nt:${{ env.WATCOM }}/h"
run: |
wmake -f wm_winnt.mak lua luac
- name: Copy DOS4GW Binary
run: |
cp $WATCOM/binw/dos4gw.exe dist/bin/DOS4GW.EXE
- name: Ensure Lua Scripts Have CR/LF Line Endings
run: |
lua scripts/util/DOSFREN.LUA scripts/meta/floppy/1440k/*/*.LUA
- name: Set constant time information on PE header
run: |
lua scripts/dev/PE95TIME.LUA dist/bin/LUANT.EXE
- name: Set modification time on scripts to their respective commit
run: |
cd scripts
git ls-files -z | xargs -0 -I{} bash -c 'touch --date="$(git log -1 --pretty=format:%cI -- "$0")" "$0"' {}
cd ..
- name: Remove UNIX executable permission from non-UNIX executable files
run: |
chmod -x dist/bin/*.EXE
- name: Set modification time on built binaries to the latest commit
run: |
touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.ELF dist/bin/*.EXE
- name: Create Binaries Zip
run: |
files=$(find dist/bin/*.EXE scripts/meta/floppy/1440k/*/*.LUA ! -executable | sort | xargs)
zip -j9 --DOS-names dist/LuaExe.zip $files
exe=$(find dist/bin/*.ELF scripts/meta/floppy/1440k/*/*.LUA -executable | sort | xargs)
zip -j9 -X dist/LuaExe.zip $exe
name="dist/WLE$(sha256sum dist/LuaExe.zip | awk '{print $1}' | cut -c1-5).zip"
mv dist/LuaExe.zip $name
touch --date="$(git log -1 --pretty=format:%cI)" $name
- name: UPX Binary Compression
uses: crazy-max/ghaction-upx@v3
with:
version: latest
args: -9 --8086
files: |
dist/bin/LUA16.EXE
dist/bin/LUA4G.EXE
dist/bin/LUANT.EXE
- name: Squish Lua Scripts for Floppy Disk Images
run: |
find scripts -name "*.LUA" -type f -exec scripts/util/SQUISH.LUA {} +
find scripts -name "*.LUA" -type f -exec scripts/util/DOSFREN.LUA {} +
- name: Set modification time on UPX compressed binaries to the latest commit
run: |
touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.ELF dist/bin/*.EXE
- name: Set modification time on squished scripts to their respective commit
run: |
cd scripts
git ls-files -z | xargs -0 -I{} bash -c 'touch --date="$(git log -1 --pretty=format:%cI -- "$0")" "$0"' {}
cd ..
- name: Create 160k 16-bit DOS Floppy Diskette Image
run: |
export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd")
export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1)
label="LUA DOS"
serial="0x$(echo "$label$FAKETIME" | sha256sum | cut -c1-8)"
files=$(find dist/bin/LUA16.EXE scripts/meta/floppy/160k/1/*.LUA | sort | xargs)
echo "Faketime: $FAKETIME"
echo "Files: $files"
echo "Label: $label"
echo "Serial: $serial"
mformat -C -i dist/Lua160k.ima -v "$label" -f 160 -N $serial
mcopy -mi dist/Lua160k.ima $files ::
- name: Create 1.4M Multi-Platform Floppy Diskette Image
run: |
export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd")
export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1)
label="LUA MULTIOS"
serial="0x$(echo "$label$FAKETIME" | sha256sum | cut -c1-8)"
files=$(find dist/bin/LUAUX.ELF dist/bin/LUA16.EXE dist/bin/LUA4G.EXE dist/bin/LUANT.EXE dist/bin/DOS4GW.EXE scripts/meta/floppy/1440k/1/*.LUA | sort | xargs)
echo "Faketime: $FAKETIME"
echo "Files: $files"
echo "Label: $label"
echo "Serial: $serial"
mformat -C -i dist/LuaMulti.ima -v "$label" -f 1440 -N $serial
mcopy -mi dist/LuaMulti.ima $files ::
- name: Zero-out Unallocated Clusters
run: |
lua scripts/util/FATSTAT.LUA -z dist/*ima
- name: Create Floppy Disk Images Zip
run: |
files=$(find dist/*ima | sort | xargs)
touch --date="$(git log -1 --pretty=format:%cI)" $files
zip -j9 --DOS-names dist/LuaIma.zip $files
name="dist/WLI$(sha256sum dist/LuaIma.zip | awk '{print $1}' | cut -c1-5).zip"
mv dist/LuaIma.zip $name
touch --date="$(git log -1 --pretty=format:%cI)" $name
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: 'LuaDist'
path: |
dist/WLE*.zip
dist/WLI*.zip
compression-level: 0
Draft:
name: Draft Release
needs: Watcom
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/202')
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Generate Release Notes
run: |
input_date="$TAG_NAME"
day=$(date -d "$input_date" '+%-d')
month=$(date -d "$input_date" '+%B')
year=$(date -d "$input_date" '+%Y')
if [[ $day -eq 11 || $day -eq 12 || $day -eq 13 ]]; then
suffix="th"
else
case $((day % 10)) in
1) suffix="st" ;;
2) suffix="nd" ;;
3) suffix="rd" ;;
*) suffix="th" ;;
esac
fi
formatted_date="${day}${suffix} of ${month} ${year}"
sed -i "s/{{DATE}}/${formatted_date}/g" .github/workflows/notes.md
name="$(ls LuaDist/WLE*.zip | xargs -n 1 basename)"
sed -i "s/{{WLE}}/${name}/g" .github/workflows/notes.md
name="$(ls LuaDist/WLI*.zip | xargs -n 1 basename)"
sed -i "s/{{WLI}}/${name}/g" .github/workflows/notes.md
- name: Create Draft Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}" # Extract the tag name
gh release create "$TAG_NAME" \
--draft \
--title "$TAG_NAME" \
--notes-file .github/workflows/notes.md \
"LuaDist/*.zip"