# Contributor: Carlo Landmeter # Maintainer: Jakub Jirutka pkgname=luarocks pkgver=2.4.0 pkgrel=0 pkgdesc="Deployment and management system for Lua modules" url="http://www.luarocks.org/" arch="noarch" license="MIT" depends="curl" makedepends="" subpackages="" source="http://luarocks.org/releases/$pkgname-$pkgver.tar.gz" builddir="$srcdir/$pkgname-$pkgver" _lua_versions="5.1 5.2 5.3" for _v in $_lua_versions; do makedepends="$makedepends lua$_v-dev" subpackages="$subpackages $pkgname${_v}:_package" done prepare() { default_prepare || return 1 # Create builddir for each Lua version. local lver; for lver in $_lua_versions; do cp -r "$builddir" "$builddir-$lver" done } build() { local lver; for lver in $_lua_versions; do cd "$builddir-$lver" ./configure \ --prefix=/usr \ --sysconfdir=/etc/luarocks \ --rocks-tree=/usr/local \ --lua-version="$lver" \ --lua-suffix="$lver" \ --with-downloader=curl \ --with-md5-checker=md5sum \ --versioned-rocks-dir \ || return 1 make || return 1 done } package() { mkdir -p "$pkgdir" } _package() { local lver="${subpkgname#$pkgname}" pkgdesc="Deployment and management system for Lua $lver modules" install_if="lua$lver $pkgname=$pkgver-r$pkgrel" depends="lua$lver" cd "$builddir-$lver" make install DESTDIR="$subpkgdir" || return 1 # Remove default script names which conflict per Lua version. rm "$subpkgdir"/usr/bin/luarocks \ "$subpkgdir"/usr/bin/luarocks-admin || return 1 # Set the correct Lua version. sed -i "s/env lua/env lua${lver}/" \ "$subpkgdir"/usr/bin/luarocks-$lver \ "$subpkgdir"/usr/bin/luarocks-admin-$lver } md5sums="8ae36edb46899f6f5b9fe7ff9ba88079 luarocks-2.4.0.tar.gz" sha256sums="44381c9128d036247d428531291d1ff9405ae1daa238581d3c15f96d899497c3 luarocks-2.4.0.tar.gz" sha512sums="6eefdf2dfbd3c323533ddc335e361600a18bf1e13c6f3cd9fda11b389a0b7be6b2708d84d648902dba7240306155266d1a0a3fa05f3f9bf1dccfa8ffd254f687 luarocks-2.4.0.tar.gz"