app-benchmarks/stress-ng: bump to version 0.11.03
[gentoo.git] / dev-lua / luv / luv-1.32.0.0.ebuild
1 # Copyright 2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake unpacker
7
8 # e.g. MY_PV = a.b.c-d
9 MY_PV="$(ver_rs 3 -)"
10 MY_P="${PN}-${MY_PV}"
11
12 DESCRIPTION="Bare libuv bindings for lua"
13 HOMEPAGE="https://github.com/luvit/luv"
14
15 LUA_COMPAT_PV="0.7"
16 SRC_URI="
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
19 "
20
21 LICENSE="Apache-2.0 MIT"
22 SLOT="0"
23 KEYWORDS="amd64 ~arm ~arm64 x86"
24 IUSE="luajit test"
25 RESTRICT="!test? ( test )"
26
27 BDEPEND="virtual/pkgconfig"
28 DEPEND="
29         >=dev-libs/libuv-1.32.0:=
30         luajit? ( dev-lang/luajit:2 )
31         !luajit? ( dev-lang/lua:0 )
32 "
33 RDEPEND="${DEPEND}"
34
35 S="${WORKDIR}/${MY_P}"
36
37 src_prepare() {
38         # Fix libdir
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"
41         cmake_src_prepare
42 }
43
44 src_configure() {
45         lua_compat_dir="${WORKDIR}/lua-compat-5.3-${LUA_COMPAT_PV}"
46         local mycmakeargs=(
47                 -DBUILD_MODULE=OFF
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
52         )
53         cmake_src_configure
54 }
55
56 src_test() {
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"
61 }