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:18
Message-Id: 1579822930.23983e53fa437eb4f2266a625c979416a04224e5.robbat2@gentoo
1 commit: 23983e53fa437eb4f2266a625c979416a04224e5
2 Author: Victor Payno <vpayno+gentoo <AT> gmail <DOT> com>
3 AuthorDate: Thu Jan 23 05:07:58 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 23 23:42:10 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23983e53
7
8 dev-lang/lua: fix pkgconfig for lua 5.1
9
10 Effectively adds 'lua5.1' 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.1.5-r103.ebuild | 145 +++++++++++++++++++++++++++++++++++++
16 1 file changed, 145 insertions(+)
17
18 diff --git a/dev-lang/lua/lua-5.1.5-r103.ebuild b/dev-lang/lua/lua-5.1.5-r103.ebuild
19 new file mode 100644
20 index 00000000000..c8f27b3b2b5
21 --- /dev/null
22 +++ b/dev-lang/lua/lua-5.1.5-r103.ebuild
23 @@ -0,0 +1,145 @@
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 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 +SRC_URI="http://www.lua.org/ftp/${P}.tar.gz"
34 +
35 +LICENSE="MIT"
36 +SLOT="5.1"
37 +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"
38 +IUSE="+deprecated emacs readline static"
39 +
40 +RDEPEND="readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )
41 + app-eselect/eselect-lua
42 + !dev-lang/lua:0"
43 +DEPEND="${RDEPEND}
44 + sys-devel/libtool"
45 +PDEPEND="emacs? ( app-emacs/lua-mode )"
46 +
47 +SAN_SLOT="${SLOT//.}"
48 +
49 +MULTILIB_WRAPPED_HEADERS=(
50 + /usr/include/lua${SLOT}/luaconf.h
51 +)
52 +
53 +src_prepare() {
54 + local PATCH_PV=$(get_version_component_range 1-2)
55 +
56 + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r2.patch
57 + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-module_paths.patch
58 +
59 + # use glibtool on Darwin (versus Apple libtool)
60 + if [[ ${CHOST} == *-darwin* ]] ; then
61 + sed -i -e '/LIBTOOL = /s:libtool:glibtool:' \
62 + Makefile src/Makefile || die
63 + fi
64 +
65 + #EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
66 +
67 + # correct lua versioning
68 + sed -i -e 's/\(LIB_VERSION = \)6:1:1/\16:5:1/' src/Makefile
69 +
70 + sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
71 +
72 + if ! use deprecated ; then
73 + # patches from 5.1.4 still apply
74 + epatch "${FILESDIR}"/${PN}-5.1.4-deprecated.patch
75 + epatch "${FILESDIR}"/${PN}-5.1.4-test.patch
76 + fi
77 +
78 + if ! use readline ; then
79 + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-readline.patch
80 + fi
81 +
82 + # Using dynamic linked lua is not recommended for performance
83 + # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
84 + # Mainly, this is of concern if your arch is poor with GPRs, like x86
85 + # Note that this only affects the interpreter binary (named lua), not the lua
86 + # compiler (built statically) nor the lua libraries (both shared and static
87 + # are installed)
88 + if use static ; then
89 + epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make_static-r1.patch
90 + fi
91 +
92 + # A slotted Lua uses different directories for headers & names for
93 + # libraries, and pkgconfig should reflect that.
94 + sed -r -i \
95 + -e "/^INSTALL_INC=/s,(/include)$,\1/lua${SLOT}," \
96 + -e "/^Libs:/s,((-llua)($| )),\2${SLOT}\3," \
97 + -e "/^Cflags:/s,((-I..includedir.)($| )),\2/lua${SLOT}\3," \
98 + "${S}"/etc/lua.pc
99 +
100 + # custom Makefiles
101 + multilib_copy_sources
102 +}
103 +
104 +multilib_src_configure() {
105 + # We want packages to find our things...
106 + sed -i \
107 + -e 's:/usr/local:'${EPREFIX}'/usr:' \
108 + -e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \
109 + etc/lua.pc src/luaconf.h || die
110 +}
111 +
112 +multilib_src_compile() {
113 + tc-export CC
114 + myflags=
115 + # what to link to liblua
116 + liblibs="-lm"
117 + liblibs="${liblibs} $(dlopen_lib)"
118 +
119 + # what to link to the executables
120 + mylibs=
121 + if use readline; then
122 + mylibs="-lreadline"
123 + fi
124 +
125 + cd src
126 + emake CC="${CC}" CFLAGS="-DLUA_USE_LINUX ${CFLAGS}" \
127 + RPATH="${EPREFIX}/usr/$(get_libdir)/" \
128 + LUA_LIBS="${mylibs}" \
129 + LIB_LIBS="${liblibs}" \
130 + V=$(get_version_component_range 1-2) \
131 + gentoo_all
132 +
133 + mv lua_test ../test/lua.static
134 +}
135 +
136 +multilib_src_install() {
137 + emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
138 + V=${SLOT} gentoo_install
139 +
140 + insinto /usr/$(get_libdir)/pkgconfig
141 + newins etc/lua.pc lua${SLOT}.pc
142 +}
143 +
144 +multilib_src_install_all() {
145 + dodoc HISTORY README
146 + dohtml doc/*.html doc/*.png doc/*.css doc/*.gif
147 +
148 + doicon etc/lua.ico
149 +
150 + newman doc/lua.1 lua${SLOT}.1
151 + newman doc/luac.1 luac${SLOT}.1
152 +}
153 +
154 +multilib_src_test() {
155 + local positive="bisect cf echo env factorial fib fibfor hello printf sieve
156 + sort trace-calls trace-globals"
157 + local negative="readonly"
158 + local test
159 +
160 + cd "${BUILD_DIR}" || die
161 + for test in ${positive}; do
162 + test/lua.static test/${test}.lua || die "test $test failed"
163 + done
164 +
165 + for test in ${negative}; do
166 + test/lua.static test/${test}.lua && die "test $test failed"
167 + done
168 +}