inherit toolchain-funcs wherever tc-getCC present
[sgilles-overlay.git] / dev-lua / lunix / lunix-20190403.ebuild
bloba78ddcf6bc0fe3dacba69f148c1a2617a762f187
1 # Copyright 1999-2019 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 LUA_COMPAT=( lua5-1 lua5-2 lua5-3 lua5-4 luajit )
7 inherit lua git-r3 autotools toolchain-funcs
9 DESCRIPTION="Lua Unix Module"
10 HOMEPAGE="http://25thandclement.com/~william/projects/lunix.html"
11 EGIT_REPO_URI="https://25thandClement.com/~william/projects/lunix.git"
13 if [[ "${PV}" == *999* ]]; then
14         :
15 else
16         EGIT_COMMIT="rel-${PV}"
17         KEYWORDS="~amd64 ~arm ~x86"
20 LICENSE="MIT"
21 SLOT="0"
22 IUSE="doc examples"
24 DEPEND="
25         ${LUA_DEPS}
26         dev-libs/openssl:0=
28 RDEPEND="${DEPEND}"
30 DOCS=(doc/.)
31 PATCHES=(
32         "${FILESDIR}/${P}-no-static-assert.patch" # static assert detection seems broken sometimes
35 lua_src_prepare() {
36         if ! test -d "${S}.${ELUA}" ; then
37                 cp -ral "${S}/" "${S}.${ELUA}" || die
38         fi
40         cd "${S}.${ELUA}" || die
41         eautoheader
42         eautoconf
43         eautoreconf
46 src_prepare() {
47         default
48         lua_foreach_impl lua_src_prepare
51 lua_src_configure() {
52         cd "${S}.${ELUA}" || die
53         default
56 src_configure() {
57         lua_foreach_impl lua_src_configure
61 this_compile() {
62         cd "${S}.${ELUA}" || die
64         local myemakeargs=(
65                 "CC=$(tc-getCC)"
66                 "LD=$(tc-getCC)"
67                 "includedir=$(lua_get_include_dir)"
68                 "libdir=$($(tc-getPKG_CONFIG) --variable libdir ${ELUA}))"
69         )
71         if [[ ${ELUA} == "lua5.1" || ${ELUA} == "luajit" ]]; then
72                 emake all5.1
73         fi
75         if [[ ${ELUA} == "lua5.2" ]]; then
76                 emake all5.2
77         fi
79         if [[ ${ELUA} == "lua5.3" || ${ELUA} == "lua5.4" ]]; then
80                 emake all5.3
81         fi
84 src_compile() {
85         lua_foreach_impl this_compile
88 this_install() {
89         # Upstream makefile really, really doesn't respect DESTDIR and has a
90         # dozen layers of indirection
91         cd "${S}.${ELUA}" || die
92         local instdir
93         instdir="$(lua_get_cmod_dir)"
94         exeinto "${instdir#${EPREFIX}}"
95         if [[ ${ELUA} == "lua5.1" || ${ELUA} == "luajit" ]]; then
96                 doexe src/5.1/unix.so
97         fi
99         if [[ ${ELUA} == "lua5.2" ]]; then
100                 doexe src/5.2/unix.so
101         fi
103         if [[ ${ELUA} == "lua5.3" || ${ELUA} == "lua5.4" ]]; then
104                 doexe src/5.3/unix.so
105         fi
108 src_install() {
109         lua_foreach_impl this_install