Tomáš Chvátal 2017-07-10 11:03:59 +00:00 committed by Git OBS Bridge
parent 0b47406e81
commit 884fd3fe71
2 changed files with 120 additions and 72 deletions

View File

@ -7,10 +7,10 @@ Subject: build system
src/Makefile | 31 +++++++++++++++++++------------ src/Makefile | 31 +++++++++++++++++++------------
2 files changed, 33 insertions(+), 23 deletions(-) 2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile Index: lua-5.3.4/Makefile
index c795dd7..87cdddc 100644 ===================================================================
--- a/Makefile --- lua-5.3.4.orig/Makefile
+++ b/Makefile +++ lua-5.3.4/Makefile
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
# Makefile for installing Lua # Makefile for installing Lua
# See doc/readme.html for installation and customization instructions. # See doc/readme.html for installation and customization instructions.
@ -25,17 +25,17 @@ index c795dd7..87cdddc 100644
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
-INSTALL_TOP= /usr/local -INSTALL_TOP= /usr/local
+INSTALL_TOP= $(shell pwd)/debian/tmp/usr +INSTALL_TOP= /usr
INSTALL_BIN= $(INSTALL_TOP)/bin INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_INC= $(INSTALL_TOP)/include
-INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1 -INSTALL_MAN= $(INSTALL_TOP)/man/man1
+INSTALL_INC= $(INSTALL_TOP)/include/lua5.3/ +INSTALL_INC= $(INSTALL_TOP)/include/lua$(V)/
+INSTALL_LIB= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/ +INSTALL_LIB= $(INSTALL_TOP)/lib/
+INSTALL_MAN= $(INSTALL_TOP)/share/man/man1 +INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+INSTALL_CMOD= $(INSTALL_TOP)/lib/$(DEB_HOST_MULTIARCH)/lua/$V +INSTALL_CMOD= $(INSTALL_LIB)/lua/$V
# How to install. If your install program does not support "-p", then # How to install. If your install program does not support "-p", then
# you may have to run ranlib on the installed liblua.a. # you may have to run ranlib on the installed liblua.a.
@ -55,12 +55,12 @@ index c795dd7..87cdddc 100644
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a -TO_LIB= liblua.a
-TO_MAN= lua.1 luac.1 -TO_MAN= lua.1 luac.1
+TO_LIB= liblua$(V).la liblua$(V)-c++.la +TO_LIB= liblua$(V).la
+TO_MAN= lua$(V).1 luac$(V).1 +TO_MAN= lua$(V).1 luac$(V).1
# Lua version and release. # Lua version and release.
V= 5.3 V= 5.3
@@ -52,16 +55,16 @@ R= $V.3 @@ -52,16 +55,16 @@ R= $V.4
all: $(PLAT) all: $(PLAT)
$(PLATS) clean: $(PLATS) clean:
@ -80,50 +80,42 @@ index c795dd7..87cdddc 100644
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
uninstall: uninstall:
diff --git a/src/Makefile b/src/Makefile Index: lua-5.3.4/src/Makefile
index d71c75c..3123942 100644 ===================================================================
--- a/src/Makefile --- lua-5.3.4.orig/src/Makefile
+++ b/src/Makefile +++ lua-5.3.4/src/Makefile
@@ -6,8 +6,10 @@ @@ -7,7 +7,7 @@
# Your platform. See PLATS for possible values.
PLAT= none PLAT= none
-CC= gcc -std=gnu99 CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -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) +CFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CXXFLAGS= -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCXXFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS) LIBS= -lm $(SYSLIBS) $(MYLIBS)
@@ -19,16 +21,21 @@ SYSCFLAGS= @@ -20,15 +20,19 @@ SYSLDFLAGS=
SYSLDFLAGS=
SYSLIBS= SYSLIBS=
-MYCFLAGS= MYCFLAGS=
-MYLDFLAGS= +MYCXXFLAGS=
MYLDFLAGS=
-MYLIBS= -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 +MYLIBS=-ldl
MYOBJS= MYOBJS=
+%.o : %.c +%.o : %.c
+ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@ + $(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 ======= # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a -LUA_A= liblua.a
+LUA_A= liblua$(V).la liblua$(V)-c++.la +LUA_A= liblua$(V).la
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ 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 \ lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.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 \ @@ -36,10 +40,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc
lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
@ -136,22 +128,21 @@ index d71c75c..3123942 100644
LUAC_O= luac.o LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
@@ -56,14 +63,14 @@ o: $(ALL_O) @@ -56,14 +60,13 @@ o: $(ALL_O)
a: $(ALL_A) a: $(ALL_A)
$(LUA_A): $(BASE_O) $(LUA_A): $(BASE_O)
- $(AR) $@ $(BASE_O) - $(AR) $@ $(BASE_O)
- $(RANLIB) $@ - $(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=CC $(CC) $(LDFLAGS) -lm -ldl $(BASE_O:.o=.lo) -rpath /usr/lib -version-info 8:0:3 -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) $(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - $(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 $@ + $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LIBS) -static liblua$(V).la -Wl,-E lua.lo -o $@
$(LUAC_T): $(LUAC_O) $(LUA_A) $(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - $(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 $@ + $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -static liblua$(V).la luac.lo -o $@
clean: clean:
$(RM) $(ALL_T) $(ALL_O) $(RM) $(ALL_T) $(ALL_O)

View File

@ -1,5 +1,5 @@
# #
# spec file for package lua # spec file for package lua53
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# #
@ -17,8 +17,8 @@
%define major_version 5.3 %define major_version 5.3
%define libname liblua5_3 %define libname liblua5_3-5
Name: lua Name: lua53
Version: 5.3.4 Version: 5.3.4
Release: 0 Release: 0
Summary: Small Embeddable Language with Procedural Syntax Summary: Small Embeddable Language with Procedural Syntax
@ -30,8 +30,10 @@ Source1: macros.lua
Source2: baselibs.conf Source2: baselibs.conf
# PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE # PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
Patch0: lua-build-system.patch Patch0: lua-build-system.patch
BuildRequires: pkg-config BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: readline-devel BuildRequires: readline-devel
Provides: lua = %{version}
Provides: Lua(API) = %{major_version} Provides: Lua(API) = %{major_version}
%description %description
@ -49,10 +51,10 @@ of C functions, written in ANSI C.
%package devel %package devel
Summary: Development files for lua Summary: Development files for lua
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: %{name} = %{version} Requires: %{name} = %{version}
Requires: %libname = %{version} Provides: lua-devel = %{version}
Provides: Lua(devel) = %{major_version} Provides: Lua(devel) = %{major_version}
Conflicts: otherproviders(Lua(devel))
%description devel %description devel
Lua is a programming language originally designed for extending Lua is a programming language originally designed for extending
@ -62,13 +64,13 @@ stand-alone language.
This package contains files needed for embedding lua into your This package contains files needed for embedding lua into your
application. application.
%package -n %libname %package -n %{libname}
Summary: The Lua integration library Summary: The Lua integration library
Group: System/Libraries Group: System/Libraries
Provides: %{name}-libs = %{version} Provides: %{name}-libs = %{version}
Obsoletes: %{name}-libs < %{version} Obsoletes: %{name}-libs < %{version}
%description -n %libname %description -n %{libname}
Lua is a programming language originally designed for extending Lua is a programming language originally designed for extending
applications, but is also frequently used as a general-purpose, applications, but is also frequently used as a general-purpose,
stand-alone language. stand-alone language.
@ -98,51 +100,97 @@ scripting, and rapid prototyping. Lua is implemented as a small library
of C functions, written in ANSI C. of C functions, written in ANSI C.
%prep %prep
%setup -q %setup -q -n lua-%{version}
%autopatch -p1 %autopatch -p1
# manpage
cat doc/lua.1 | sed 's/TH LUA 1/TH LUA5.3 1/' > doc/lua5.3.1
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC5.3 1/' > doc/luac5.3.1
%build %build
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
export LIBTOOL="libtool --quiet"
make %{?_smp_mflags} -C src \ make %{?_smp_mflags} -C src \
CC="cc" \ CC="cc" \
MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \ MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_USE_LINUX -DLUA_COMPAT_MODULE" \
MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \ MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" \
V=%{major_version} V=%{major_version} \
all all
%install %install
make install \ make install \
V=%{major_version} \
INSTALL_TOP="%{buildroot}%{_prefix}" \ INSTALL_TOP="%{buildroot}%{_prefix}" \
INSTALL_LIB="%{buildroot}%{_libdir}" \ 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 install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua
find %{buildroot} -type f -name "*.la" -delete -print
# create pkg-config file # create pkg-config file
cat > lua.pc <<-EOF cat > lua%{major_version}.pc <<-EOF
prefix=%{_prefix} prefix=%{_prefix}
exec_prefix=%{_prefix} exec_prefix=%{_prefix}
libdir=%{_libdir} libdir=%{_libdir}
includedir=%{_prefix}}/include includedir=%{_prefix}}/include%{major_version}
Name: Lua Name: Lua %{major_version}
Description: An Extensible Extension Language Description: An Extensible Extension Language
Version: %{version} Version: %{version}
Libs: -llua -lm Libs: -llua%{major_version} -lm
Cflags: Cflags:
EOF EOF
install -D -m 644 lua.pc %{buildroot}/%{_libdir}/pkgconfig/lua.pc install -D -m 644 lua%{major_version}.pc %{buildroot}/%{_libdir}/pkgconfig/lua%{major_version}.pc
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for file in lua luac ; do
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}"
ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}"
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}"
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}"
done
# Compat link with older unprefixed library and with soname 0 from deb/etc
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.%{major_version}
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.0
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version}
# Library devel alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/liblua.so
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
%check %check
cd src cd src
LD_LIBRARY_PATH=`pwd` ./lua -e 'print(0)' > /dev/null LD_LIBRARY_PATH=`pwd` ./lua%{major_version} -e 'print(0)' > /dev/null
%post -n %libname -p /sbin/ldconfig %post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%postun -n %libname -p /sbin/ldconfig %post
%{_sbindir}/update-alternatives --install \
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 53 \
--slave %{_bindir}/luac luac %{_bindir}/luac%{major_version} \
--slave %{_mandir}/man1/lua.1%{ext_man} lua.1%{ext_man} %{_mandir}/man1/lua%{major_version}.1%{ext_man} \
--slave %{_mandir}/man1/luac.1%{ext_man} luac.1%{ext_man} %{_mandir}/man1/luac%{major_version}.1%{ext_man}
%postun
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
fi
%post devel
%{_sbindir}/update-alternatives --install \
%{_libdir}/liblua.so liblua.so %{_libdir}/liblua%{major_version}.so 53 \
--slave %{_libdir}/pkgconfig/lua.pc lua.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
%postun devel
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove liblua.so %{_libdir}/liblua%{major_version}.so
fi
%files %files
%defattr(-,root,root)
%doc README %doc README
%dir %{_libdir}/lua %dir %{_libdir}/lua
%dir %{_libdir}/lua/%{major_version} %dir %{_libdir}/lua/%{major_version}
@ -150,31 +198,40 @@ LD_LIBRARY_PATH=`pwd` ./lua -e 'print(0)' > /dev/null
%dir %{_datadir}/lua/%{major_version} %dir %{_datadir}/lua/%{major_version}
%{_bindir}/lua%{major_version} %{_bindir}/lua%{major_version}
%{_bindir}/luac%{major_version} %{_bindir}/luac%{major_version}
%{_mandir}/man1/lua%{major_version}.1.gz %{_mandir}/man1/lua%{major_version}.1%{ext_man}
%{_mandir}/man1/luac%{major_version}.1.gz %{_mandir}/man1/luac%{major_version}.1%{ext_man}
# alternatives
%{_bindir}/lua
%{_bindir}/luac
%{_mandir}/man1/lua.1%{ext_man}
%{_mandir}/man1/luac.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/lua %ghost %{_sysconfdir}/alternatives/lua
%ghost %{_sysconfdir}/alternatives/luac %ghost %{_sysconfdir}/alternatives/luac
%ghost %{_sysconfdir}/alternatives/lua.1.gz %ghost %{_sysconfdir}/alternatives/lua.1%{ext_man}
%ghost %{_sysconfdir}/alternatives/luac.1.gz %ghost %{_sysconfdir}/alternatives/luac.1%{ext_man}
%files -n %libname %files -n %{libname}
%defattr(-,root,root) %{_libdir}/liblua%{major_version}.so.*
%{_libdir}/liblua.so.%{major_version} %{_libdir}/liblua.so.*
%files devel %files devel
%defattr(-,root,root)
%config %{_sysconfdir}/rpm/macros.lua %config %{_sysconfdir}/rpm/macros.lua
%{_includedir}/lauxlib.h %dir %{_includedir}/lua%{major_version}
%{_includedir}/lua.h %{_includedir}/lua%{major_version}/lauxlib.h
%{_includedir}/lua.hpp %{_includedir}/lua%{major_version}/lua.h
%{_includedir}/luaconf.h %{_includedir}/lua%{major_version}/lua.hpp
%{_includedir}/lualib.h %{_includedir}/lua%{major_version}/luaconf.h
%{_libdir}/liblua.a %{_includedir}/lua%{major_version}/lualib.h
%{_libdir}/liblua%{major_version}.a
%{_libdir}/liblua%{major_version}.so
%{_libdir}/pkgconfig/lua%{major_version}.pc
# alternatives
%{_libdir}/liblua.so %{_libdir}/liblua.so
%{_libdir}/pkgconfig/lua.pc %{_libdir}/pkgconfig/lua.pc
%ghost %{_sysconfdir}/alternatives/liblua.so
%ghost %{_sysconfdir}/alternatives/lua.pc
%files doc %files doc
%defattr(-,root,root)
%doc doc/* %doc doc/*
%changelog %changelog