lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

Luiz Henrique de Figueiredo wrote:
> The tarball has been updated with fixes for the glitches reported till now:
> 	http://www.lua.org/work/lua-5.1-alpha.tar.gz

Oh ... had I known then I'd have reported a few other things
right away:

- lvm.c:luaV_execute(), case OP_EQ: RKB(), RKC() are evaluated
  twice due to the equalobj() macro. This means 2 more unpredictable
  branches than necessary.

- The check when to use the underscore-variant for _longjmp/_setjmp
  in luaconf.h does not work as intended.

  Explanation: glibc is mainly used on Linux which has SYSV heritage
  and there neither variant saves signals (i.e. it's pointless to
  test for __GLIBC__).

  But ... FreeBSD, NetBSD, OpenBSD and Mac OS X have BSD heritage
  and there the non-underscore variant does save signals. I.e. it's
  very desirable to use the underscore variants there.

  Unfortunately there is no single define that covers all of them.
  If the 51w6 test for __unix was too generic, then you have to
  replace it with this CPP mess:

    !defined(LUA_ANSI) && (defined(__FreeBSD__) || \
      defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__))

  Sorry, I found no better way.

- Minor issue with assertions: the assertion in ldo.c:lua_resume()
  should be moved after luai_userstateresume() or it triggers
  with Coco. Thank you a lot for adding these macros!

And about the 'new' alpha: The new file etc/luavs.bat seems
to be a MSVC build script. But the proper name for the Lua
core DLL is lua51.dll and not just lua.dll (change lua.lib
to lua51.lib, too).


BTW: Here's what one needs to do to get Lua to cross-compile
for Windows with MINGW:

Add the following target to the top-level Makefile:

mingw:
	cd src; $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
	"AR=gcc -shared -o" "RANLIB=strip --strip-unneeded" \
	"MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" MYLDFLAGS=-s" lua.exe

[Cut'n'paste caveat: the leading whitespace must be replaced
with a single tab char in the Makefile.]

Then add the directory with the MINGW tools in front of your path
and invoke 'make mingw' from the toplevel.

The trailing lua.exe target is needed because luac.exe can't be
built this way. The required symbols are not exported from the DLL.
Just make clean, run make (without a target) and rename luac to
luac.exe.


Similar targets for out-of-the-box compilation are easy to do
for Linux and *BSD:

linux:
	cd src; $(MAKE) "MYCFLAGS=-DLUA_USE_DLOPEN" "MYLIBS=-Wl,-E -ldl"

bsd:
	cd src; $(MAKE) "MYCFLAGS=-DLUA_USE_DLOPEN" "MYLIBS=-Wl,-E"

Bye,
     Mike