2021-10-06 13:57:05 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, perl, file, nettools, iputils, iproute2, makeWrapper
|
2020-04-24 23:36:52 +00:00
|
|
|
, coreutils, gnused, openldap ? null
|
|
|
|
, buildPackages, lib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "dhcp";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "4.4.2-P1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://ftp.isc.org/isc/dhcp/${version}/${pname}-${version}.tar.gz";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "06jsr0cg5rsmyibshrpcb9za0qgwvqccashdma7mlm1rflrh8pmh";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches =
|
|
|
|
[
|
|
|
|
# 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
|
2021-10-06 13:57:05 +00:00
|
|
|
|
|
|
|
(fetchpatch {
|
|
|
|
# upstream build fix against -fno-common compilers like >=gcc-10
|
|
|
|
url = "https://gitlab.isc.org/isc-projects/dhcp/-/commit/6c7e61578b1b449272dbb40dd8b98d03dad8a57a.patch";
|
|
|
|
sha256 = "1g37ix0yf9zza8ri8bg438ygcjviniblfyb20y4gzc8lysy28m8b";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ perl makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
buildInputs = [ openldap ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-failover"
|
|
|
|
"--enable-execute"
|
|
|
|
"--enable-tracing"
|
|
|
|
"--enable-delayed-ack"
|
|
|
|
"--enable-dhcpv6"
|
|
|
|
"--enable-paranoia"
|
|
|
|
"--enable-early-chroot"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
|
|
|
] ++ lib.optional stdenv.isLinux "--with-randomdev=/dev/random"
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = builtins.toString [
|
|
|
|
"-Wno-error=pointer-compare"
|
|
|
|
"-Wno-error=format-truncation"
|
|
|
|
"-Wno-error=stringop-truncation"
|
|
|
|
"-Wno-error=format-overflow"
|
2021-01-05 17:05:55 +00:00
|
|
|
"-Wno-error=stringop-overflow=8"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [ "DESTDIR=\${out}" ];
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
''
|
|
|
|
mv $out/$out/* $out
|
|
|
|
DIR=$out/$out
|
|
|
|
while rmdir $DIR 2>/dev/null; do
|
|
|
|
DIR="$(dirname "$DIR")"
|
|
|
|
done
|
|
|
|
|
|
|
|
cp client/scripts/linux $out/sbin/dhclient-script
|
|
|
|
substituteInPlace $out/sbin/dhclient-script \
|
2021-04-05 15:23:46 +00:00
|
|
|
--replace /sbin/ip ${iproute2}/sbin/ip
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram "$out/sbin/dhclient-script" --prefix PATH : \
|
|
|
|
"${nettools}/bin:${nettools}/sbin:${iputils}/bin:${coreutils}/bin:${gnused}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
|
|
|
|
sed -i "includes/dhcpd.h" \
|
2021-01-05 17:05:55 +00:00
|
|
|
-e "s|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar'
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +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.
|
|
|
|
'';
|
|
|
|
|
|
|
|
homepage = "https://www.isc.org/dhcp/";
|
2021-07-14 22:03:04 +00:00
|
|
|
license = licenses.mpl20;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|