aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-07-09 17:25:05 +0200
committerMike Pall <mike>2013-07-09 17:30:02 +0200
commit519ef0cba7ebceb99e727da9655692d137854188 (patch)
tree5f765b2adb14d39162ff8e52b300974524b796b1
parentb2a13ddd74384ab6b73c12a953e22c1c3f1726da (diff)
downloadluajit-519ef0cba7ebceb99e727da9655692d137854188.tar.gz
luajit-519ef0cba7ebceb99e727da9655692d137854188.tar.bz2
luajit-519ef0cba7ebceb99e727da9655692d137854188.zip
Add support for multilib distro builds.
-rw-r--r--Makefile6
-rw-r--r--doc/install.html4
-rw-r--r--etc/luajit.pc5
-rw-r--r--src/Makefile13
-rw-r--r--src/luaconf.h46
5 files changed, 50 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 8883503f..e56b457e 100644
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,12 @@ ABIVER= 5.1
25# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path! 25# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
26# 26#
27export PREFIX= /usr/local 27export PREFIX= /usr/local
28export MULTILIB= lib
28############################################################################## 29##############################################################################
29 30
30DPREFIX= $(DESTDIR)$(PREFIX) 31DPREFIX= $(DESTDIR)$(PREFIX)
31INSTALL_BIN= $(DPREFIX)/bin 32INSTALL_BIN= $(DPREFIX)/bin
32INSTALL_LIB= $(DPREFIX)/lib 33INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
33INSTALL_SHARE= $(DPREFIX)/share 34INSTALL_SHARE= $(DPREFIX)/share
34INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) 35INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
35 36
@@ -73,7 +74,8 @@ INSTALL_X= install -m 0755
73INSTALL_F= install -m 0644 74INSTALL_F= install -m 0644
74UNINSTALL= $(RM) 75UNINSTALL= $(RM)
75LDCONFIG= ldconfig -n 76LDCONFIG= ldconfig -n
76SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" 77SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
78 -e "s|^multilib=.*|multilib=$(MULTILIB)|"
77 79
78FILE_T= luajit 80FILE_T= luajit
79FILE_A= libluajit.a 81FILE_A= libluajit.a
diff --git a/doc/install.html b/doc/install.html
index faf19c43..b7bf75ce 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -565,9 +565,11 @@ for a regular distribution build:
565<ul> 565<ul>
566<li><tt>PREFIX</tt> overrides the installation path and should usually 566<li><tt>PREFIX</tt> overrides the installation path and should usually
567be set to <tt>/usr</tt>. Setting this also changes the module paths and 567be set to <tt>/usr</tt>. Setting this also changes the module paths and
568the <tt>-rpath</tt> of the shared library.</li> 568the paths needed to locate the shared library.</li>
569<li><tt>DESTDIR</tt> is an absolute path which allows you to install 569<li><tt>DESTDIR</tt> is an absolute path which allows you to install
570to a shadow tree instead of the root tree of the build system.</li> 570to a shadow tree instead of the root tree of the build system.</li>
571<li><tt>MULTILIB</tt> sets the architecture-specific library path component
572for multilib systems. The default is <tt>lib</tt>.</li>
571<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt> 573<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
572for additional variables to tweak. The following variables <em>may</em> be 574for additional variables to tweak. The following variables <em>may</em> be
573overridden, but it's <em>not</em> recommended, except for special needs 575overridden, but it's <em>not</em> recommended, except for special needs
diff --git a/etc/luajit.pc b/etc/luajit.pc
index 5a982a62..48233965 100644
--- a/etc/luajit.pc
+++ b/etc/luajit.pc
@@ -6,13 +6,14 @@ version=${majver}.${minver}.${relver}
6abiver=5.1 6abiver=5.1
7 7
8prefix=/usr/local 8prefix=/usr/local
9multilib=lib
9exec_prefix=${prefix} 10exec_prefix=${prefix}
10libdir=${exec_prefix}/lib 11libdir=${exec_prefix}/${multilib}
11libname=luajit-${abiver} 12libname=luajit-${abiver}
12includedir=${prefix}/include/luajit-${majver}.${minver} 13includedir=${prefix}/include/luajit-${majver}.${minver}
13 14
14INSTALL_LMOD=${prefix}/share/lua/${abiver} 15INSTALL_LMOD=${prefix}/share/lua/${abiver}
15INSTALL_CMOD=${prefix}/lib/lua/${abiver} 16INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}
16 17
17Name: LuaJIT 18Name: LuaJIT
18Description: Just-in-time compiler for Lua 19Description: Just-in-time compiler for Lua
diff --git a/src/Makefile b/src/Makefile
index 999e2808..04699343 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -188,9 +188,10 @@ TARGET_LD= $(CROSS)$(CC)
188TARGET_AR= $(CROSS)ar rcus 188TARGET_AR= $(CROSS)ar rcus
189TARGET_STRIP= $(CROSS)strip 189TARGET_STRIP= $(CROSS)strip
190 190
191TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
191TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER) 192TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
192TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib 193TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
193TARGET_DYLIBPATH= $(or $(PREFIX),/usr/local)/lib/$(TARGET_DYLIBNAME) 194TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
194TARGET_DLLNAME= lua$(NODOTABIVER).dll 195TARGET_DLLNAME= lua$(NODOTABIVER).dll
195TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME) 196TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
196TARGET_DYNXLDOPTS= 197TARGET_DYNXLDOPTS=
@@ -249,12 +250,18 @@ TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
249 250
250ifneq (,$(PREFIX)) 251ifneq (,$(PREFIX))
251ifneq (/usr/local,$(PREFIX)) 252ifneq (/usr/local,$(PREFIX))
252 TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\" 253 TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\"
253 ifneq (/usr,$(PREFIX)) 254 ifneq (/usr,$(PREFIX))
254 TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib 255 TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH)
255 endif 256 endif
256endif 257endif
257endif 258endif
259ifneq (,$(MULTILIB))
260 TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\"
261endif
262ifneq (,$(LMULTILIB))
263 TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\"
264endif
258 265
259############################################################################## 266##############################################################################
260# System detection. 267# System detection.
diff --git a/src/luaconf.h b/src/luaconf.h
index d55caab1..224bfada 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -23,26 +23,40 @@
23 ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" 23 ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
24#else 24#else
25/* 25/*
26** Note to distribution maintainers: do NOT patch the following line! 26** Note to distribution maintainers: do NOT patch the following lines!
27** Please read ../doc/install.html#distro and pass PREFIX=/usr instead. 27** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
28*/ 28*/
29#define LUA_ROOT "/usr/local/" 29#ifndef LUA_MULTILIB
30#define LUA_LDIR LUA_ROOT "share/lua/5.1/" 30#define LUA_MULTILIB "lib"
31#define LUA_CDIR LUA_ROOT "lib/lua/5.1/" 31#endif
32#ifdef LUA_XROOT 32#ifndef LUA_LMULTILIB
33#define LUA_JDIR LUA_XROOT "share/luajit-2.0.2/" 33#define LUA_LMULTILIB "lib"
34#define LUA_XPATH \ 34#endif
35 ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua" 35#define LUA_LROOT "/usr/local"
36#define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;" 36#define LUA_LUADIR "/lua/5.1/"
37#define LUA_LJDIR "/luajit-2.0.2/"
38
39#ifdef LUA_ROOT
40#define LUA_JROOT LUA_ROOT
41#define LUA_RLDIR LUA_ROOT "/share" LUA_LUADIR
42#define LUA_RCDIR LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
43#define LUA_RLPATH ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
44#define LUA_RCPATH ";" LUA_RCDIR "?.so"
37#else 45#else
38#define LUA_JDIR LUA_ROOT "share/luajit-2.0.2/" 46#define LUA_JROOT LUA_LROOT
39#define LUA_XPATH 47#define LUA_RLPATH
40#define LUA_XCPATH 48#define LUA_RCPATH
41#endif 49#endif
42#define LUA_PATH_DEFAULT \ 50
43 "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH 51#define LUA_JPATH ";" LUA_JROOT "/share" LUA_LJDIR "?.lua"
44#define LUA_CPATH_DEFAULT \ 52#define LUA_LLDIR LUA_LROOT "/share" LUA_LUADIR
45 "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so" 53#define LUA_LCDIR LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
54#define LUA_LLPATH ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
55#define LUA_LCPATH1 ";" LUA_LCDIR "?.so"
56#define LUA_LCPATH2 ";" LUA_LCDIR "loadall.so"
57
58#define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
59#define LUA_CPATH_DEFAULT "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
46#endif 60#endif
47 61
48/* Environment variable names for path overrides and initialization code. */ 62/* Environment variable names for path overrides and initialization code. */