]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Add support for multilib distro builds.
authorMike Pall <mike>
Tue, 9 Jul 2013 15:25:05 +0000 (17:25 +0200)
committerMike Pall <mike>
Tue, 9 Jul 2013 15:30:02 +0000 (17:30 +0200)
Makefile
doc/install.html
etc/luajit.pc
src/Makefile
src/luaconf.h

index 8883503f66c4eec016e0528b4a3b7d580edf96b7..e56b457e7a51f615492cdb090bffb9078554321f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,12 @@ ABIVER=  5.1
 # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
 #
 export PREFIX= /usr/local
+export MULTILIB= lib
 ##############################################################################
 
 DPREFIX= $(DESTDIR)$(PREFIX)
 INSTALL_BIN=   $(DPREFIX)/bin
-INSTALL_LIB=   $(DPREFIX)/lib
+INSTALL_LIB=   $(DPREFIX)/$(MULTILIB)
 INSTALL_SHARE= $(DPREFIX)/share
 INSTALL_INC=   $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
 
@@ -73,7 +74,8 @@ INSTALL_X= install -m 0755
 INSTALL_F= install -m 0644
 UNINSTALL= $(RM)
 LDCONFIG= ldconfig -n
-SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|"
+SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
+            -e "s|^multilib=.*|multilib=$(MULTILIB)|"
 
 FILE_T= luajit
 FILE_A= libluajit.a
index faf19c431b832df2c673b5d08b1995df452752ed..b7bf75ce38f0936b98965514190ad82e7c6f7ce9 100644 (file)
@@ -565,9 +565,11 @@ for a regular distribution build:
 <ul>
 <li><tt>PREFIX</tt> overrides the installation path and should usually
 be set to <tt>/usr</tt>. Setting this also changes the module paths and
-the <tt>-rpath</tt> of the shared library.</li>
+the paths needed to locate the shared library.</li>
 <li><tt>DESTDIR</tt> is an absolute path which allows you to install
 to a shadow tree instead of the root tree of the build system.</li>
+<li><tt>MULTILIB</tt> sets the architecture-specific library path component
+for multilib systems. The default is <tt>lib</tt>.</li>
 <li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
 for additional variables to tweak. The following variables <em>may</em> be
 overridden, but it's <em>not</em> recommended, except for special needs
index 5a982a627d2fa73e3f440a16da36bedbcdf7b875..482339655441a9554389598040bdafef37fd0565 100644 (file)
@@ -6,13 +6,14 @@ version=${majver}.${minver}.${relver}
 abiver=5.1
 
 prefix=/usr/local
+multilib=lib
 exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
+libdir=${exec_prefix}/${multilib}
 libname=luajit-${abiver}
 includedir=${prefix}/include/luajit-${majver}.${minver}
 
 INSTALL_LMOD=${prefix}/share/lua/${abiver}
-INSTALL_CMOD=${prefix}/lib/lua/${abiver}
+INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}
 
 Name: LuaJIT
 Description: Just-in-time compiler for Lua
index 999e2808dca370a0994cb002edb72ae8bda4db4f..0469934397789ffebd6587ed2eae2ada3e2c2935 100644 (file)
@@ -188,9 +188,10 @@ TARGET_LD= $(CROSS)$(CC)
 TARGET_AR= $(CROSS)ar rcus
 TARGET_STRIP= $(CROSS)strip
 
+TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
 TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
 TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
-TARGET_DYLIBPATH= $(or $(PREFIX),/usr/local)/lib/$(TARGET_DYLIBNAME)
+TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
 TARGET_DLLNAME= lua$(NODOTABIVER).dll
 TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
 TARGET_DYNXLDOPTS=
@@ -249,12 +250,18 @@ TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
 
 ifneq (,$(PREFIX))
 ifneq (/usr/local,$(PREFIX))
-  TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
+  TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\"
   ifneq (/usr,$(PREFIX))
-    TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
+    TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH)
   endif
 endif
 endif
+ifneq (,$(MULTILIB))
+  TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\"
+endif
+ifneq (,$(LMULTILIB))
+  TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\"
+endif
 
 ##############################################################################
 # System detection.
index d55caab1d075d0d410fc9c18476c575e906c91fb..224bfada0e693b2b6f5f780c1f2fe5a14e3a8bbc 100644 (file)
   ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
 #else
 /*
-** Note to distribution maintainers: do NOT patch the following line!
+** Note to distribution maintainers: do NOT patch the following lines!
 ** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
 */
-#define LUA_ROOT       "/usr/local/"
-#define LUA_LDIR       LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR       LUA_ROOT "lib/lua/5.1/"
-#ifdef LUA_XROOT
-#define LUA_JDIR       LUA_XROOT "share/luajit-2.0.2/"
-#define LUA_XPATH \
-  ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
-#define LUA_XCPATH     LUA_XROOT "lib/lua/5.1/?.so;"
+#ifndef LUA_MULTILIB
+#define LUA_MULTILIB   "lib"
+#endif
+#ifndef LUA_LMULTILIB
+#define LUA_LMULTILIB  "lib"
+#endif
+#define LUA_LROOT      "/usr/local"
+#define LUA_LUADIR     "/lua/5.1/"
+#define LUA_LJDIR      "/luajit-2.0.2/"
+
+#ifdef LUA_ROOT
+#define LUA_JROOT      LUA_ROOT
+#define LUA_RLDIR      LUA_ROOT "/share" LUA_LUADIR
+#define LUA_RCDIR      LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
+#define LUA_RLPATH     ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
+#define LUA_RCPATH     ";" LUA_RCDIR "?.so"
 #else
-#define LUA_JDIR       LUA_ROOT "share/luajit-2.0.2/"
-#define LUA_XPATH
-#define LUA_XCPATH
+#define LUA_JROOT      LUA_LROOT
+#define LUA_RLPATH
+#define LUA_RCPATH
 #endif
-#define LUA_PATH_DEFAULT \
-  "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
-#define LUA_CPATH_DEFAULT \
-  "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
+
+#define LUA_JPATH      ";" LUA_JROOT "/share" LUA_LJDIR "?.lua"
+#define LUA_LLDIR      LUA_LROOT "/share" LUA_LUADIR
+#define LUA_LCDIR      LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
+#define LUA_LLPATH     ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
+#define LUA_LCPATH1    ";" LUA_LCDIR "?.so"
+#define LUA_LCPATH2    ";" LUA_LCDIR "loadall.so"
+
+#define LUA_PATH_DEFAULT       "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
+#define LUA_CPATH_DEFAULT      "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
 #endif
 
 /* Environment variable names for path overrides and initialization code. */