Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/lua/, dev-lang/lua/files/
Date: Tue, 29 Dec 2020 19:57:02
Message-Id: 1609271810.0570c40b967f641612469d97bc7627637f888fe8.williamh@gentoo
1 commit: 0570c40b967f641612469d97bc7627637f888fe8
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 29 19:55:15 2020 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 29 19:56:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0570c40b
7
8 dev-lang/lua: 5.1.5-r106 revbump
9
10 - drop static use flag
11 - do not install liblua.{a,la}
12
13 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
14
15 dev-lang/lua/files/lua-5.1.5-make.patch | 97 ++++++++++++++++++++
16 dev-lang/lua/lua-5.1.5-r106.ebuild | 151 ++++++++++++++++++++++++++++++++
17 2 files changed, 248 insertions(+)
18
19 diff --git a/dev-lang/lua/files/lua-5.1.5-make.patch b/dev-lang/lua/files/lua-5.1.5-make.patch
20 new file mode 100644
21 index 00000000000..032652c0a5e
22 --- /dev/null
23 +++ b/dev-lang/lua/files/lua-5.1.5-make.patch
24 @@ -0,0 +1,97 @@
25 +diff -ru lua-5.1.5.orig/Makefile lua-5.1.5/Makefile
26 +--- lua-5.1.5.orig/Makefile 2014-04-15 17:43:34.845435031 +0200
27 ++++ lua-5.1.5/Makefile 2014-04-15 19:05:08.669304987 +0200
28 +@@ -11,7 +11,7 @@
29 + # so take care if INSTALL_TOP is not an absolute path.
30 + INSTALL_TOP= /usr/local
31 + INSTALL_BIN= $(INSTALL_TOP)/bin
32 +-INSTALL_INC= $(INSTALL_TOP)/include
33 ++INSTALL_INC= $(INSTALL_TOP)/include/lua$V
34 + INSTALL_LIB= $(INSTALL_TOP)/lib
35 + INSTALL_MAN= $(INSTALL_TOP)/man/man1
36 + #
37 +@@ -126,3 +126,21 @@
38 + .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
39 +
40 + # (end of Makefile)
41 ++
42 ++# Use libtool for binary installs, etc.
43 ++
44 ++export V
45 ++export LIBTOOL = libtool --quiet --tag=CC
46 ++# See libtool manual about how to set this
47 ++
48 ++gentoo_clean:
49 ++ cd src; $(MAKE) $@
50 ++
51 ++gentoo_test: gentoo_linux
52 ++ test/lua.static test/hello.lua
53 ++
54 ++gentoo_install:
55 ++ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
56 ++ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua$V luac$V $(INSTALL_BIN)
57 ++ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
58 ++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua$V.la $(INSTALL_LIB)
59 +diff -ru lua-5.1.5.orig/src/Makefile lua-5.1.5/src/Makefile
60 +--- lua-5.1.5.orig/src/Makefile 2014-04-15 17:43:34.844435031 +0200
61 ++++ lua-5.1.5/src/Makefile 2014-04-15 18:07:21.427397122 +0200
62 +@@ -29,10 +29,10 @@
63 + LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
64 + lstrlib.o loadlib.o linit.o
65 +
66 +-LUA_T= lua
67 ++LUA_T= lua$V
68 + LUA_O= lua.o
69 +
70 +-LUAC_T= luac
71 ++LUAC_T= luac$V
72 + LUAC_O= luac.o print.o
73 +
74 + ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
75 +@@ -51,10 +51,10 @@
76 + $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
77 + $(RANLIB) $@
78 +
79 +-$(LUA_T): $(LUA_O) $(LUA_A)
80 ++origin$(LUA_T): $(LUA_O) $(LUA_A)
81 + $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
82 +
83 +-$(LUAC_T): $(LUAC_O) $(LUA_A)
84 ++origin$(LUAC_T): $(LUAC_O) $(LUA_A)
85 + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
86 +
87 + clean:
88 +@@ -180,3 +180,33 @@
89 + ltm.h lzio.h lmem.h lopcodes.h lundump.h
90 +
91 + # (end of Makefile)
92 ++
93 ++export LIBTOOL = libtool --tag=CC
94 ++export LIB_VERSION = 5:1:5
95 ++
96 ++# The following rules use libtool for compiling and linking in order to
97 ++# provide shared library support.
98 ++
99 ++LIB_NAME = liblua$V.la
100 ++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
101 ++
102 ++%.lo %.o: %.c
103 ++ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
104 ++
105 ++$(LIB_NAME): $(LIB_OBJS)
106 ++ $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
107 ++ -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
108 ++
109 ++$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
110 ++ $(LIBTOOL) --mode=link $(CC) -static -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
111 ++
112 ++lua_test: $(LUA_O:.o=.lo) $(LIB_NAME)
113 ++ $(LIBTOOL) --mode=link $(CC) -static -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
114 ++
115 ++$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
116 ++ $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
117 ++
118 ++gentoo_clean:
119 ++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua$V luac$V
120 ++
121 ++gentoo_all: $(LIB_NAME) $(LUA_T) lua_test $(LUAC_T)
122
123 diff --git a/dev-lang/lua/lua-5.1.5-r106.ebuild b/dev-lang/lua/lua-5.1.5-r106.ebuild
124 new file mode 100644
125 index 00000000000..7ed88b37032
126 --- /dev/null
127 +++ b/dev-lang/lua/lua-5.1.5-r106.ebuild
128 @@ -0,0 +1,151 @@
129 +# Copyright 1999-2020 Gentoo Authors
130 +# Distributed under the terms of the GNU General Public License v2
131 +
132 +EAPI=7
133 +inherit multilib multilib-minimal portability toolchain-funcs
134 +
135 +DESCRIPTION="A powerful light-weight programming language designed for extending applications"
136 +HOMEPAGE="https://www.lua.org/"
137 +SRC_URI="https://www.lua.org/ftp/${P}.tar.gz"
138 +
139 +LICENSE="MIT"
140 +SLOT="5.1"
141 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
142 +IUSE="+deprecated readline"
143 +
144 +COMMON_DEPEND="
145 + >=app-eselect/eselect-lua-3
146 + readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )
147 + !dev-lang/lua:0"
148 +DEPEND="${COMMON_DEPEND}"
149 +RDEPEND="${COMMON_DEPEND}"
150 +BDEPEND="sys-devel/libtool"
151 +
152 +MULTILIB_WRAPPED_HEADERS=(
153 + /usr/include/lua${SLOT}/luaconf.h
154 +)
155 +
156 +src_prepare() {
157 + PATCHES=(
158 + "${FILESDIR}/lua-5.1.5-make.patch"
159 + "${FILESDIR}/${PN}-$(ver_cut 1-2)-module_paths.patch"
160 + )
161 + if ! use deprecated ; then
162 + # patches from 5.1.4 still apply
163 + PATCHES+=(
164 + "${FILESDIR}"/${PN}-5.1.4-deprecated.patch
165 + "${FILESDIR}"/${PN}-5.1.4-test.patch
166 + )
167 + fi
168 + if ! use readline ; then
169 + PATCHES+=(
170 + "${FILESDIR}"/${PN}-$(ver_cut 1-2)-readline.patch
171 + )
172 + fi
173 +
174 + default
175 +
176 + # use glibtool on Darwin (versus Apple libtool)
177 + if [[ ${CHOST} == *-darwin* ]] ; then
178 + sed -i -e '/LIBTOOL = /s:libtool:glibtool:' \
179 + Makefile src/Makefile || die
180 + fi
181 +
182 + # correct lua versioning
183 + sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:5:1/' src/Makefile
184 +
185 + sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
186 +
187 + # Using dynamic linked lua is not recommended for performance
188 + # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
189 + # Mainly, this is of concern if your arch is poor with GPRs, like x86
190 + # Note that this only affects the interpreter binary (named lua), not the lua
191 + # compiler (built statically) nor the lua libraries.
192 +
193 + # A slotted Lua uses different directories for headers & names for
194 + # libraries, and pkgconfig should reflect that.
195 + sed -r -i \
196 + -e "/^INSTALL_INC=/s,(/include)$,\1/lua${SLOT}," \
197 + -e "/^includedir=/s,(/include)$,\1/lua${SLOT}," \
198 + -e "/^Libs:/s,((-llua)($| )),\2${SLOT}\3," \
199 + "${S}"/etc/lua.pc
200 +
201 + # custom Makefiles
202 + multilib_copy_sources
203 +}
204 +
205 +multilib_src_configure() {
206 + # We want packages to find our things...
207 + sed -i \
208 + -e 's:/usr/local:'${EPREFIX}'/usr:' \
209 + -e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \
210 + etc/lua.pc src/luaconf.h || die
211 +}
212 +
213 +multilib_src_compile() {
214 + tc-export CC
215 + myflags=
216 + # what to link to liblua
217 + liblibs="-lm"
218 + liblibs="${liblibs} $(dlopen_lib)"
219 +
220 + # what to link to the executables
221 + mylibs=
222 + if use readline; then
223 + mylibs="-lreadline"
224 + fi
225 +
226 + cd src
227 + emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${CFLAGS}" \
228 + RPATH="${EPREFIX}/usr/$(get_libdir)/" \
229 + LUA_LIBS="${mylibs}" \
230 + LIB_LIBS="${liblibs}" \
231 + V=$(ver_cut 1-2) \
232 + gentoo_all
233 +
234 + mv lua_test ../test/lua.static
235 +}
236 +
237 +multilib_src_install() {
238 + emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
239 + V=${SLOT} gentoo_install
240 +
241 + insinto /usr/$(get_libdir)/pkgconfig
242 + newins etc/lua.pc lua${SLOT}.pc
243 +}
244 +
245 +multilib_src_install_all() {
246 + DOCS="HISTORY README"
247 + HTML_DOCS="doc/*.html doc/*.png doc/*.css doc/*.gif"
248 + einstalldocs
249 + newman doc/lua.1 lua${SLOT}.1
250 + newman doc/luac.1 luac${SLOT}.1
251 + find "${ED}" -name '*.la' -delete || die
252 + find "${ED}" -name 'liblua*.a' -delete || die
253 +}
254 +
255 +multilib_src_test() {
256 + local positive="bisect cf echo env factorial fib fibfor hello printf sieve
257 + sort trace-calls trace-globals"
258 + local negative="readonly"
259 + local test
260 +
261 + cd "${BUILD_DIR}" || die
262 + for test in ${positive}; do
263 + test/lua.static test/${test}.lua || die "test $test failed"
264 + done
265 +
266 + for test in ${negative}; do
267 + test/lua.static test/${test}.lua && die "test $test failed"
268 + done
269 +}
270 +
271 +pkg_postinst() {
272 + eselect lua set --if-unset "${PN}${SLOT}"
273 +
274 + if has_version "app-editor/emacs"; then
275 + if ! has_version "app-emacs/lua-mode"; then
276 + einfo "Install app-emacs/lua-mode for lua support for emacs"
277 + fi
278 + fi
279 +}