1 |
commit: 09d28b07895b698e36a979997af546b7ba1a5470 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 29 20:22:20 2020 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 29 20:24:20 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09d28b07 |
7 |
|
8 |
dev-lang/lua: 5.4.2-r1 bump |
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.2-r1.ebuild | 197 +++++++++++++++++++++++++++++++++++++++ |
14 |
1 file changed, 197 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/lua/lua-5.4.2-r1.ebuild b/dev-lang/lua/lua-5.4.2-r1.ebuild |
17 |
new file mode 100644 |
18 |
index 00000000000..8f04e23301a |
19 |
--- /dev/null |
20 |
+++ b/dev-lang/lua/lua-5.4.2-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="https://www.lua.org/" |
30 |
+TEST_PV="5.4.2" |
31 |
+TEST_P="${PN}-${TEST_PV}-tests" |
32 |
+SRC_URI=" |
33 |
+ https://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 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
39 |
+IUSE="+deprecated readline test test-complete" |
40 |
+ |
41 |
+COMMON_DEPEND=" |
42 |
+ >=app-eselect/eselect-lua-3 |
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.2-make.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. |
77 |
+ |
78 |
+ # upstream does not use libtool, but we do (see bug #336167) |
79 |
+ cp "${FILESDIR}/configure.in" "${S}/configure.ac" || die |
80 |
+ eautoreconf |
81 |
+ |
82 |
+ # custom Makefiles |
83 |
+ multilib_copy_sources |
84 |
+} |
85 |
+ |
86 |
+multilib_src_configure() { |
87 |
+ sed -i \ |
88 |
+ -e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \ |
89 |
+ -e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \ |
90 |
+ src/luaconf.h \ |
91 |
+ || die "failed patching luaconf.h" |
92 |
+ |
93 |
+ econf |
94 |
+} |
95 |
+ |
96 |
+multilib_src_compile() { |
97 |
+ tc-export CC |
98 |
+ |
99 |
+ # what to link to liblua |
100 |
+ liblibs="-lm" |
101 |
+ liblibs="${liblibs} $(dlopen_lib)" |
102 |
+ |
103 |
+ # what to link to the executables |
104 |
+ mylibs= |
105 |
+ use readline && mylibs="-lreadline" |
106 |
+ |
107 |
+ cd src |
108 |
+ |
109 |
+ local myCFLAGS="" |
110 |
+ use deprecated && myCFLAGS+="-DLUA_COMPAT_5_3 " |
111 |
+ use readline && myCFLAGS+="-DLUA_USE_READLINE " |
112 |
+ |
113 |
+ case "${CHOST}" in |
114 |
+ *-mingw*) : ;; |
115 |
+ *) myCFLAGS+="-DLUA_USE_LINUX " ;; |
116 |
+ esac |
117 |
+ |
118 |
+ emake CC="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \ |
119 |
+ SYSLDFLAGS="${LDFLAGS}" \ |
120 |
+ RPATH="${EPREFIX}/usr/$(get_libdir)/" \ |
121 |
+ LUA_LIBS="${mylibs}" \ |
122 |
+ LIB_LIBS="${liblibs}" \ |
123 |
+ V=$(ver_cut 1-2) \ |
124 |
+ gentoo_all |
125 |
+} |
126 |
+ |
127 |
+multilib_src_install() { |
128 |
+ emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \ |
129 |
+ V=${SLOT} gentoo_install |
130 |
+ |
131 |
+ case $SLOT in |
132 |
+ 0) |
133 |
+ LIBNAME="lua" |
134 |
+ INCLUDEDIR_SUFFIX='' |
135 |
+ ;; |
136 |
+ *) LIBNAME="lua${SLOT}" |
137 |
+ INCLUDEDIR_SUFFIX="/lua${SLOT}" |
138 |
+ ;; |
139 |
+ esac |
140 |
+ |
141 |
+ # We want packages to find our things... |
142 |
+ # A slotted Lua uses different directories for headers & names for |
143 |
+ # libraries, and pkgconfig should reflect that. |
144 |
+ local PATCH_PV=$(ver_cut 1-2) |
145 |
+ cp "${FILESDIR}/lua.pc" "${WORKDIR}" || die |
146 |
+ sed -r -i \ |
147 |
+ -e "/^INSTALL_INC=/s,(/include)$,\1/lua${SLOT}," \ |
148 |
+ -e "s:^prefix= :prefix= ${EPREFIX}:" \ |
149 |
+ -e "s:^V=.*:V= ${PATCH_PV}:" \ |
150 |
+ -e "s:^R=.*:R= ${PV}:" \ |
151 |
+ -e "s:/,lib,:/$(get_libdir):g" \ |
152 |
+ -e "/^Libs:/s:( )(-llua)($| ):\1-l${LIBNAME}\3:" \ |
153 |
+ -e "/^includedir=/s:include$:include${INCLUDEDIR_SUFFIX}:" \ |
154 |
+ "${WORKDIR}/lua.pc" || die |
155 |
+ |
156 |
+ insinto "/usr/$(get_libdir)/pkgconfig" |
157 |
+ newins "${WORKDIR}/lua.pc" "lua${SLOT}.pc" |
158 |
+ # Copy Debian's symlink support: |
159 |
+ # https://salsa.debian.org/lua-team/lua5.3/blob/master/debian/rules#L19 |
160 |
+ # FreeBSD calls the pkgconfig 'lua-5.3.pc' |
161 |
+ # Older systems called it 'lua53.pc' |
162 |
+ dosym "lua${SLOT}.pc" "/usr/$(get_libdir)/pkgconfig/lua-${SLOT}.pc" |
163 |
+ dosym "lua${SLOT}.pc" "/usr/$(get_libdir)/pkgconfig/lua${SLOT/.}.pc" |
164 |
+} |
165 |
+ |
166 |
+multilib_src_install_all() { |
167 |
+ DOCS="README" |
168 |
+ HTML_DOCS="doc/*.html doc/*.png doc/*.css doc/*.gif" |
169 |
+ einstalldocs |
170 |
+ newman doc/lua.1 lua${SLOT}.1 |
171 |
+ newman doc/luac.1 luac${SLOT}.1 |
172 |
+ find "${ED}" -name '*.la' -delete || die |
173 |
+ find "${ED}" -name 'liblua*.a' -delete || die |
174 |
+} |
175 |
+ |
176 |
+# Makefile contains a dummy target that doesn't do tests |
177 |
+# but causes issues with slotted lua (bug #510360) |
178 |
+src_test() { |
179 |
+ debug-print-function ${FUNCNAME} "$@" |
180 |
+ cd "${WORKDIR}/lua-${TEST_PV}-tests" || die |
181 |
+ # https://www.lua.org/tests/ |
182 |
+ # There are two sets: |
183 |
+ # basic |
184 |
+ # complete. |
185 |
+ # |
186 |
+ # The basic subset is selected by passing -e'_U=true' |
187 |
+ # The complete set is noted to contain tests that may consume too much memory or have non-portable tests. |
188 |
+ # attrib.lua for example needs some multilib customization (have to compile the stuff in libs/ for each ABI) |
189 |
+ TEST_OPTS="$(usex test-complete '' '-e_U=true')" |
190 |
+ TEST_MARKER="${T}/test.failed" |
191 |
+ rm -f "${TEST_MARKER}" |
192 |
+ |
193 |
+ # If we are failing, set the marker file, and only check it after done all ABIs |
194 |
+ abi_src_test() { |
195 |
+ debug-print-function ${FUNCNAME} "$@" |
196 |
+ TEST_LOG="${T}/test.${MULTIBUILD_ID}.log" |
197 |
+ eval "${BUILD_DIR}"/src/lua${SLOT} ${TEST_OPTS} all.lua 2>&1 | tee "${TEST_LOG}" || die |
198 |
+ grep -sq -e "final OK" "${TEST_LOG}" || echo "FAIL ${MULTIBUILD_ID}" >>"${TEST_MARKER}" |
199 |
+ return 0 |
200 |
+ } |
201 |
+ |
202 |
+ multilib_foreach_abi abi_src_test |
203 |
+ |
204 |
+ if [ -e "${TEST_MARKER}" ]; then |
205 |
+ cat "${TEST_MARKER}" |
206 |
+ die "Tests failed" |
207 |
+ fi |
208 |
+} |
209 |
+ |
210 |
+pkg_postinst() { |
211 |
+ eselect lua set --if-unset "${PN}${SLOT}" |
212 |
+ |
213 |
+ if has_version "app-editor/emacs"; then |
214 |
+ if ! has_version "app-emacs/lua-mode"; then |
215 |
+ einfo "Install app-emacs/lua-mode for lua support for emacs" |
216 |
+ fi |
217 |
+ fi |
218 |
+} |