lua-users home
lua-l archive

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


Mark Edgar wrote:
Mike Pall wrote:

Hi,

Luiz Henrique de Figueiredo wrote:

The attached patch allows Lua to be built on a Cygwin host targetting MinGW:

make "CC=gcc -mno-cygwin" mingw  # build MinGW version


Thanks. Shouldn't we then add a cygwin target as below?

cygwin:
    $(MAKE) "CC=gcc -mno-cygwin" mingw



This would be a misnomer, but you may want to do it anyway.


No, because in this case, mingw is still the target; Cygwin just happens to be the build environment. With the s/gcc/$(CC)/ change, the Makefile basically doesn't care if you are building the mingw target using a MinGW build environment or a Cygwin build environment, and this works out just fine.

[ I guess this requires an explanation:


In addition to all of Mike's good information, I'd like to add that ''make posix'' works just fine for the Cygwin target.

Unless you want readline support or you want to build shared objects (DLLs) instead of a static library. But then most people building Lua from source could figure this out. The rest should be able to use LuaBinaries, I should think. ;)

For those who can't or don't want to figure this out, the following build configuration works for me:

cygwin:
	$(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
	"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
	"MYCFLAGS=-DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_BUILD_AS_DLL" \
	"MYLIBS=-lreadline -lhistory -lncurses" "MYLDFLAGS=-s" lua.exe

It's not particularly important to me to have this added to the distribution, I just wanted to provide it here.

As an aside, it seems that no Cygwin header declares _longjmp/_setjmp, but glibc defines them and they seem to work. Otherwise, there are no other build warnings. Nice!

					-Mark