Hi,
On Wednesday, October 16, 2013 3:35:09 PM UTC-5, Segadude wrote:
>
> I compiled regular Lua 5.2.2 (right from Lua.org)
> for DOS because I was looking for a Lua port for
> MS-DOS but couldn't fine one.
http://www.netgull.com/djgpp/beta/v2tk/lua522b.zip
http://www.netgull.com/djgpp/beta/v2tk/lua522s.zip
> So I decided to compile it myself. I have a small
> lua script I want to be able to run on DOS.
AFAIK, the only advantage to Juan's port is that it
supports .so (via /beta/ 2.04 DXE3) and uses readline.
If you don't need that, you can compile it yourself.
IIRC, preferred support is (in order) posix, generic,
ansi. (Those may or may not work how you expect.)
> For my Lua compilation,
> I want a single EXE that will run in a pure DOS
> environment without the need for anything else to
> be installed. Could you elaborate a bit on how to
> use the cwsdstub? Thanks for all the help you have
> given me thus far.
1). wget
http://www.lua.org/ftp/lua-5.2.2.tar.gz
2). enable djgpp (set PATH and DJGPP)
3). djtar -x lua*.tar.gz
4). cd lua-5.2.2\src
5). ren luac.c *.c~
6). gcc -s -Os -ansi -Wpedantic -DLUA_ANSI *.c -o lua.exe
7). exe2coff lua.exe
8). copy /b cwsdstub.exe + lua lua-cws.exe
9). upx --best --lzma --all-filters lua-cws.exe
10). lua-cws -e "print(36+64)"
Now you can use LUA-CWS.EXE on any DOS compatible OS,
whether there is already a DPMI server or not.
P.S. Actually, I almost forgot: Lua uses "double" (FPU)
for all numbers, so you may need an FPU emulation lib,
but that's only for very old computers that (for good
or bad) most people don't care about. If this is a
problem, you can link with "-lemu" or use 3rd-party
WMEMU (slightly more accurate??). You can also let
people optionally use emu387.dxe at runtime in order
to not have to link that in too, but you seem to be
more concerned with everything being self-contained.