2015-03-26 19:27:48 +00:00
|
|
|
{ stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper
|
|
|
|
, coreutils, gnused, bind, openldap ? null
|
|
|
|
}:
|
2005-08-21 16:11:25 +00:00
|
|
|
|
2009-07-23 23:57:11 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2014-06-24 21:58:38 +00:00
|
|
|
name = "dhcp-${version}";
|
2015-09-17 20:14:12 +00:00
|
|
|
version = "4.3.3";
|
2009-07-23 23:57:11 +00:00
|
|
|
|
2005-08-21 16:11:25 +00:00
|
|
|
src = fetchurl {
|
2014-06-24 21:58:38 +00:00
|
|
|
url = "http://ftp.isc.org/isc/dhcp/${version}/${name}.tar.gz";
|
2015-09-17 20:14:12 +00:00
|
|
|
sha256 = "1pjy4lylx7dww1fp2mk5ikya5vxaf97z70279j81n74vn12ljg2m";
|
2005-08-21 16:11:25 +00:00
|
|
|
};
|
2008-05-08 22:08:58 +00:00
|
|
|
|
2009-09-29 16:14:33 +00:00
|
|
|
patches =
|
|
|
|
[ # Don't bring down interfaces, because wpa_supplicant doesn't
|
|
|
|
# recover when the wlan interface goes down. Instead just flush
|
|
|
|
# all addresses, routes and neighbours of the interface.
|
|
|
|
./flush-if.patch
|
2011-04-01 15:04:20 +00:00
|
|
|
|
|
|
|
# Make sure that the hostname gets set on reboot. Without this
|
|
|
|
# patch, the hostname doesn't get set properly if the old
|
|
|
|
# hostname (i.e. before reboot) is equal to the new hostname.
|
|
|
|
./set-hostname.patch
|
2009-09-29 16:14:33 +00:00
|
|
|
];
|
|
|
|
|
2009-07-23 23:57:11 +00:00
|
|
|
# Fixes "socket.c:591: error: invalid application of 'sizeof' to
|
|
|
|
# incomplete type 'struct in6_pktinfo'". See
|
|
|
|
# http://www.mail-archive.com/blfs-book@linuxfromscratch.org/msg13013.html
|
2014-06-24 21:58:38 +00:00
|
|
|
#
|
|
|
|
# Also adds the ability to run dhcpd as a non-root user / group
|
|
|
|
NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE -DPARANOIA";
|
2008-05-08 22:08:58 +00:00
|
|
|
|
2009-12-23 08:55:32 +00:00
|
|
|
# It would automatically add -Werror, which disables build in gcc 4.4
|
|
|
|
# due to an uninitialized variable.
|
|
|
|
CFLAGS = "-g -O2 -Wall";
|
|
|
|
|
2015-05-24 22:05:17 +00:00
|
|
|
buildInputs = [ perl makeWrapper openldap bind ];
|
2015-03-26 19:27:48 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-libbind=${bind}"
|
|
|
|
"--enable-failover"
|
|
|
|
"--enable-execute"
|
|
|
|
"--enable-tracing"
|
|
|
|
"--enable-delayed-ack"
|
|
|
|
"--enable-dhcpv6"
|
|
|
|
"--enable-paranoia"
|
|
|
|
"--enable-early-chroot"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
|
|
|
] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];
|
|
|
|
|
|
|
|
installFlags = [ "DESTDIR=\${out}" ];
|
2008-03-14 13:40:32 +00:00
|
|
|
|
2009-07-23 23:57:11 +00:00
|
|
|
postInstall =
|
|
|
|
''
|
2015-03-26 19:27:48 +00:00
|
|
|
mv $out/$out/* $out
|
|
|
|
DIR=$out/$out
|
|
|
|
while rmdir $DIR 2>/dev/null; do
|
|
|
|
DIR="$(dirname "$DIR")"
|
|
|
|
done
|
|
|
|
|
2009-07-23 23:57:11 +00:00
|
|
|
cp client/scripts/linux $out/sbin/dhclient-script
|
|
|
|
substituteInPlace $out/sbin/dhclient-script \
|
|
|
|
--replace /sbin/ip ${iproute}/sbin/ip
|
|
|
|
wrapProgram "$out/sbin/dhclient-script" --prefix PATH : \
|
2010-08-06 10:34:34 +00:00
|
|
|
"${nettools}/bin:${nettools}/sbin:${iputils}/bin:${coreutils}/bin:${gnused}/bin"
|
2009-07-23 23:57:11 +00:00
|
|
|
'';
|
2008-03-14 13:40:32 +00:00
|
|
|
|
2009-09-29 16:14:33 +00:00
|
|
|
preConfigure =
|
|
|
|
''
|
2014-06-24 21:58:38 +00:00
|
|
|
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
|
2009-07-30 10:04:48 +00:00
|
|
|
sed -i "includes/dhcpd.h" \
|
|
|
|
-"es|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
|
2009-09-29 16:14:33 +00:00
|
|
|
'';
|
2009-07-30 10:04:48 +00:00
|
|
|
|
2014-08-07 04:08:10 +00:00
|
|
|
meta = with stdenv.lib; {
|
2008-05-08 22:08:58 +00:00
|
|
|
description = "Dynamic Host Configuration Protocol (DHCP) tools";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
ISC's Dynamic Host Configuration Protocol (DHCP) distribution
|
|
|
|
provides a freely redistributable reference implementation of
|
|
|
|
all aspects of DHCP, through a suite of DHCP tools: server,
|
|
|
|
client, and relay agent.
|
|
|
|
'';
|
|
|
|
|
2008-03-14 13:40:32 +00:00
|
|
|
homepage = http://www.isc.org/products/DHCP/;
|
2014-08-07 04:08:10 +00:00
|
|
|
license = licenses.isc;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ wkennington ];
|
2008-03-14 13:40:32 +00:00
|
|
|
};
|
2005-08-21 16:11:25 +00:00
|
|
|
}
|