Merge pull request #24380 from fuzzy-id/haproxy-overworked4

haproxy: PCRE and LUA support via configurable options
This commit is contained in:
Daiderd Jordan 2017-03-31 08:46:14 +02:00 committed by GitHub
commit 607a21b7c0
2 changed files with 31 additions and 6 deletions

View File

@ -181,6 +181,7 @@
ftrvxmtrx = "Siarhei Zirukin <ftrvxmtrx@gmail.com>";
funfunctor = "Edward O'Callaghan <eocallaghan@alterapraxis.com>";
fuuzetsu = "Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>";
fuzzy-id = "Thomas Bach <hacking+nixos@babibo.de>";
fxfactorial = "Edgar Aroutiounian <edgar.factorial@gmail.com>";
gal_bolle = "Florent Becker <florent.becker@ens-lyon.org>";
garbas = "Rok Garbas <rok@garbas.si>";

View File

@ -1,4 +1,11 @@
{ stdenv, pkgs, fetchurl, openssl, zlib }:
{ useLua ? !stdenv.isDarwin
, usePcre ? true
, stdenv, fetchurl
, openssl, zlib, lua5_3 ? null, pcre ? null
}:
assert useLua -> lua5_3 != null;
assert usePcre -> pcre != null;
stdenv.mkDerivation rec {
pname = "haproxy";
@ -12,12 +19,29 @@ stdenv.mkDerivation rec {
sha256 = "ebb31550a5261091034f1b6ac7f4a8b9d79a8ce2a3ddcd7be5b5eb355c35ba65";
};
buildInputs = [ openssl zlib ];
buildInputs = [ openssl zlib ]
++ stdenv.lib.optional useLua lua5_3
++ stdenv.lib.optional usePcre pcre;
# TODO: make it work on bsd as well
preConfigure = ''
export makeFlags="TARGET=${if stdenv.isSunOS then "solaris" else if stdenv.isLinux then "linux2628" else "generic"} PREFIX=$out USE_OPENSSL=yes USE_ZLIB=yes ${stdenv.lib.optionalString stdenv.isDarwin "CC=cc USE_KQUEUE=1"}"
'';
makeFlags = [
"PREFIX=\${out}"
("TARGET=" + (if stdenv.isSunOS then "solaris"
else if stdenv.isLinux then "linux2628"
else if stdenv.isDarwin then "osx"
else "generic"))
];
buildFlags = [
"USE_OPENSSL=yes"
"USE_ZLIB=yes"
] ++ stdenv.lib.optionals usePcre [
"USE_PCRE=yes"
"USE_PCRE_JIT=yes"
] ++ stdenv.lib.optionals useLua [
"USE_LUA=yes"
"LUA_LIB=${lua5_3}/lib"
"LUA_INC=${lua5_3}/include"
] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc";
meta = {
description = "Reliable, high performance TCP/HTTP load balancer";
@ -30,7 +54,7 @@ stdenv.mkDerivation rec {
hardware.
'';
homepage = http://haproxy.1wt.eu;
maintainers = [ stdenv.lib.maintainers.garbas ];
maintainers = with stdenv.lib.maintainers; [ fuzzy-id garbas ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
license = stdenv.lib.licenses.gpl2;
};