1 |
commit: 8c496e85d925ce7351ff7cbb5366e7870a0bba64 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 30 16:06:53 2020 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 30 16:10:07 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c496e85 |
7 |
|
8 |
dev-lang/lua: 5.4.1-r1 bump to pick up libreadline |
9 |
|
10 |
Closes: https://bugs.gentoo.org/755557 |
11 |
Signed-off-by: William Hubbs <williamh <AT> gentoo.org> |
12 |
|
13 |
dev-lang/lua/lua-5.4.1-r1.ebuild | 197 +++++++++++++++++++++++++++++++++++++++ |
14 |
1 file changed, 197 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/lua/lua-5.4.1-r1.ebuild b/dev-lang/lua/lua-5.4.1-r1.ebuild |
17 |
new file mode 100644 |
18 |
index 00000000000..7f79fce709c |
19 |
--- /dev/null |
20 |
+++ b/dev-lang/lua/lua-5.4.1-r1.ebuild |
21 |
@@ -0,0 +1,197 @@ |
22 |
+# Copyright 1999-2020 Gentoo Authors |
23 |
+# Distributed under the terms of the GNU General Public License v2 |
24 |
+ |
25 |
+EAPI=7 |
26 |
+inherit autotools multilib multilib-minimal portability toolchain-funcs |
27 |
+ |
28 |
+DESCRIPTION="A powerful light-weight programming language designed for extending applications" |
29 |
+HOMEPAGE="http://www.lua.org/" |
30 |
+TEST_PV="5.4.1" |
31 |
+TEST_P="${PN}-${TEST_PV}-tests" |
32 |
+SRC_URI=" |
33 |
+ http://www.lua.org/ftp/${P}.tar.gz |
34 |
+ test? ( https://www.lua.org/tests/${TEST_P}.tar.gz )" |
35 |
+ |
36 |
+LICENSE="MIT" |
37 |
+SLOT="5.4" |
38 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
39 |
+IUSE="+deprecated readline static test test-complete" |
40 |
+ |
41 |
+COMMON_DEPEND=" |
42 |
+ app-eselect/eselect-lua |
43 |
+ readline? ( sys-libs/readline:0= ) |
44 |
+ !dev-lang/lua:0" |
45 |
+DEPEND="${COMMON_DEPEND}" |
46 |
+RDEPEND="${COMMON_DEPEND}" |
47 |
+BDEPEND="sys-devel/libtool" |
48 |
+ |
49 |
+RESTRICT="!test? ( test )" |
50 |
+ |
51 |
+MULTILIB_WRAPPED_HEADERS=( |
52 |
+ /usr/include/lua${SLOT}/luaconf.h |
53 |
+) |
54 |
+ |
55 |
+PATCHES=( |
56 |
+ "${FILESDIR}"/lua-5.4-makefiles.patch |
57 |
+) |
58 |
+ |
59 |
+src_prepare() { |
60 |
+ default |
61 |
+ # use glibtool on Darwin (versus Apple libtool) |
62 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
63 |
+ sed -i -e '/LIBTOOL = /s:/libtool:/glibtool:' \ |
64 |
+ Makefile src/Makefile || die |
65 |
+ fi |
66 |
+ |
67 |
+ # correct lua versioning |
68 |
+ sed -i -e 's/\(LIB_VERSION = \)6:1:1/\10:0:0/' src/Makefile || die |
69 |
+ |
70 |
+ sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html || die |
71 |
+ |
72 |
+ # Using dynamic linked lua is not recommended for performance |
73 |
+ # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519 |
74 |
+ # Mainly, this is of concern if your arch is poor with GPRs, like x86 |
75 |
+ # Note that this only affects the interpreter binary (named lua), not the lua |
76 |
+ # compiler (built statically) nor the lua libraries (both shared and static |
77 |
+ # are installed) |
78 |
+ if use static ; then |
79 |
+ sed -i -e 's:\(-export-dynamic\):-static \1:' src/Makefile || die |
80 |
+ fi |
81 |
+ |
82 |
+ # upstream does not use libtool, but we do (see bug #336167) |
83 |
+ cp "${FILESDIR}/configure.in" "${S}/configure.ac" || die |
84 |
+ eautoreconf |
85 |
+ |
86 |
+ # custom Makefiles |
87 |
+ multilib_copy_sources |
88 |
+} |
89 |
+ |
90 |
+multilib_src_configure() { |
91 |
+ sed -i \ |
92 |
+ -e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \ |
93 |
+ -e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \ |
94 |
+ src/luaconf.h \ |
95 |
+ || die "failed patching luaconf.h" |
96 |
+ |
97 |
+ econf |
98 |
+} |
99 |
+ |
100 |
+multilib_src_compile() { |
101 |
+ tc-export CC |
102 |
+ |
103 |
+ # what to link to liblua |
104 |
+ liblibs="-lm" |
105 |
+ liblibs="${liblibs} $(dlopen_lib)" |
106 |
+ |
107 |
+ # what to link to the executables |
108 |
+ mylibs= |
109 |
+ use readline && mylibs="-lreadline" |
110 |
+ |
111 |
+ cd src |
112 |
+ |
113 |
+ local myCFLAGS="" |
114 |
+ use deprecated && myCFLAGS="-DLUA_COMPAT_5_3" |
115 |
+ use readline && myCFLAGS="-DLUA_USE_READLINE" |
116 |
+ |
117 |
+ case "${CHOST}" in |
118 |
+ *-mingw*) : ;; |
119 |
+ *) myCFLAGS+=" -DLUA_USE_LINUX" ;; |
120 |
+ esac |
121 |
+ |
122 |
+ emake CC="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \ |
123 |
+ SYSLDFLAGS="${LDFLAGS}" \ |
124 |
+ RPATH="${EPREFIX}/usr/$(get_libdir)/" \ |
125 |
+ LUA_LIBS="${mylibs}" \ |
126 |
+ LIB_LIBS="${liblibs}" \ |
127 |
+ V=$(ver_cut 1-2) \ |
128 |
+ gentoo_all |
129 |
+} |
130 |
+ |
131 |
+multilib_src_install() { |
132 |
+ emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \ |
133 |
+ V=${SLOT} gentoo_install |
134 |
+ |
135 |
+ case $SLOT in |
136 |
+ 0) |
137 |
+ LIBNAME="lua" |
138 |
+ INCLUDEDIR_SUFFIX='' |
139 |
+ ;; |
140 |
+ *) LIBNAME="lua${SLOT}" |
141 |
+ INCLUDEDIR_SUFFIX="/lua${SLOT}" |
142 |
+ ;; |
143 |
+ esac |
144 |
+ |
145 |
+ # We want packages to find our things... |
146 |
+ # A slotted Lua uses different directories for headers & names for |
147 |
+ # libraries, and pkgconfig should reflect that. |
148 |
+ local PATCH_PV=$(ver_cut 1-2) |
149 |
+ cp "${FILESDIR}/lua.pc" "${WORKDIR}" || die |
150 |
+ sed -r -i \ |
151 |
+ -e "/^INSTALL_INC=/s,(/include)$,\1/lua${SLOT}," \ |
152 |
+ -e "s:^prefix= :prefix= ${EPREFIX}:" \ |
153 |
+ -e "s:^V=.*:V= ${PATCH_PV}:" \ |
154 |
+ -e "s:^R=.*:R= ${PV}:" \ |
155 |
+ -e "s:/,lib,:/$(get_libdir):g" \ |
156 |
+ -e "/^Libs:/s:( )(-llua)($| ):\1-l${LIBNAME}\3:" \ |
157 |
+ -e "/^includedir=/s:include$:include${INCLUDEDIR_SUFFIX}:" \ |
158 |
+ "${WORKDIR}/lua.pc" || die |
159 |
+ |
160 |
+ insinto "/usr/$(get_libdir)/pkgconfig" |
161 |
+ newins "${WORKDIR}/lua.pc" "lua${SLOT}.pc" |
162 |
+ # Copy Debian's symlink support: |
163 |
+ # https://salsa.debian.org/lua-team/lua5.3/blob/master/debian/rules#L19 |
164 |
+ # FreeBSD calls the pkgconfig 'lua-5.3.pc' |
165 |
+ # Older systems called it 'lua53.pc' |
166 |
+ dosym "lua${SLOT}.pc" "/usr/$(get_libdir)/pkgconfig/lua-${SLOT}.pc" |
167 |
+ dosym "lua${SLOT}.pc" "/usr/$(get_libdir)/pkgconfig/lua${SLOT/.}.pc" |
168 |
+} |
169 |
+ |
170 |
+multilib_src_install_all() { |
171 |
+ DOCS="README" |
172 |
+ HTML_DOCS="doc/*.html doc/*.png doc/*.css doc/*.gif" |
173 |
+ einstalldocs |
174 |
+ newman doc/lua.1 lua${SLOT}.1 |
175 |
+ newman doc/luac.1 luac${SLOT}.1 |
176 |
+} |
177 |
+ |
178 |
+# Makefile contains a dummy target that doesn't do tests |
179 |
+# but causes issues with slotted lua (bug #510360) |
180 |
+src_test() { |
181 |
+ debug-print-function ${FUNCNAME} "$@" |
182 |
+ cd "${WORKDIR}/lua-${TEST_PV}-tests" || die |
183 |
+ # https://www.lua.org/tests/ |
184 |
+ # There are two sets: |
185 |
+ # basic |
186 |
+ # complete. |
187 |
+ # |
188 |
+ # The basic subset is selected by passing -e'_U=true' |
189 |
+ # The complete set is noted to contain tests that may consume too much memory or have non-portable tests. |
190 |
+ # attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI) |
191 |
+ TEST_OPTS="$(usex test-complete '' '-e_U=true')" |
192 |
+ TEST_MARKER="${T}/test.failed" |
193 |
+ rm -f "${TEST_MARKER}" |
194 |
+ |
195 |
+ # If we are failing, set the marker file, and only check it after done all ABIs |
196 |
+ abi_src_test() { |
197 |
+ debug-print-function ${FUNCNAME} "$@" |
198 |
+ TEST_LOG="${T}/test.${MULTIBUILD_ID}.log" |
199 |
+ eval "${BUILD_DIR}"/src/lua${SLOT} ${TEST_OPTS} all.lua 2>&1 | tee "${TEST_LOG}" || die |
200 |
+ grep -sq -e "final OK" "${TEST_LOG}" || echo "FAIL ${MULTIBUILD_ID}" >>"${TEST_MARKER}" |
201 |
+ return 0 |
202 |
+ } |
203 |
+ |
204 |
+ multilib_foreach_abi abi_src_test |
205 |
+ |
206 |
+ if [ -e "${TEST_MARKER}" ]; then |
207 |
+ cat "${TEST_MARKER}" |
208 |
+ die "Tests failed" |
209 |
+ fi |
210 |
+} |
211 |
+ |
212 |
+pkg_postinst() { |
213 |
+ if has_version "app-editor/emacs"; then |
214 |
+ if ! has_version "app-emacs/emacs-mode"; then |
215 |
+ einfo "Install app-emacs/lua-mode for lua support for emacs" |
216 |
+ fi |
217 |
+ fi |
218 |
+} |