- Add patch lua-build-system.patch for all the builsystem changes

- Drop patches merged to the above:
  * lua-5.3.3-prefix.patch
  * lua-5.3.3-shared.patch
- Drop not really needed lua-5.3.3-visible.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua53?expand=0&rev=5
This commit is contained in:
Tomáš Chvátal 2017-07-07 13:41:38 +00:00 committed by Git OBS Bridge
parent 9cb944279a
commit 0b47406e81
6 changed files with 184 additions and 178 deletions

View File

@ -1,13 +0,0 @@
Index: lua-5.3.3/src/luaconf.h
===================================================================
--- lua-5.3.3.orig/src/luaconf.h
+++ lua-5.3.3/src/luaconf.h
@@ -188,7 +188,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \

View File

@ -1,73 +0,0 @@
Index: lua-5.3.3/Makefile
===================================================================
--- lua-5.3.3.orig/Makefile
+++ lua-5.3.3/Makefile
@@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so.$V
TO_MAN= lua.1 luac.1
# Lua version and release.
@@ -61,6 +61,7 @@ install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ ln -s liblua.so.$V $(INSTALL_LIB)/liblua.so
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
Index: lua-5.3.3/src/Makefile
===================================================================
--- lua-5.3.3.orig/src/Makefile
+++ lua-5.3.3/src/Makefile
@@ -29,6 +29,7 @@ MYOBJS=
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -43,7 +44,7 @@ LUAC_T= luac
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_SO) $(LUA_A) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
# Targets start here.
@@ -55,21 +56,26 @@ o: $(ALL_O)
a: $(ALL_A)
+# shared libraries (for linux)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) $(MYCFLAGS) -o $(LUA_SO).$V -shared -Wl,-soname,$(LUA_SO).$V $(CORE_O) $(LIB_O) -lm -ldl
+ ln -sf $(LUA_SO).$V $(LUA_SO)
+
$(LUA_A): $(BASE_O)
$(AR) $@ $(BASE_O)
$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(CC) $(MYCFLAGS) -o $@ $(MYLDFLAGS) $(LUA_O) -L. -llua $(LIBS)
-$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+$(LUAC_T): $(LUAC_O) $(LUA_SO)
+ $(CC) $(MYCFLAGS) -o $@ $(MYLDFLAGS) $(LUAC_O) -L. -llua $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
depend:
- @$(CC) $(CFLAGS) -MM l*.c
+ @$(CC) $(MYCFLAGS) -MM l*.c
echo:
@echo "PLAT= $(PLAT)"

View File

@ -1,35 +0,0 @@
Index: lua-5.3.3/src/lopcodes.h
===================================================================
--- lua-5.3.3.orig/src/lopcodes.h
+++ lua-5.3.3/src/lopcodes.h
@@ -276,7 +276,7 @@ enum OpArgMask {
OpArgK /* argument is a constant or register/constant */
};
-LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
+LUA_API const lu_byte luaP_opmodes[NUM_OPCODES];
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
@@ -285,7 +285,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
-LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
+LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
/* number of list items to accumulate before a SETLIST instruction */
Index: lua-5.3.3/src/lundump.h
===================================================================
--- lua-5.3.3.orig/src/lundump.h
+++ lua-5.3.3/src/lundump.h
@@ -26,7 +26,7 @@
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
/* dump one chunk; from ldump.c */
-LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
void* data, int strip);
#endif

157
lua-build-system.patch Normal file
View File

@ -0,0 +1,157 @@
From: Enrico Tassi <gareuselesinge@debian.org>
Date: Sun, 1 Mar 2015 16:13:52 +0100
Subject: build system
---
Makefile | 25 ++++++++++++++-----------
src/Makefile | 31 +++++++++++++++++++------------
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
index c795dd7..87cdddc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
# Makefile for installing Lua
# See doc/readme.html for installation and customization instructions.
+export LIBTOOL=libtool --quiet
+
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
# Your platform. See PLATS for possible values.
@@ -10,19 +12,20 @@ PLAT= none
# so take care if INSTALL_TOP is not an absolute path. See the local target.
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
-INSTALL_TOP= /usr/local
+INSTALL_TOP= $(shell pwd)/debian/tmp/usr
INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include
-INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
+INSTALL_INC= $(INSTALL_TOP)/include/lua5.3/
+INSTALL_LIB= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/
+INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+INSTALL_CMOD= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/lua/$V
# How to install. If your install program does not support "-p", then
# you may have to run ranlib on the installed liblua.a.
INSTALL= install -p
INSTALL_EXEC= $(INSTALL) -m 0755
INSTALL_DATA= $(INSTALL) -m 0644
+INSTALL_LIBTOOL= $(LIBTOOL) --mode=install install -m 0644
#
# If you don't have "install" you can use "cp" instead.
# INSTALL= cp -p
@@ -39,10 +42,10 @@ RM= rm -f
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
# What to install.
-TO_BIN= lua luac
+TO_BIN= lua$(V) luac$(V)
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
-TO_MAN= lua.1 luac.1
+TO_LIB= liblua$(V).la liblua$(V)-c++.la
+TO_MAN= lua$(V).1 luac$(V).1
# Lua version and release.
V= 5.3
@@ -52,16 +55,16 @@ R= $V.3
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V)
test: dummy
- src/lua -v
+ $(LIBTOOL) --mode=execute -dlopen src/liblua$(V).la src/lua$(V) -v
install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd src && $(INSTALL_LIBTOOL) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
uninstall:
diff --git a/src/Makefile b/src/Makefile
index d71c75c..3123942 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -6,8 +6,10 @@
# Your platform. See PLATS for possible values.
PLAT= none
-CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CC= $(CCACHE)gcc -std=gnu99
+CXX= $(CCACHE)g++
+CFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CXXFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCXXFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
@@ -19,16 +21,21 @@ SYSCFLAGS=
SYSLDFLAGS=
SYSLIBS=
-MYCFLAGS=
-MYLDFLAGS=
-MYLIBS=
+MYCFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
+MYCXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
+MYLDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
+MYLIBS=-ldl
MYOBJS=
+%.o : %.c
+ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@
+ $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CFLAGS) -c $< -o $*-c++.o
+
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua$(V).la liblua$(V)-c++.la
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -36,10 +43,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \
lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
-LUA_T= lua
+LUA_T= lua$(V)
LUA_O= lua.o
-LUAC_T= luac
+LUAC_T= luac$(V)
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
@@ -56,14 +63,14 @@ o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V).la
+ $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(LDFLAGS) -lm -ldl $(BASE_O:.o=-c++.lo) -rpath /usr/lib/$(DEB_HOST_MULTIARCH) -version-info 0:0:0 -Wl,--version-script,../debian/version-script -o liblua$(V)-c++.la
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -Wl,--version-script,../debian/version-script -static liblua$(V).la -Wl,-E lua.lo -o $@
$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -Wl,--version-script,../debian/version-script -static liblua$(V).la luac.lo -o $@
clean:
$(RM) $(ALL_T) $(ALL_O)

View File

@ -1,11 +1,12 @@
-------------------------------------------------------------------
Fri Jul 7 13:15:43 UTC 2017 - tchvatal@suse.com
Fri Jul 7 13:31:06 UTC 2017 - tchvatal@suse.com
- Add patch lua-build-system.patch for all the builsystem changes
- Drop patches merged to the above:
* lua-5.3.3-prefix.patch
* lua-5.3.3-shared.patch
- Drop not really needed lua-5.3.3-visible.patch
- Version update to lua 5.3.4 containing various bugfixes
-------------------------------------------------------------------
Fri Jul 7 13:15:06 UTC 2017 - tchvatal@suse.com
- Rename to lua53
-------------------------------------------------------------------

View File

@ -17,7 +17,7 @@
%define major_version 5.3
%define libsuf 5_3
%define libname liblua5_3
Name: lua
Version: 5.3.4
Release: 0
@ -28,21 +28,11 @@ Url: http://www.lua.org
Source: http://www.lua.org/ftp/lua-%{version}.tar.gz
Source1: macros.lua
Source2: baselibs.conf
# PATCH-FIX-UPSTREAM change prefix to /usr/
Patch: lua-5.3.3-prefix.patch
# PATCH-FIX-UPSTREAM shared library support
Patch1: lua-5.3.3-shared.patch
# PATCH-FIX-UPSTREAM make luaU_dump, luaP_opmodes and luaP_opnames visible
# to luac
Patch2: lua-5.3.3-visible.patch
# PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
Patch0: lua-build-system.patch
BuildRequires: pkg-config
BuildRequires: readline-devel
BuildRequires: update-alternatives
Requires(pre): update-alternatives
# As other packages install files into /usr/share/lua/lua_version, they ought to require lua = lua_version (which is only major_version)
# in order to facilitate this, we provide the corresponding symbol here.
Provides: Lua(API) = %{major_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Lua is a programming language originally designed for extending
@ -60,7 +50,7 @@ of C functions, written in ANSI C.
Summary: Development files for lua
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: liblua%{libsuf} = %{version}
Requires: %libname = %{version}
Provides: Lua(devel) = %{major_version}
Conflicts: otherproviders(Lua(devel))
@ -72,13 +62,13 @@ stand-alone language.
This package contains files needed for embedding lua into your
application.
%package -n liblua%{libsuf}
%package -n %libname
Summary: The Lua integration library
Group: System/Libraries
Provides: %{name}-libs = %{version}
Obsoletes: %{name}-libs < %{version}
%description -n liblua%{libsuf}
%description -n %libname
Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose,
stand-alone language.
@ -93,9 +83,7 @@ of C functions, written in ANSI C.
%package doc
Summary: Documentation for Lua, a small embeddable language
Group: Documentation/HTML
%if 0%{?suse_version} >= 1120
BuildArch: noarch
%endif
%description doc
Lua is a programming language originally designed for extending
@ -111,26 +99,23 @@ of C functions, written in ANSI C.
%prep
%setup -q
%patch -p1
%patch1 -p1
%patch2 -p1
%autopatch -p1
%build
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
make %{?_smp_mflags} -C src CC="gcc" MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" V=%{major_version} all
make %{?_smp_mflags} -C src \
CC="cc" \
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \
MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \
V=%{major_version}
all
%install
make install INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1"
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for file in lua luac ; do
mv "%{buildroot}%{_bindir}/${file}" "%{buildroot}%{_bindir}/${file}%{major_version}"
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}"
ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}"
mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1"
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1.gz"
ln -sf "%{_sysconfdir}/alternatives/${file}.1.gz" "%{buildroot}%{_mandir}/man1/${file}.1.gz"
done
make install \
INSTALL_TOP="%{buildroot}%{_prefix}" \
INSTALL_LIB="%{buildroot}%{_libdir}" \
INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} \
INSTALL_MAN="%{buildroot}%{_mandir}/man1"
install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua
# create pkg-config file
@ -152,21 +137,9 @@ install -D -m 644 lua.pc %{buildroot}/%{_libdir}/pkgconfig/lua.pc
cd src
LD_LIBRARY_PATH=`pwd` ./lua -e 'print(0)' > /dev/null
%post
%{_sbindir}/update-alternatives --install \
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 15 \
--slave %{_bindir}/luac luac %{_bindir}/luac%{major_version} \
--slave %{_mandir}/man1/lua.1.gz lua.1.gz %{_mandir}/man1/lua%{major_version}.1.gz \
--slave %{_mandir}/man1/luac.1.gz luac.1.gz %{_mandir}/man1/luac%{major_version}.1.gz
%post -n %libname -p /sbin/ldconfig
%preun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
fi
%post -n liblua%{libsuf} -p /sbin/ldconfig
%postun -n liblua%{libsuf} -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig
%files
%defattr(-,root,root)
@ -179,16 +152,12 @@ fi
%{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1.gz
%{_mandir}/man1/luac%{major_version}.1.gz
%{_bindir}/lua
%{_bindir}/luac
%{_mandir}/man1/lua.1.gz
%{_mandir}/man1/luac.1.gz
%ghost %{_sysconfdir}/alternatives/lua
%ghost %{_sysconfdir}/alternatives/luac
%ghost %{_sysconfdir}/alternatives/lua.1.gz
%ghost %{_sysconfdir}/alternatives/luac.1.gz
%files -n liblua%{libsuf}
%files -n %libname
%defattr(-,root,root)
%{_libdir}/liblua.so.%{major_version}