git.iko.soy/typeable/nixpkgs
on master help sign in
libreswan: fix build with glibc 2.26

It is not trivial to update libreswan to 3.22 because it has added a dependency on ldns which currently depends on openssl 1.1.0, while the rest of libreswan depends on openssl 1.0.2. It compiles, but may behave unpredictably at run time. Tracking issue: #31696

commita7daf37c3ec1e255a94b0479f027783c87954d35 authorOrivej Desh <orivej@gmx.fr> dateThu 16 Nov 2017, 02:43 (9 years ago) parentdc7ea3f
2 files changed+44−3
pkgs/tools/networking/libreswan/default.nix+8−3 pkgs/tools/networking/libreswan/libreswan-3.18-glibc-2.26.patch+36
pkgs/tools/networking/libreswan/default.nix+8−3
@@ -24,6 +24,9 @@ stdenv.mkDerivation {
2424 sha256 = "0zginnakxw7m79zrdvfdvliaiyg78zgqfqkks9z5d1rjj5w13xig";
2525 };
2626
27+ # These flags were added to compile v3.18. Try to lift them when updating.
28+ NIX_CFLAGS_COMPILE = [ "-Wno-error=redundant-decls" "-Wno-error=format-nonliteral" ];
29+
2730 nativeBuildInputs = [ makeWrapper pkgconfig ];
2831 buildInputs = [ bash iproute iptables systemd coreutils gnused gawk gmp unbound bison flex pam libevent
2932 libcap_ng curl nspr nss python ]
@@ -42,11 +45,13 @@ stdenv.mkDerivation {
4245 # Fix python script to use the correct python
4346 sed -i -e 's|#!/usr/bin/python|#!/usr/bin/env python|' -e 's/^\(\W*\)installstartcheck()/\1sscmd = "ss"\n\0/' programs/verify/verify.in
4447 '';
45−
48+
49+ patches = [ ./libreswan-3.18-glibc-2.26.patch ];
50+
4651 # Set appropriate paths for build
4752 preBuild = "export INC_USRLOCAL=\${out}";
4853
49− makeFlags = [
54+ makeFlags = [
5055 "INITSYSTEM=systemd"
5156 (if docs then "all" else "base")
5257 ];
@@ -64,7 +69,7 @@ stdenv.mkDerivation {
6469 done
6570 '';
6671
67− enableParallelBuilding = false;
72+ enableParallelBuilding = true;
6873
6974 meta = {
7075 homepage = https://libreswan.org;
pkgs/tools/networking/libreswan/libreswan-3.18-glibc-2.26.patchnew file+36
@@ -0,0 +1,36 @@
1+diff --git a/lib/libswan/id.c b/lib/libswan/id.c
2+index 8f06275..efb0394 100644
3+--- a/lib/libswan/id.c
4++++ b/lib/libswan/id.c
5+@@ -22,6 +22,7 @@
6+ #include <sys/socket.h>
7+ #include <netinet/in.h>
8+ #include <arpa/inet.h>
9++#include <limits.h>
10+ #include <unistd.h>
11+ #ifndef HOST_NAME_MAX /* POSIX 1003.1-2001 says <unistd.h> defines this */
12+ #define HOST_NAME_MAX 255 /* upper bound, according to SUSv2 */
13+diff --git a/linux/include/libreswan.h b/linux/include/libreswan.h
14+index c5efc6a..b0af4d7 100644
15+--- a/linux/include/libreswan.h
16++++ b/linux/include/libreswan.h
17+@@ -211,6 +211,7 @@ static inline deltatime_t monotimediff(monotime_t a, monotime_t b) {
18+ #include <assert.h>
19+ #define user_assert(foo) assert(foo)
20+ #include <stdio.h>
21++#include <stdint.h>
22+
23+ # define uint8_t u_int8_t
24+ # define uint16_t u_int16_t
25+diff --git a/programs/pluto/rcv_whack.c b/programs/pluto/rcv_whack.c
26+index 588c66c..4fc6289 100644
27+--- a/programs/pluto/rcv_whack.c
28++++ b/programs/pluto/rcv_whack.c
29+@@ -24,6 +24,7 @@
30+ #include <stddef.h>
31+ #include <stdlib.h>
32+ #include <string.h>
33++#include <limits.h>
34+ #include <unistd.h>
35+ #ifndef HOST_NAME_MAX /* POSIX 1003.1-2001 says <unistd.h> defines this */
36+ # define HOST_NAME_MAX 255 /* upper bound, according to SUSv2 */