forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lua-5.1-make-r2.patch
97 lines (89 loc) · 3 KB
/
lua-5.1-make-r2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff -ru lua-5.1.5.orig/Makefile lua-5.1.5/Makefile
--- lua-5.1.5.orig/Makefile 2014-04-15 17:43:34.845435031 +0200
+++ lua-5.1.5/Makefile 2014-04-15 19:05:08.669304987 +0200
@@ -11,7 +11,7 @@
# so take care if INSTALL_TOP is not an absolute path.
INSTALL_TOP= /usr/local
INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include
+INSTALL_INC= $(INSTALL_TOP)/include/lua$V
INSTALL_LIB= $(INSTALL_TOP)/lib
INSTALL_MAN= $(INSTALL_TOP)/man/man1
#
@@ -126,3 +126,21 @@
.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
# (end of Makefile)
+
+# Use libtool for binary installs, etc.
+
+export V
+export LIBTOOL = libtool --quiet --tag=CC
+# See libtool manual about how to set this
+
+gentoo_clean:
+ cd src; $(MAKE) $@
+
+gentoo_test: gentoo_linux
+ test/lua.static test/hello.lua
+
+gentoo_install:
+ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
+ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua$V luac$V $(INSTALL_BIN)
+ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua$V.la $(INSTALL_LIB)
diff -ru lua-5.1.5.orig/src/Makefile lua-5.1.5/src/Makefile
--- lua-5.1.5.orig/src/Makefile 2014-04-15 17:43:34.844435031 +0200
+++ lua-5.1.5/src/Makefile 2014-04-15 18:07:21.427397122 +0200
@@ -29,10 +29,10 @@
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lstrlib.o loadlib.o linit.o
-LUA_T= lua
+LUA_T= lua$V
LUA_O= lua.o
-LUAC_T= luac
+LUAC_T= luac$V
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
@@ -51,10 +51,10 @@
$(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
$(RANLIB) $@
-$(LUA_T): $(LUA_O) $(LUA_A)
+origin$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
-$(LUAC_T): $(LUAC_O) $(LUA_A)
+origin$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
@@ -180,3 +180,33 @@
ltm.h lzio.h lmem.h lopcodes.h lundump.h
# (end of Makefile)
+
+export LIBTOOL = libtool --tag=CC
+export LIB_VERSION = 5:1:5
+
+# The following rules use libtool for compiling and linking in order to
+# provide shared library support.
+
+LIB_NAME = liblua$V.la
+LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
+
+%.lo %.o: %.c
+ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+$(LIB_NAME): $(LIB_OBJS)
+ $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
+ -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
+
+$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
+ $(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
+
+lua_test: $(LUA_O:.o=.lo) $(LIB_NAME)
+ $(LIBTOOL) --mode=link $(CC) -static -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
+
+$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
+ $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
+
+gentoo_clean:
+ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua$V luac$V
+
+gentoo_all: $(LIB_NAME) $(LUA_T) lua_test $(LUAC_T)