Accepting request 891994 from home:gmbr3:Lua

goodbye static

OBS-URL: https://build.opensuse.org/request/show/891994
OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=32
This commit is contained in:
Callum Farmer 2021-05-10 09:09:53 +00:00 committed by Git OBS Bridge
parent 8ce8cc4141
commit 26b8c19a09
4 changed files with 39 additions and 18 deletions

View File

@ -4,15 +4,6 @@ Subject: build system
--- 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 @@
# 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
@ -33,7 +24,8 @@ Subject: build system
# 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_EXEC= $(INSTALL) -m 0755
+INSTALL_EXEC= $(LIBTOOL) --mode=install install -m 0755
INSTALL_DATA= $(INSTALL) -m 0644
+INSTALL_LIBTOOL= $(LIBTOOL) --mode=install install -m 0644
#
@ -62,10 +54,10 @@ Subject: build system
install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_LIBTOOL) $(TO_LIB) $(INSTALL_LIB)
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:
@ -132,15 +124,15 @@ Subject: build system
$(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O)
- $(RANLIB) $@
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib -version-info 9:0:4 -o $(LUA_A)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -shared -rpath /usr/lib -version-info 9:0:4 -o $(LUA_A)
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -static $(LUA_A) -Wl,-E lua.lo -o $@
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) $(LUA_A) -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) -static $(LUA_A) luac.lo -o $@
+ $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LUA_A) luac.lo -o $@
test:
- ./$(LUA_T) -v

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon May 10 08:54:04 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Add shared_link.patch: fix dynamic linking executable
- Stop building static library
-------------------------------------------------------------------
Mon Apr 19 09:15:40 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>

View File

@ -44,6 +44,7 @@ Patch3: main_test.patch
# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.4.3
Patch4: upstream-bugs.patch
Patch5: upstream-bugs-test.patch
Patch6: shared_link.patch
%if "%{flavor}" == "test"
BuildRequires: lua54
%else
@ -144,6 +145,7 @@ of C functions, written in ANSI C.
%setup -q -n lua-%{version}
%patch0 -p1
%patch4 -p1
%patch6 -p1
%endif
# manpage
@ -152,19 +154,19 @@ cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_ver
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
export LIBTOOL="libtool --quiet"
make -O -j3 V=1 VERBOSE=1 -C src \
make %{_smp_mflags} VERBOSE=1 -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} \
LIBTOOL="libtool --quiet" \
all
%install
%make_install \
V=%{major_version} \
LIBTOOL="libtool --quiet" \
INSTALL_TOP="%{buildroot}%{_prefix}" \
INSTALL_LIB="%{buildroot}%{_libdir}"
@ -267,7 +269,6 @@ fi
%{_includedir}/lua%{major_version}/lua.hpp
%{_includedir}/lua%{major_version}/luaconf.h
%{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.a
%{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives

22
shared_link.patch Normal file
View File

@ -0,0 +1,22 @@
--- a/src/ldebug.h
+++ b/src/ldebug.h
@@ -36,7 +36,7 @@
#endif
-LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
+LUA_API int luaG_getfuncline (const Proto *f, int pc);
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
StkId *pos);
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
--- a/src/lundump.h
+++ b/src/lundump.h
@@ -30,7 +30,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