From e58e681d9f1407142409c6414769d21df9ff4bd7 Mon Sep 17 00:00:00 2001 From: Thomas Bach Date: Tue, 14 Mar 2017 21:39:40 +0100 Subject: [PATCH 1/3] haproxy: refactor `preConfigure` line became too long to edit comfortably. Split up flags into ones necessary during both build and install phase and install phase only. Makefile defines a target for OS X/Darwin which automatically sets the `KQUEUE` flag. --- pkgs/tools/networking/haproxy/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/haproxy/default.nix b/pkgs/tools/networking/haproxy/default.nix index 3b7a68fb972f..88c750525b26 100644 --- a/pkgs/tools/networking/haproxy/default.nix +++ b/pkgs/tools/networking/haproxy/default.nix @@ -15,9 +15,17 @@ stdenv.mkDerivation rec { buildInputs = [ openssl zlib ]; # 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.optional stdenv.isDarwin "CC=cc"; meta = { description = "Reliable, high performance TCP/HTTP load balancer"; From 45788aeebed646938f525508bd75ca0319b668d9 Mon Sep 17 00:00:00 2001 From: Thomas Bach Date: Mon, 27 Mar 2017 10:21:19 +0200 Subject: [PATCH 2/3] haproxy: Provide LUA and PCRE support as configurable options Both are enabled by default. Except for LUA on Darwin where compilation fails. (See #23901.) --- pkgs/tools/networking/haproxy/default.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/haproxy/default.nix b/pkgs/tools/networking/haproxy/default.nix index 88c750525b26..b7c8111751a6 100644 --- a/pkgs/tools/networking/haproxy/default.nix +++ b/pkgs/tools/networking/haproxy/default.nix @@ -1,4 +1,11 @@ -{ stdenv, pkgs, fetchurl, openssl, zlib }: +{ useLua ? false +, usePcre ? false +, stdenv, fetchurl +, openssl, zlib, lua ? null, pcre ? null +}: + +assert useLua -> lua != null; +assert usePcre -> pcre != null; stdenv.mkDerivation rec { pname = "haproxy"; @@ -12,7 +19,9 @@ stdenv.mkDerivation rec { sha256 = "ebb31550a5261091034f1b6ac7f4a8b9d79a8ce2a3ddcd7be5b5eb355c35ba65"; }; - buildInputs = [ openssl zlib ]; + buildInputs = [ openssl zlib ] + ++ stdenv.lib.optional useLua lua + ++ stdenv.lib.optional usePcre pcre; # TODO: make it work on bsd as well makeFlags = [ @@ -25,6 +34,13 @@ stdenv.mkDerivation rec { 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=${lua}/lib" + "LUA_INC=${lua}/include" ] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc"; meta = { From ea80cd1f1101aa9553a6bdb9896e619593948cef Mon Sep 17 00:00:00 2001 From: Thomas Bach Date: Wed, 29 Mar 2017 12:27:50 +0200 Subject: [PATCH 3/3] haproxy: added fuzzy-id to the list of maintainers --- lib/maintainers.nix | 1 + pkgs/tools/networking/haproxy/default.nix | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/maintainers.nix b/lib/maintainers.nix index e6c44aa81b12..9bc0c2fd5d2d 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -181,6 +181,7 @@ ftrvxmtrx = "Siarhei Zirukin "; funfunctor = "Edward O'Callaghan "; fuuzetsu = "Mateusz Kowalczyk "; + fuzzy-id = "Thomas Bach "; fxfactorial = "Edgar Aroutiounian "; gal_bolle = "Florent Becker "; garbas = "Rok Garbas "; diff --git a/pkgs/tools/networking/haproxy/default.nix b/pkgs/tools/networking/haproxy/default.nix index b7c8111751a6..dda4452f6448 100644 --- a/pkgs/tools/networking/haproxy/default.nix +++ b/pkgs/tools/networking/haproxy/default.nix @@ -1,10 +1,10 @@ -{ useLua ? false -, usePcre ? false +{ useLua ? !stdenv.isDarwin +, usePcre ? true , stdenv, fetchurl -, openssl, zlib, lua ? null, pcre ? null +, openssl, zlib, lua5_3 ? null, pcre ? null }: -assert useLua -> lua != null; +assert useLua -> lua5_3 != null; assert usePcre -> pcre != null; stdenv.mkDerivation rec { @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ openssl zlib ] - ++ stdenv.lib.optional useLua lua + ++ stdenv.lib.optional useLua lua5_3 ++ stdenv.lib.optional usePcre pcre; # TODO: make it work on bsd as well @@ -39,8 +39,8 @@ stdenv.mkDerivation rec { "USE_PCRE_JIT=yes" ] ++ stdenv.lib.optionals useLua [ "USE_LUA=yes" - "LUA_LIB=${lua}/lib" - "LUA_INC=${lua}/include" + "LUA_LIB=${lua5_3}/lib" + "LUA_INC=${lua5_3}/include" ] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc"; meta = { @@ -54,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; };