Update luarocks

This commit is contained in:
Michael Raskin 2014-08-14 10:14:12 +04:00
parent 0fcc634d59
commit 8da8c805bb

View File

@ -1,16 +1,16 @@
{stdenv, fetchurl, lua, curl}: {stdenv, fetchurl, lua, curl, makeWrapper, which}:
let let
s = # Generated upstream information s = # Generated upstream information
rec { rec {
baseName="luarocks"; baseName="luarocks";
version="2.2"; version="2.2.0";
name="${baseName}-${version}"; name="${baseName}-${version}";
hash="03i46ayimp087288f0bi6g30fi3aixp2bha2jmsbbhwmsxm1yshs"; hash="1717p694455w1fdldb2ldlyklln8w3bqk1dsly8gpqh3n73lw6lv";
url="http://luarocks.org/releases/luarocks-2.2.0beta1.tar.gz"; url="http://luarocks.org/releases/luarocks-2.2.0-rc1.tar.gz";
sha256="03i46ayimp087288f0bi6g30fi3aixp2bha2jmsbbhwmsxm1yshs"; sha256="1717p694455w1fdldb2ldlyklln8w3bqk1dsly8gpqh3n73lw6lv";
}; };
buildInputs = [ buildInputs = [
lua curl lua curl makeWrapper which
]; ];
in in
stdenv.mkDerivation { stdenv.mkDerivation {
@ -19,6 +19,29 @@ stdenv.mkDerivation {
src = fetchurl { src = fetchurl {
inherit (s) url sha256; inherit (s) url sha256;
}; };
preConfigure = ''
lua -e "" || {
luajit -e "" && {
export LUA_SUFFIX=jit
configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX"
}
}
lua_inc="$(echo "${lua}/include"/*/)"
if test -n "$lua_inc"; then
configureFlags="$configureFlags --with-lua-include=$lua_inc"
fi
'';
postInstall = ''
sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/*
for i in "$out"/bin/*; do
test -L "$i" || {
wrapProgram "$i" \
--prefix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \
--prefix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
}
done
'';
meta = { meta = {
inherit (s) version; inherit (s) version;
description = ''A package manager for Lua''; description = ''A package manager for Lua'';