logo

overlay

My (experimental) gentoo overlay

luarocks-2.2.0.ebuild (1518B)


      1 # Copyright 1999-2016 Gentoo Foundation
      2 # Copyright 2019 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
      3 # Distributed under the terms of the GNU General Public License v2
      4 
      5 EAPI=6
      6 
      7 inherit lua
      8 
      9 DESCRIPTION="A deployment and management system for Lua modules"
     10 HOMEPAGE="http://www.luarocks.org"
     11 SRC_URI="http://luarocks.org/releases/${P}.tar.gz"
     12 
     13 LICENSE="MIT"
     14 SLOT="0"
     15 KEYWORDS="~amd64 ~ppc x86"
     16 IUSE="curl openssl"
     17 
     18 DEPEND="
     19 	curl? ( net-misc/curl )
     20 	!curl? ( net-misc/wget )
     21 	openssl? ( dev-libs/openssl )
     22 	!openssl? ( sys-apps/coreutils )
     23 "
     24 RDEPEND="
     25 	${DEPEND}
     26 	app-arch/unzip
     27 "
     28 
     29 all_lua_prepare() {
     30 	# Don't die on gentoo's econf calls!
     31 	sed -r \
     32 		-e "/die.*Unknown flag:/d" \
     33 		-i configure
     34 	lua_default
     35 }
     36 
     37 each_lua_configure() {
     38 	local md5 downloader lua incdir
     39 	md5="md5sum"
     40 	downloader="wget"
     41 	lua="$(lua_get_lua)"
     42 	incdir=$(lua_get_pkgvar includedir)
     43 
     44 	use curl && downloader="curl"
     45 	use openssl && md5="openssl"
     46 
     47 	myeconfargs=()
     48 	myeconfargs+=(
     49 		--prefix=/usr
     50 		--with-lua=/usr
     51 		--with-lua-lib="/usr/$(get_libdir)"
     52 		--rocks-tree=/usr
     53 		--with-downloader="${downloader}"
     54 		--with-md5-checker="${md5}"
     55 		--lua-suffix="${lua//lua}"
     56 		--lua-version="$(lua_get_abi)"
     57 		--with-lua-include="${incdir}"
     58 		--sysconfdir=/etc/${PN}
     59 	)
     60 	lua_default
     61 }
     62 
     63 each_lua_compile() {
     64 	lua_default build
     65 }
     66 
     67 pkg_preinst() {
     68 	local abi="$(lua_get_abi)"
     69 	find "${D}" -type f | xargs sed -e "s:${D}::g" -i || die "sed failed"
     70 	for l in luarocks{,-admin}; do
     71 		rm "${D}/usr/bin/${l}"
     72 		dosym "${l}-${abi}" "/usr/bin/${l}"
     73 	done
     74 }