Gentoo Archives: gentoo-commits

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