[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc1) now available
- From: David Manura <dm.lua@...>
- Date: Fri, 25 Nov 2011 12:34:39 -0500
On Thu, Nov 24, 2011 at 8:41 PM, KHMan <keinhong@gmail.com> wrote:
> So my primary concern is breaking of out-of-the-box MinGW compilation
> experience.
How about the attached patch to 5.2.0-rc2?
Now, you can cross-compile mingw from Linux or Cygwin just by doing
one of these:
make mingw TOOLCHAIN=i586-mingw32msvc-
make mingw TOOLCHAIN=i686-w64-mingw32-
make mingw TOOLCHAIN=x86_64-w64-mingw32-
The mingw target is also simplified to only do one recursive make invocation:
mingw:
$(MAKE) $(ALL) "LUA_A=lua52.dll" "LUA_T=lua.exe" "LUAC_T=luac.exe" DUP= \
"ARI=$(CC) -shared -o" "RANLIBI=$(STRIP) --strip-unneeded" \
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s"
--- lua-5.2.0/src/Makefile 2011-09-19 08:45:14.000000000 -0400
+++ lua-5.2.0-patch/src/Makefile 2011-11-25 12:06:21.565309833 -0500
@@ -5,16 +5,23 @@
# Your platform. See PLATS for possible values.
PLAT= none
+TOOLCHAIN=
-CC= gcc
+CC= $(TOOLCHAIN)gcc
CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
-AR= ar rcu
-RANLIB= ranlib
+AR= $(TOOLCHAIN)ar
+RANLIB= $(TOOLCHAIN)ranlib
+STRIP= $(TOOLCHAIN)strip
RM= rm -f
+ARI= $(AR) rcu
+ARC= $(AR) rcu
+RANLIBI= $(RANLIB)
+RANLIBC= $(RANLIB)
+
SYSCFLAGS=
SYSLDFLAGS=
SYSLIBS=
@@ -28,7 +35,9 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+DUP=_ # effectively disable duplicate targets
LUA_A= liblua.a
+LUAC_A= liblua.a
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -56,14 +65,18 @@
a: $(ALL_A)
$(LUA_A): $(BASE_O)
- $(AR) $@ $?
- $(RANLIB) $@
+ $(ARI) $@ $?
+ $(RANLIBI) $@
+
+$(LUAC_A)$(DUP): $(BASE_O)
+ $(ARC) $@ $?
+ $(RANLIBC) $@
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
-$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+$(LUAC_T): $(LUAC_O) $(LUAC_A)
+ $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUAC_A) $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
@@ -109,10 +122,9 @@
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
mingw:
- $(MAKE) "LUA_A=lua52.dll" "LUA_T=lua.exe" \
- "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
- "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
- $(MAKE) "LUAC_T=luac.exe" luac.exe
+ $(MAKE) $(ALL) "LUA_A=lua52.dll" "LUA_T=lua.exe" "LUAC_T=luac.exe" DUP= \
+ "ARI=$(CC) -shared -o" "RANLIBI=$(STRIP) --strip-unneeded" \
+ "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s"
posix:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX"