summary refs log tree commit diff
path: root/pkgs/os-specific/linux/iputils
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/iputils')
-rw-r--r--pkgs/os-specific/linux/iputils/builder.sh20
-rw-r--r--pkgs/os-specific/linux/iputils/default.nix2
-rw-r--r--pkgs/os-specific/linux/iputils/open-max.patch30
3 files changed, 38 insertions, 14 deletions
diff --git a/pkgs/os-specific/linux/iputils/builder.sh b/pkgs/os-specific/linux/iputils/builder.sh
index d1b05109aee..b5219c3fefc 100644
--- a/pkgs/os-specific/linux/iputils/builder.sh
+++ b/pkgs/os-specific/linux/iputils/builder.sh
@@ -1,20 +1,11 @@
 source $stdenv/setup
 
-tar zxvf $src
-cd iputils
+makeFlags="KERNEL_INCLUDE=$kernelHeaders/include LIBC_INCLUDE=$glibc/include"
 
-sed -e "s^KERNEL_INCLUDE=.*$^KERNEL_INCLUDE=$kernelHeaders/include^" < Makefile > Makefile.new
-
-mv Makefile.new Makefile
-sed -e "s^LIBC_INCLUDE=.*$^LIBC_INCLUDE=$glibc/include^" < Makefile > Makefile.new
-mv Makefile.new Makefile
-
-#make ping arping tracepath
-make
-
-mkdir -p $out/bin
-mkdir -p $out/sbin
+preConfigure="sed -e 's@check-kernel @@' -i Makefile"
 
+installPhase="
+mkdir -pv $out/bin $out/sbin
 install -c arping $out/sbin/
 install -c ping $out/bin/
 install -c ping6 $out/sbin/
@@ -22,3 +13,6 @@ install -c rdisc $out/sbin/
 install -c tracepath $out/sbin/
 install -c tracepath6 $out/sbin/
 install -c traceroute6 $out/sbin/
+";
+
+genericBuild
diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix
index c57cf68fd5d..354419a4109 100644
--- a/pkgs/os-specific/linux/iputils/default.nix
+++ b/pkgs/os-specific/linux/iputils/default.nix
@@ -11,5 +11,5 @@ stdenv.mkDerivation {
   };
 
   inherit kernelHeaders glibc;
-  #buildInputs = [bison flex openssl];
+  patches = [ ./open-max.patch ];
 }
diff --git a/pkgs/os-specific/linux/iputils/open-max.patch b/pkgs/os-specific/linux/iputils/open-max.patch
new file mode 100644
index 00000000000..26bb95bd9d8
--- /dev/null
+++ b/pkgs/os-specific/linux/iputils/open-max.patch
@@ -0,0 +1,30 @@
+--- iputils-s20070202/rdisc.c.open-max	2007-08-07 11:34:03.000000000 +0200
++++ iputils-s20070202/rdisc.c	2007-08-07 11:41:30.000000000 +0200
+@@ -240,14 +240,25 @@
+ {
+ 	int t;
+ 	pid_t pid;
+-	
++	long open_max;
++
+ 	if (trace)
+ 		return;
+ 
++	if ((open_max = sysconf(_SC_OPEN_MAX)) == -1) {
++		if (errno == 0) {
++			(void) fprintf(stderr, "OPEN_MAX is not supported\n");
++		}
++		else {
++			(void) fprintf(stderr, "sysconf() error\n");
++		}
++		exit(1);
++	}
++
+ 	if ((pid=fork()) != 0)
+ 		exit(0);
+ 
+-	for (t = 0; t < OPEN_MAX; t++)
++	for (t = 0; t < open_max; t++)
+ 		if (t != s)
+ 			close(t);
+