1 # Copyright 2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
12 DESCRIPTION="Bare libuv bindings for lua"
13 HOMEPAGE="https://github.com/luvit/luv"
17 https://github.com/luvit/${PN}/archive/${MY_PV}.tar.gz -> ${P}.tar.gz
18 https://github.com/keplerproject/lua-compat-5.3/archive/v${LUA_COMPAT_PV}.tar.gz -> ${PN}-lua-compat-${LUA_COMPAT_PV}.tar.gz
21 LICENSE="Apache-2.0 MIT"
23 KEYWORDS="amd64 ~arm ~arm64 x86"
25 RESTRICT="!test? ( test )"
27 BDEPEND="virtual/pkgconfig"
29 >=dev-libs/libuv-1.32.0:=
30 luajit? ( dev-lang/luajit:2 )
31 !luajit? ( dev-lang/lua:0 )
35 S="${WORKDIR}/${MY_P}"
39 # Match '/lib/' and '/lib"' without capturing / or ", replacing with libdir
40 sed -i -r "s/\/lib(\"|\/)/\/$(get_libdir)\1/g" CMakeLists.txt || die "Failed to sed CMakeLists.txt"
45 lua_compat_dir="${WORKDIR}/lua-compat-5.3-${LUA_COMPAT_PV}"
48 -DLUA_BUILD_TYPE=System
49 -DLUA_COMPAT53_DIR="${lua_compat_dir}"
50 -DWITH_LUA_ENGINE=$(usex luajit LuaJIT Lua)
51 -DWITH_SHARED_LIBUV=ON
57 local elua="$(usex luajit luajit lua)"
58 # We need to copy the library back so that the tests see it
59 ln -s "${BUILD_DIR}/libluv.so" "./luv.so" || die "Failed to symlink library for tests"
60 ${elua} "tests/run.lua" || die "Tests failed"