2017-03-29 12:27:50 +02:00
|
|
|
{ useLua ? !stdenv.isDarwin
|
|
|
|
, usePcre ? true
|
2018-06-04 22:10:16 +02:00
|
|
|
, stdenv, fetchurl, fetchpatch
|
2017-03-29 12:27:50 +02:00
|
|
|
, openssl, zlib, lua5_3 ? null, pcre ? null
|
2017-03-27 10:21:19 +02:00
|
|
|
}:
|
|
|
|
|
2017-03-29 12:27:50 +02:00
|
|
|
assert useLua -> lua5_3 != null;
|
2017-03-27 10:21:19 +02:00
|
|
|
assert usePcre -> pcre != null;
|
2012-05-18 09:50:10 +02:00
|
|
|
|
2013-07-03 03:36:15 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2017-01-26 09:37:51 +01:00
|
|
|
pname = "haproxy";
|
2018-06-04 22:01:48 +02:00
|
|
|
version = "1.8.9";
|
2017-01-26 09:37:51 +01:00
|
|
|
name = "${pname}-${version}";
|
2013-10-29 15:55:25 +01:00
|
|
|
|
2012-05-18 09:50:10 +02:00
|
|
|
src = fetchurl {
|
2018-03-04 15:28:45 +01:00
|
|
|
url = "https://www.haproxy.org/download/${stdenv.lib.versions.majorMinor version}/src/${name}.tar.gz";
|
2018-06-04 22:01:48 +02:00
|
|
|
sha256 = "00miblgwll3mycsgmp3gd3cn4lwsagxzgjxk5i6csnyqgj97fss3";
|
2012-05-18 09:50:10 +02:00
|
|
|
};
|
|
|
|
|
2018-06-04 22:10:16 +02:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "CVE-2018-11469.patch";
|
|
|
|
url = "https://git.haproxy.org/?p=haproxy-1.8.git;a=patch;h=17514045e5d934dede62116216c1b016fe23dd06";
|
|
|
|
sha256 = "0hzcvghg8qz45n3mrcgsjgvrvicvbvm52cc4hs5jbk1yb50qvls7";
|
|
|
|
})
|
2018-06-04 22:42:14 +02:00
|
|
|
] ++ stdenv.lib.optional stdenv.isDarwin (fetchpatch {
|
|
|
|
name = "fix-darwin-no-threads-build.patch";
|
|
|
|
url = "https://git.haproxy.org/?p=haproxy-1.8.git;a=patch;h=fbf09c441a4e72c4a690bc7ef25d3374767fe5c5;hp=3157ef219c493f3b01192f1b809a086a5b119a1e";
|
|
|
|
sha256 = "16ckzb160anf7xih7mmqy59pfz8sdywmyblxnr7lz9xix3jwk55r";
|
|
|
|
});
|
2018-06-04 22:10:16 +02:00
|
|
|
|
2017-03-27 10:21:19 +02:00
|
|
|
buildInputs = [ openssl zlib ]
|
2017-03-29 12:27:50 +02:00
|
|
|
++ stdenv.lib.optional useLua lua5_3
|
2017-03-27 10:21:19 +02:00
|
|
|
++ stdenv.lib.optional usePcre pcre;
|
2012-05-18 09:50:10 +02:00
|
|
|
|
2017-03-07 18:50:45 +01:00
|
|
|
# TODO: make it work on bsd as well
|
2017-03-14 21:39:40 +01:00
|
|
|
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"
|
2017-03-27 10:21:19 +02:00
|
|
|
] ++ stdenv.lib.optionals usePcre [
|
|
|
|
"USE_PCRE=yes"
|
|
|
|
"USE_PCRE_JIT=yes"
|
|
|
|
] ++ stdenv.lib.optionals useLua [
|
|
|
|
"USE_LUA=yes"
|
2017-03-29 12:27:50 +02:00
|
|
|
"LUA_LIB=${lua5_3}/lib"
|
|
|
|
"LUA_INC=${lua5_3}/include"
|
2017-03-14 21:39:40 +01:00
|
|
|
] ++ stdenv.lib.optional stdenv.isDarwin "CC=cc";
|
2013-07-03 03:36:15 +02:00
|
|
|
|
2012-05-18 09:50:10 +02:00
|
|
|
meta = {
|
2013-10-06 11:49:53 +02:00
|
|
|
description = "Reliable, high performance TCP/HTTP load balancer";
|
|
|
|
longDescription = ''
|
|
|
|
HAProxy is a free, very fast and reliable solution offering high
|
|
|
|
availability, load balancing, and proxying for TCP and HTTP-based
|
|
|
|
applications. It is particularly suited for web sites crawling under very
|
|
|
|
high loads while needing persistence or Layer7 processing. Supporting
|
|
|
|
tens of thousands of connections is clearly realistic with todays
|
|
|
|
hardware.
|
|
|
|
'';
|
2013-07-03 12:41:27 +02:00
|
|
|
homepage = http://haproxy.1wt.eu;
|
2017-03-29 12:27:50 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ fuzzy-id garbas ];
|
2017-03-07 18:50:45 +01:00
|
|
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
2015-03-26 19:32:37 +01:00
|
|
|
license = stdenv.lib.licenses.gpl2;
|
2012-05-18 09:50:10 +02:00
|
|
|
};
|
|
|
|
}
|