lua50 (5.0.3-4) build.dpatch

Summary

 Makefile          |   16 ++++++++++++----
 config            |   33 +++++++++++++++++++--------------
 src/Makefile      |    8 +++++---
 src/lib/Makefile  |   12 +++++++-----
 src/lua/Makefile  |    4 ++--
 src/luac/Makefile |    4 ++--
 6 files changed, 47 insertions(+), 30 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## Makefile.dpatch by John V. Belmonte <jbelmonte@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for Debian package to makefiles.

@DPATCH@
diff -urNad trunk~/Makefile trunk/Makefile
--- trunk~/Makefile	2007-08-17 11:19:11.000000000 +0200
+++ trunk/Makefile	2007-08-17 11:19:34.000000000 +0200
@@ -26,21 +26,29 @@
 
 # remove debug information from binaries
 strip:
-	$(STRIP) bin/*
+	#$(STRIP) bin/*
 
 # official installation
 install: all strip
 	mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN)
+	mkdir -p $(INSTALL_SHARE)
 	$(INSTALL_EXEC) bin/* $(INSTALL_BIN)
 	$(INSTALL_DATA) include/*.h $(INSTALL_INC)
+	$(INSTALL_DATA) src/lib/compat-5.1r5/*.h $(INSTALL_INC)
 	$(INSTALL_DATA) lib/*.a $(INSTALL_LIB)
 	$(INSTALL_DATA) doc/*.1 $(INSTALL_MAN)
+	$(INSTALL_DATA) src/lib/compat-5.1r5/compat-5.1.lua $(INSTALL_SHARE)
 
 # shared libraries (for Linux)
 so:
-	ld -o lib/liblua.so.$V -shared src/*.o
-	ld -o lib/liblualib.so.$V -shared src/lib/*.o
-	cd lib; ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V liblualib.so
+	gcc -o lib/liblua50.so.$V -shared -Wl,-soname,liblua50.so.$V \
+               src/*.os -lc
+	ln -fs liblua50.so.$V lib/liblua-build50.so
+	gcc -o lib/liblualib50.so.$V -shared -Wl,-soname,liblualib50.so.$V \
+               src/lib/*.os src/lib/compat-5.1r5/*.os \
+	       -Llib -llua-build50 -lm -ldl -lc
+	cd lib; ln -fs liblua50.so.$V liblua50.so; \
+                ln -fs liblualib50.so.$V liblualib50.so
 
 # binaries using shared libraries
 sobin:
diff -urNad trunk~/config trunk/config
--- trunk~/config	2007-08-17 11:19:11.000000000 +0200
+++ trunk/config	2007-08-17 11:19:12.000000000 +0200
@@ -25,15 +25,15 @@
 # interface (e.g., Linux, Solaris, IRIX, BSD, AIX, HPUX, and probably others),
 # uncomment the next two lines.
 #
-#LOADLIB= -DUSE_DLOPEN=1
-#DLLIB= -ldl
+LOADLIB= -DUSE_DLOPEN=1
+DLLIB= -ldl
 #
 # In Linux with gcc, you should also uncomment the next definition for
 # MYLDFLAGS, which passes -E (= -export-dynamic) to the linker. This option
 # allows dynamic libraries to link back to the `lua' program, so that they do
 # not need the Lua libraries. (Other systems may have an equivalent facility.)
 #
-#MYLDFLAGS= -Wl,-E
+MYLDFLAGS= -Wl,-E
 #
 # On Windows systems. support for dynamic loading is enabled by default.
 # To disable this support, uncomment the next line.
@@ -92,7 +92,7 @@
 # or if you are using a modified interpreter that does not need them,
 # then comment the following line or add the appropriates libraries.
 #
-EXTRA_LIBS= -lm
+#EXTRA_LIBS= -lm
 
 # If you want to customize the stand-alone Lua interpreter, uncomment and
 # edit the following two lines; also edit etc/saconfig.c to suit your needs.
@@ -100,8 +100,8 @@
 # to add -lreadline (and perhaps also -lhistory and -lcurses or -lncurses)
 # to EXTRA_LIBS.
 #
-#USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
-#EXTRA_LIBS= -lm -ldl -lreadline # -lhistory -lcurses -lncurses
+USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
+EXTRA_LIBS= -lreadline -lm -ldl # -lhistory -lcurses -lncurses
 
 # ------------------------------------------------------------------ C compiler
 
@@ -148,19 +148,20 @@
 
 # Locations for "make install". You may need to be root do "make install".
 #
-INSTALL_ROOT= /usr/local
+INSTALL_ROOT= $(PREFIX)/usr
 INSTALL_BIN= $(INSTALL_ROOT)/bin
-INSTALL_INC= $(INSTALL_ROOT)/include
+INSTALL_INC= $(INSTALL_ROOT)/include/lua50
 INSTALL_LIB= $(INSTALL_ROOT)/lib
-INSTALL_MAN= $(INSTALL_ROOT)/man/man1
+INSTALL_MAN= $(INSTALL_ROOT)/share/man/man1
+INSTALL_SHARE= $(INSTALL_ROOT)/share/lua/50
 
 # You may prefer to use "install" instead of "cp" if you have it.
 # If you use "install", you may also want to change the permissions after -m.
 #
-INSTALL_EXEC= cp
-INSTALL_DATA= cp
-#INSTALL_EXEC= install -m 0755
-#INSTALL_DATA= install -m 0644
+#INSTALL_EXEC= cp
+#INSTALL_DATA= cp
+INSTALL_EXEC= install -m 0755
+INSTALL_DATA= install -m 0644 -p
 
 # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
 
@@ -173,6 +174,10 @@
 INCS= -I$(INC) $(EXTRA_INCS)
 DEFS= $(NUMBER) $(EXTRA_DEFS)
 
-CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
+CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS) -DINSTALL_SHARE=\"$(INSTALL_SHARE)\"
+
+# Extra rule for .os files
+%.os: %.c
+	$(CC) $(CFLAGS) -fPIC -DPIC -o $@ -c $<
 
 # (end of config)
diff -urNad trunk~/src/Makefile trunk/src/Makefile
--- trunk~/src/Makefile	2007-08-17 11:19:11.000000000 +0200
+++ trunk/src/Makefile	2007-08-17 11:19:12.000000000 +0200
@@ -67,16 +67,18 @@
 	lvm.h \
 	lzio.h
 
-T= $(LIB)/liblua.a
+T= $(LIB)/liblua50.a
+
+SOBJS := $(patsubst %.o,%.os,$(OBJS))
 
 all:	$T
 
-$T:	$(OBJS)
+$T:	$(OBJS) $(SOBJS)
 	$(AR) $@ $(OBJS)
 	$(RANLIB) $@
 
 clean:
-	rm -f $(OBJS) $T
+	rm -f $(OBJS) $(SOBJS) $T
 
 co:
 	co -q -f -M $(SRCS)
diff -urNad trunk~/src/lib/Makefile trunk/src/lib/Makefile
--- trunk~/src/lib/Makefile	2007-08-17 11:19:11.000000000 +0200
+++ trunk/src/lib/Makefile	2007-08-17 11:19:12.000000000 +0200
@@ -6,19 +6,21 @@
 
 EXTRA_DEFS= $(POPEN) $(TMPNAM) $(DEGREES) $(LOADLIB)
 
-OBJS= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o lstrlib.o loadlib.o
-SRCS= lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c ltablib.c lstrlib.c loadlib.c
+OBJS= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o lstrlib.o loadlib.o compat-5.1r5/compat-5.1.o
+SRCS= lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c ltablib.c lstrlib.c loadlib.c compat-5.1r5/compat-5.1.c
 
-T= $(LIB)/liblualib.a
+SOBJS := $(patsubst %.o,%.os,$(OBJS))
+
+T= $(LIB)/liblualib50.a
 
 all:	$T
 
-$T:	$(OBJS)
+$T:	$(OBJS) $(SOBJS)
 	$(AR) $@ $(OBJS)
 	$(RANLIB) $@
 
 clean:
-	rm -f $(OBJS) $T
+	rm -f $(OBJS) $(SOBJS) $T
 
 co:
 	co -q -f -M $(SRCS)
diff -urNad trunk~/src/lua/Makefile trunk/src/lua/Makefile
--- trunk~/src/lua/Makefile	2007-08-17 11:19:11.000000000 +0200
+++ trunk/src/lua/Makefile	2007-08-17 11:19:12.000000000 +0200
@@ -12,8 +12,8 @@
 
 all:	$T
 
-$T:	$(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
-	$(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
+$T:	$(OBJS) $(LIB)/liblua50.a $(LIB)/liblualib50.a
+	$(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua50 -llualib50 $(EXTRA_LIBS) $(DLLIB)
 
 $(LIB)/liblua.a:
 	cd ..; $(MAKE)
diff -urNad trunk~/src/luac/Makefile trunk/src/luac/Makefile
--- trunk~/src/luac/Makefile	2007-08-17 11:19:11.000000000 +0200
+++ trunk/src/luac/Makefile	2007-08-17 11:19:12.000000000 +0200
@@ -12,8 +12,8 @@
 
 all:	$T
 
-$T:	$(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
-	$(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
+$T:	$(OBJS) $(LIB)/liblua50.a $(LIB)/liblualib50.a
+	$(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua50 -llualib50 $(EXTRA_LIBS)
 
 # print.c needs opcode names from lopcodes.c
 lopcodes.o:	../lopcodes.c ../lopcodes.h