lua-users home
lua-l archive

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


Hi,

New to the list.  I found myself needing to compile liblua.a as a fat (universal ppc/x86) library.  I didn't find anything in the archives, so I'm posting my solution in case someone comes looking in the future.

These two patches are against the 5.1.1 distribution ./Makefile and ./src/Makefile.  I added a new target for 'macosx_ub', so a simple 'make macosx_ub' will build liblua.a, lua, and luac as universal binaries.

Best,

Art
--

--- lua-5.1.1/Makefile    2006-06-02 03:53:38.000000000 -0700
+++ lua-changed/Makefile    2006-09-12 09:46:37.000000000 -0700
@@ -37,7 +37,7 @@
 # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
 
 # Convenience platforms targets.
-PLATS= aix ansi bsd generic linux macosx mingw posix solaris
+PLATS= aix ansi bsd generic linux macosx macosx_ub mingw posix solaris
 
 # What to install.
 TO_BIN= lua luac

--- lua-5.1.1/src/Makefile    2006-03-21 17:41:49.000000000 -0700
+++ lua-changed/src/Makefile    2006-09-12 10:09:55.000000000 -0700
@@ -20,7 +20,7 @@
 
 # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
 
-PLATS= aix ansi bsd generic linux macosx mingw posix solaris
+PLATS= aix ansi bsd generic linux macosx macosx_ub mingw posix solaris
 
 LUA_A=    liblua.a
 CORE_O=    lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
@@ -99,6 +99,10 @@
 # use this on Mac OS X 10.4
 #    $(MAKE) all MYCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" MYLIBS="-lreadline"
 
+macosx_ub:
+    $(MAKE) all MYCFLAGS="-DLUA_USE_MACOSX -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \
+      "MYLDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
+
 mingw:
     $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
     "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \