summary refs log tree commit diff
diff options
context:
space:
mode:
authormidchildan <git@midchildan.org>2021-12-11 03:39:27 +0900
committermidchildan <git@midchildan.org>2021-12-11 03:39:27 +0900
commitf720cf68d09b57ebe23904ba7933871be7935bb6 (patch)
treeaf6ab7b6c1d868c4243a14642e27d1dbb55cd73d
parent5030bcc5637e68b62ffb6cac098861c8f8193d7c (diff)
downloadnixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar.gz
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar.bz2
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar.lz
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar.xz
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.tar.zst
nixpkgs-f720cf68d09b57ebe23904ba7933871be7935bb6.zip
socat: fix darwin build by adding missing feature check
-rw-r--r--pkgs/tools/networking/socat/default.nix7
-rw-r--r--pkgs/tools/networking/socat/socat-fix-feature-check-tcpinfo.patch21
2 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/tools/networking/socat/default.nix b/pkgs/tools/networking/socat/default.nix
index 8dac32cef5a..b26760a7294 100644
--- a/pkgs/tools/networking/socat/default.nix
+++ b/pkgs/tools/networking/socat/default.nix
@@ -16,6 +16,13 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-ZpCp+ZkEV7UFCXonK78sv0zDVXYXb3ZkbjUksOkcF2M=";
   };
 
+  patches = [
+    # This adds missing feature checks for TCP_INFO, a Linux feature
+    #
+    # Discussed in https://github.com/Homebrew/homebrew-core/pull/88595
+    ./socat-fix-feature-check-tcpinfo.patch
+  ];
+
   postPatch = ''
     patchShebangs test.sh
     substituteInPlace test.sh \
diff --git a/pkgs/tools/networking/socat/socat-fix-feature-check-tcpinfo.patch b/pkgs/tools/networking/socat/socat-fix-feature-check-tcpinfo.patch
new file mode 100644
index 00000000000..ec0ea88359c
--- /dev/null
+++ b/pkgs/tools/networking/socat/socat-fix-feature-check-tcpinfo.patch
@@ -0,0 +1,21 @@
+diff --git a/filan.c b/filan.c
+index 3465f7c..77c22a4 100644
+--- a/filan.c
++++ b/filan.c
+@@ -905,6 +905,7 @@ int tcpan(int fd, FILE *outfile) {
+ #if WITH_TCP
+ 
+ int tcpan2(int fd, FILE *outfile) {
++#ifdef TCP_INFO
+    struct tcp_info tcpinfo;
+    socklen_t tcpinfolen = sizeof(tcpinfo);
+    int result;
+@@ -930,6 +931,8 @@ int tcpan2(int fd, FILE *outfile) {
+    // fprintf(outfile, "%s={%u}\t", "TCPI_", tcpinfo.tcpi_);
+ 
+    return 0;
++#endif
++   return -1;
+ }
+ 
+ #endif /* WITH_TCP */