summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/farpd/default.nix
blob: 8dfcee90c99b0785c9d860a60d623058bd99fa4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv, lib, pkgs, fetchurl,fetchFromGitHub,
  libpcap, libdnet, libevent, readline, autoconf, automake, libtool, zlib, pcre,
  ... }:
stdenv.mkDerivation rec {
  name = "farpd-${version}";


  version  = "0.2";
  src = fetchurl {
    url = https://launchpad.net/ubuntu/+archive/primary/+files/farpd_0.2.orig.tar.gz ;
    sha256 = "1m3pynvynr4vgkwh7z5i0yqlang2y0ph32cys3vbi2hx2apk9abd";
  };

  buildInputs = with pkgs;[
    automake
    gnugrep
    libpcap
    libdnet
    pcre
    libevent.out # requires .so and .h
    readline
    autoconf
    libtool
    zlib
    coreutils
    python
    pythonPackages.pysqlite
  ];
  patches = [
    ( fetchurl {
      url = https://launchpad.net/ubuntu/+archive/primary/+files/farpd_0.2-11.diff.gz;
      sha256 = "2c246b37de8aab9c73f955fb77101adefd90637d03f582b9f8ffae2903af2f94";
    })
  ];
  # removes user install script from Makefile before automake
  #patches = [ ./autoconf.patch ];
  preConfigure = ''
    autoreconf -fi

    substituteInPlace configure \
      --replace "dumbnet" "dnet" \
      --replace "libpcap.a" "libpcap.so" \
      --replace "libevent.a" "libevent.so" \
      --replace "net/bpf.h" "pcap/bpf.h"
  '';

  makeFlags = [ "LIBS=-lz" ];
  configureFlags = [
    "--with-libpcap=${libpcap}"
    "--with-libevent=${libevent}"
    "--with-libdnet=${libdnet}"
  ];
  postInstall = ''
    mv $out/sbin/arpd $out/sbin/farpd
    mv $out/share/man/man8/arpd.8 $out/share/man/man8/farpd.8
  '';

  meta = {
    homepage = https://launchpad.net/ubuntu/+source/farpd/ ;
    description = "fake arp";
    license = lib.licenses.gpl2;
  };
}