Skip to content

Commit a8d6e4b

Browse files
authored
hping: 20051105 -> 2014-12-26 (#94683)
1 parent 02590c9 commit a8d6e4b

1 file changed

Lines changed: 23 additions & 32 deletions

File tree

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,41 @@
1-
{ stdenv, fetchurl, libpcap, tcl }:
1+
{ stdenv, fetchFromGitHub, libpcap, withTcl ? true, tcl }:
22

33
stdenv.mkDerivation rec {
44
pname = "hping";
5-
version = "20051105";
5+
version = "2014-12-26";
66

7-
src = fetchurl {
8-
url = "http://www.hping.org/hping3-${version}.tar.gz";
9-
sha256 = "1s5f9xd1msx05ibhwaw37jmc7l9fahcxxslqz8a83p0i5ak739pm";
7+
src = fetchFromGitHub {
8+
owner = "antirez";
9+
repo = pname;
10+
rev = "3547c7691742c6eaa31f8402e0ccbb81387c1b99"; # there are no tags/releases
11+
sha256 = "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb";
1012
};
1113

12-
buildInputs = [ libpcap tcl ];
14+
buildInputs = [ libpcap ] ++ stdenv.lib.optional withTcl tcl;
1315

14-
configurePhase = ''
15-
MANPATH="$out/share/man" ./configure
16-
sed -i -r -e 's|/usr(/s?bin)|'"$out"'\1|g' Makefile
17-
'';
18-
19-
TCLSH = "${tcl}/bin/tclsh";
20-
21-
prePatch = ''
22-
sed -i -e '/#if.*defined(__i386__)/a \
23-
|| defined(__x86_64__) \\
24-
' bytesex.h
25-
26-
sed -i -e 's|#include.*net/bpf.h|#include <pcap/bpf.h>|' \
16+
postPatch = ''
17+
substituteInPlace Makefile.in --replace "gcc" "$CC"
18+
substituteInPlace version.c --replace "RELEASE_DATE" "\"$version\""
19+
'' + stdenv.lib.optionalString stdenv.isLinux ''
20+
sed -i -e 's|#include <net/bpf.h>|#include <pcap/bpf.h>|' \
2721
libpcap_stuff.c script.c
28-
29-
sed -i -r -e 's|"(/usr/(local/)?)?bin/"|"${tcl}/bin"|g' \
30-
-e 's!/usr/(local/)?(lib|include)!${tcl}/\2!g' \
31-
configure
3222
'';
3323

34-
preInstall = ''
35-
mkdir -vp "$out/sbin" "$out/share/man/man8"
36-
'';
24+
configureFlags = [ (if withTcl then "TCLSH=${tcl}/bin/tclsh" else "--no-tcl") ];
3725

38-
postInstall = ''
39-
ln -vs hping3.8.gz "$out/share/man/man8/hping.8.gz"
40-
ln -vs hping3.8.gz "$out/share/man/man8/hping2.8.gz"
26+
installPhase = ''
27+
install -Dm755 hping3 -t $out/sbin
28+
ln -s $out/sbin/hping3 $out/sbin/hping
29+
ln -s $out/sbin/hping3 $out/sbin/hping2
30+
install -Dm644 docs/hping3.8 -t $out/share/man/man8
31+
ln -s hping3.8.gz $out/share/man/man8/hping.8.gz
32+
ln -s hping3.8.gz $out/share/man/man8/hping2.8.gz
4133
'';
4234

4335
meta = with stdenv.lib; {
4436
description = "A command-line oriented TCP/IP packet assembler/analyzer";
4537
homepage = "http://www.hping.org/";
46-
license = licenses.gpl2;
47-
platforms = platforms.all;
48-
broken = stdenv.isDarwin;
38+
license = licenses.gpl2Only;
39+
platforms = platforms.unix;
4940
};
5041
}

0 commit comments

Comments
 (0)