|
1 | 1 | # Lua for Open Watcom |
2 | 2 |
|
3 | | -This repository contains wmake style makefiles an patches to build [Lua](https://lua.org) [5.4.6](https://lua.org/ftp/) on Open Watcom 1.9 or later. The primary goal for these is to allow Lua scripts to be run on DOS systems in real mode. |
| 3 | +This repository contains wmake style makefiles and patches to build [Lua](https://lua.org) on Open Watcom 1.9 or later. |
| 4 | +The primary goal is to allow Lua scripts to be run on DOS systems in real mode. |
4 | 5 |
|
5 | 6 | ## Runtime Requirements |
6 | 7 | To run Lua built by Open Watcom you will need the following: |
7 | 8 |
|
8 | | -| Requirement | Sources/Comment | |
9 | | -|--|--| |
10 | | -| [8088 CPU](https://en.wikipedia.org/wiki/Intel_8088)*<br/> <pre>*or compatibiles<br/>like the 8086, V20,<br/>286, 386 etc<br/><br/>Machine emulators<br/>provided as an option<br/>for other ISAs</pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/)) |
11 | | -| PC-DOS 2.1 or higher | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
12 | | -| At least 320 kilobytes<br/>of total system memory | <pre>Any memory above<br/>640 kilobytes is<br/>inaccessible to all<br/>real mode DOS programs | |
13 | | -| At least 600 kilobytes<br/>of hard disk space or x2<br/>360 kilobyte diskettes | <pre>Can be ran directly<br/>from a diskette on<br/>machines without a<br/>hard drive |
| 9 | +| Requirement | Sources/Comment | |
| 10 | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 11 | +| [8088 CPU](https://en.wikipedia.org/wiki/Intel_8088)*<br/> <pre>*or compatibiles<br/>like the 8086, V20,<br/>286, 386 etc<br/><br/>Machine emulators<br/>provided as an alternative<br/>for other ISAs</pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/)) | |
| 12 | +| PC-DOS 2.1 or higher | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) | |
| 13 | +| At least 320 kilobytes<br/>of total system memory | <pre>Any memory above<br/>640 kilobytes is<br/>inaccessible to all<br/>real mode DOS programs | |
| 14 | +| At least 600 kilobytes<br/>of hard disk space or x2<br/>360 kilobyte diskettes | <pre>Can be ran directly<br/>from a diskette on<br/>machines without a<br/>hard drive | |
14 | 15 |
|
15 | 16 | > If in doubt, install [DOSBox-X](https://dosbox-x.com/) |
16 | 17 |
|
17 | 18 | ## Build Requirements |
18 | 19 | To build Lua with Open Watcom you will need the following: |
19 | 20 |
|
20 | | -| Requirement | Sources | |
21 | | -|--|--| |
22 | | -| Lua 5.4.6 source code | [lua.org](https://lua.org/ftp/) ([GitHub](https://github.com/lua/lua/tree/v5.4.6)) | |
23 | | -| Open Watcom 1.9 (or later) | [openwatcom.org](https://www.openwatcom.org/) ([GitHub](https://github.com/open-watcom))<br/>[FreeDOS Bonus CD](https://www.freedos.org/download/) (`FDIMPLES`)<br/>[SvarDOS](http://svardos.org/?p=repo) (`PKGNET` repository) | |
24 | | -| DOS operating system<br/>(MS-DOS 5.0 compatible) | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
25 | | -| [80386 compatible processor](https://en.wikipedia.org/wiki/I386)* <br/> <pre>*Any AMD or Intel CPU <br/>made in the last 3 decades<br/>is compatible.<br/><br/>Machine emulators provided <br/>as an option for other ISAs </pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/))<br/>[Qemu](https://www.qemu.org/) ([GitLab](https://gitlab.com/qemu-project/qemu)) |
26 | | -| A patching utility | [GNU Patch](https://savannah.gnu.org/projects/patch/)<br>[DifPat](https://github.com/deverac/difpat) | |
| 21 | +| Requirement | Sources | |
| 22 | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 23 | +| Lua 5.4 source code (or build machine with `git submodules`) | [lua.org](https://lua.org/ftp/) ([GitHub](https://github.com/lua/lua/tree/v5.4.6)) | |
| 24 | +| Open Watcom 1.9 (or later) | [openwatcom.org](https://www.openwatcom.org/) ([GitHub](https://github.com/open-watcom))<br/>[FreeDOS Bonus CD](https://www.freedos.org/download/) (`FDIMPLES`)<br/>[SvarDOS](http://svardos.org/?p=repo) (`PKGNET` repository) | |
| 25 | +| DOS operating system<br/>(MS-DOS 5.0 compatible) | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) | |
| 26 | +| [80386 compatible processor](https://en.wikipedia.org/wiki/I386)* <br/> <pre>*Any AMD or Intel CPU <br/>made in the last 3 decades<br/>is compatible.<br/><br/>Machine emulators provided <br/>as an alternative for other ISAs </pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/))<br/>[Qemu](https://www.qemu.org/) ([GitLab](https://gitlab.com/qemu-project/qemu)) | |
| 27 | +| A patching utility | [GNU Patch](https://savannah.gnu.org/projects/patch/)<br>[DifPat](https://github.com/deverac/difpat) | |
27 | 28 |
|
28 | 29 | > If in doubt, install [DOSBox-X](https://dosbox-x.com/) |
29 | 30 |
|
30 | 31 | ## How to build |
31 | | -1) Extract Luas source code |
32 | | -2) Copy all files in this repository to the `src` folder of the extracted content |
33 | | -3) Patch the source code for Watcom: |
34 | | - |
35 | | -| GNU Patch | DifPat | |
36 | | -|--|--| |
37 | | -| `patch luaconf.h luaconf.pat` | `pat luaconf.pat luaconf.h` | |
38 | | -| `patch lopcodes.h lopcodes.pat` | `pat lopcodes.pat lopcodes.h ` | |
39 | | -| `patch lutf8lib.c lutf8lib.pat` | `pat lutf8lib.pat lutf8lib.c` | |
40 | | -> If no patching program is available mimic the changes in each `.pat` file manually. Patch changes are minimal |
41 | | -
|
42 | | -4) Build Lua for real mode DOS with `wmake -f watcom_l.mak` |
43 | | - - If successful `dist/bin/dos16.exe` and `dist/bin/dosc16.exe` will be created |
44 | | -5) Clean up object files with `wmake -f watcom_l.mak clean` |
45 | | -6) Build Lua for DOS4GW with `wmake -f watcom_f.mak` |
46 | | - - If successful `dist/bin/dos4g.exe` and `dist/bin/dosc4g.exe` will be created |
47 | | -7) Clean up object files with `wmake -f watcom_f.mak clean` |
| 32 | +1) Extract Luas source code to the `Lua` folder. This can be achieved in two ways: |
| 33 | + * Use `git submodules init` then `git submodules update --recursive` to get the sources directly from the Lua mirror repository |
| 34 | + * Download the Lua 5.4.x sources tarballs from https://lua.org/ftp/, extract them and copy all files in `src` to `Lua` |
| 35 | +2) Patch the source code for Watcom (optional): |
| 36 | + |
| 37 | + | GNU Patch | DifPat | |
| 38 | + |---------------------------------|--------------------------------| |
| 39 | + | `patch luaconf.h luaconf.pat` | `pat luaconf.pat luaconf.h` | |
| 40 | + | `patch lopcodes.h lopcodes.pat` | `pat lopcodes.pat lopcodes.h ` | |
| 41 | + | `patch lutf8lib.c lutf8lib.pat` | `pat lutf8lib.pat lutf8lib.c` | |
| 42 | + > If no patching program is available mimic the changes in each `.pat` file manually. |
| 43 | + > Patch changes are minimal and only serve to silence Watcom compiler warnings |
| 44 | +
|
| 45 | +3) Build Lua with the following commands: |
| 46 | + - `wmake -f wm_dos16.mak` will create `dist/bin/dos16.exe` |
| 47 | + which can be run on PC-DOS 2 on an 8088 or better PC |
| 48 | + - `wmake -f wm_dos4g.mak` will create `dist/bin/dos4g.exe` |
| 49 | + which can be run on MS-DOS 5 on an i386 or better PC |
48 | 50 |
|
49 | 51 | Other targets may work but are untested |
0 commit comments