Merge #60614: lua*Packages improvements

This commit is contained in:
Vladimír Čunát 2019-05-12 09:58:28 +02:00
commit ec5f5a21d7
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
5 changed files with 85 additions and 52 deletions

View file

@ -2,8 +2,10 @@
ansicolors,
argparse,
basexx,
binaryheap,
dkjson
fifo
http
inspect
ldoc
lgi

1 # nix name, luarocks name, server, version/additionnal args
2 ansicolors,
3 argparse,
4 basexx,
5 binaryheap,
6 dkjson
7 fifo
8 http
9 inspect
10 ldoc
11 lgi

View file

@ -76,6 +76,26 @@ basexx = buildLuarocksPackage {
};
};
};
binaryheap = buildLuarocksPackage {
pname = "binaryheap";
version = "0.4-1";
src = fetchurl {
url = https://luarocks.org/binaryheap-0.4-1.src.rock;
sha256 = "11rd8r3bpinfla2965jgjdv1hilqdc1q6g1qla5978d7vzg19kpc";
};
disabled = ( luaOlder "5.1");
propagatedBuildInputs = [ lua ];
buildType = "builtin";
meta = {
homepage = "https://github.com/Tieske/binaryheap.lua";
description="Binary heap implementation in pure Lua";
license = {
fullName = "MIT/X11";
};
};
};
dkjson = buildLuarocksPackage {
pname = "dkjson";
version = "2.5-2";
@ -116,6 +136,26 @@ fifo = buildLuarocksPackage {
};
};
};
http = buildLuarocksPackage {
pname = "http";
version = "0.3-0";
src = fetchurl {
url = https://luarocks.org/http-0.3-0.src.rock;
sha256 = "0vvl687bh3cvjjwbyp9cphqqccm3slv4g7y3h03scp3vpq9q4ccq";
};
disabled = ( luaOlder "5.1");
propagatedBuildInputs = [ lua compat53 bit32 cqueues luaossl basexx lpeg lpeg_patterns binaryheap fifo ];
buildType = "builtin";
meta = {
homepage = "https://github.com/daurnimator/lua-http";
description="HTTP library for Lua";
license = {
fullName = "MIT";
};
};
};
inspect = buildLuarocksPackage {
pname = "inspect";
version = "3.1.1-0";

View file

@ -56,7 +56,7 @@ with super;
'';
});
luuid = super.luuid.override({
luuid = super.luuid.override(oa: {
buildInputs = [ pkgs.libuuid ];
extraConfig = ''
variables = {
@ -64,7 +64,7 @@ with super;
LIBUUID_LIBDIR="${pkgs.lib.getLib pkgs.libuuid}/lib";
}
'';
meta = {
meta = oa.meta // {
platforms = pkgs.lib.platforms.linux;
};
});
@ -75,4 +75,27 @@ with super;
sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
'';
});
}
binaryheap = super.binaryheap.overrideAttrs(oa: {
meta = oa.meta // {
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
};
});
http = super.http.overrideAttrs(oa: {
patches = oa.patches or [] ++ [
(pkgs.fetchpatch {
name = "invalid-state-progression.patch";
url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7";
})
];
/* TODO: separate docs derivation? (pandoc is heavy)
nativeBuildInputs = [ pandoc ];
makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
*/
meta = oa.meta // {
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
};
});
}

View file

@ -75,26 +75,24 @@ unwrapped = stdenv.mkDerivation rec {
};
};
wrapped-full = with luajitPackages; let
luaPkgs = [
luasec luasocket # trust anchor bootstrap, prefill module
lfs # prefill module
# Almost all is for the 'http' module:
http cqueues fifo lpeg lpeg_patterns luaossl compat53 basexx
];
in runCommand unwrapped.name
wrapped-full = runCommand unwrapped.name
{
nativeBuildInputs = [ makeWrapper ];
buildInputs = with luajitPackages; [
luasec luasocket # trust anchor bootstrap, prefill module
lfs # prefill module
http # for http module; brings lots of deps; some are useful elsewhere
];
preferLocalBuild = true;
allowSubstitutes = false;
}
''
mkdir -p "$out/sbin" "$out/share"
makeWrapper '${unwrapped}/sbin/kresd' "$out"/sbin/kresd \
--set LUA_PATH '${concatStringsSep ";" (map getLuaPath luaPkgs)}' \
--set LUA_CPATH '${concatStringsSep ";" (map getLuaCPath luaPkgs)}'
mkdir -p "$out"/{bin,share}
makeWrapper '${unwrapped}/bin/kresd' "$out"/bin/kresd \
--set LUA_PATH "$LUA_PATH" \
--set LUA_CPATH "$LUA_CPATH"
ln -sr '${unwrapped}/share/man' "$out"/share/
ln -sr "$out"/{sbin,bin}
ln -sr "$out"/{bin,sbin}
'';
in result

View file

@ -151,10 +151,11 @@ with self; {
cc lutf8lib.c $CFLAGS -o utf8.so
'';
# There's no need to separate *.lua and *.so, I guess? TODO: conventions?
# The hook in ../development/lua-modules/generic/default.nix
# is strict about share vs. lib for _PATH and _CPATH.
installPhase = ''
install -Dt "$out/lib/lua/${lua.luaversion}/compat53" \
compat53/*.lua *.so
install -Dt "$out/share/lua/${lua.luaversion}/compat53" compat53/*.lua
install -Dt "$out/lib/lua/${lua.luaversion}/compat53" *.so
'';
meta = with stdenv.lib; {
@ -192,38 +193,6 @@ with self; {
};
};
http = buildLuaPackage rec {
version = "0.2";
name = "http-${version}";
src = fetchFromGitHub {
owner = "daurnimator";
repo = "lua-http";
rev = "v${version}";
sha256 = "0a8vsj49alaf1fkhv51n5mgpjq8izfff3shcjs8xk7p2bc46vd7i";
};
/* TODO: separate docs derivation? (pandoc is heavy)
nativeBuildInputs = [ pandoc ];
makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
*/
buildPhase = ":";
installPhase = ''
install -Dt "$out/lib/lua/${lua.luaversion}/http" \
http/*.lua
install -Dt "$out/lib/lua/${lua.luaversion}/http/compat" \
http/compat/*.lua
'';
meta = with stdenv.lib; {
description = "HTTP library for lua";
homepage = "https://daurnimator.github.io/lua-http/${version}/";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
};
};
luacyrussasl = buildLuaPackage rec {
version = "1.1.0";
name = "lua-cyrussasl-${version}";
@ -419,12 +388,13 @@ with self; {
sha256 = "0wv8l7f7na7kw5xn8mjik2wpxbizl7zvvp5s7fcwvz9kl5jdpk5b";
};
propagatedBuildInputs = [ luasocket ];
buildInputs = [ openssl ];
preBuild = ''
makeFlagsArray=(
${platformString}
LUAPATH="$out/lib/lua/${lua.luaversion}"
LUAPATH="$out/share/lua/${lua.luaversion}"
LUACPATH="$out/lib/lua/${lua.luaversion}"
INC_PATH="-I${lua}/include"
LIB_PATH="-L$out/lib");