2021-09-12 09:49:10 +02:00
|
|
|
{ stdenv, fetchurl, fetchpatch, perl, file, nettools, iputils, iproute2, makeWrapper
|
2016-09-28 03:39:11 +02:00
|
|
|
, coreutils, gnused, openldap ? null
|
2019-03-23 05:44:16 +01:00
|
|
|
, buildPackages, lib
|
2015-03-26 20:27:48 +01:00
|
|
|
}:
|
2005-08-21 18:11:25 +02:00
|
|
|
|
2009-07-24 01:57:11 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "dhcp";
|
2021-06-10 20:12:54 +02:00
|
|
|
version = "4.4.2-P1";
|
2016-09-28 03:39:11 +02:00
|
|
|
|
2005-08-21 18:11:25 +02:00
|
|
|
src = fetchurl {
|
2019-08-15 14:41:18 +02:00
|
|
|
url = "https://ftp.isc.org/isc/dhcp/${version}/${pname}-${version}.tar.gz";
|
2021-06-10 20:12:54 +02:00
|
|
|
sha256 = "06jsr0cg5rsmyibshrpcb9za0qgwvqccashdma7mlm1rflrh8pmh";
|
2005-08-21 18:11:25 +02:00
|
|
|
};
|
2008-05-09 00:08:58 +02:00
|
|
|
|
2009-09-29 18:14:33 +02:00
|
|
|
patches =
|
2018-01-08 17:33:59 +01:00
|
|
|
[
|
2011-04-01 17:04:20 +02: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
|
2021-09-12 09:49:10 +02: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";
|
|
|
|
})
|
2021-10-27 22:57:21 +02:00
|
|
|
|
|
|
|
# Fix parallel build failure, the patch is pending upstream inclusion:
|
|
|
|
# https://gitlab.isc.org/isc-projects/dhcp/-/merge_requests/76
|
|
|
|
(fetchpatch {
|
|
|
|
name = "parallel-make.patch";
|
|
|
|
url = "https://gitlab.isc.org/isc-projects/dhcp/-/commit/46d101b97c5a3b19a3f63f7b60e5f88994a64e22.patch";
|
|
|
|
sha256 = "1y3nsmqjzcg4bhp1xmqp47v7rkl3bpcildkx6mlrg255yvxapmdp";
|
|
|
|
})
|
2009-09-29 18:14:33 +02:00
|
|
|
];
|
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
nativeBuildInputs = [ perl makeWrapper ];
|
2019-03-23 05:44:16 +01:00
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
buildInputs = [ openldap ];
|
2019-03-23 05:44:16 +01:00
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2015-03-26 20:27:48 +01:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-failover"
|
|
|
|
"--enable-execute"
|
|
|
|
"--enable-tracing"
|
|
|
|
"--enable-delayed-ack"
|
|
|
|
"--enable-dhcpv6"
|
|
|
|
"--enable-paranoia"
|
|
|
|
"--enable-early-chroot"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
2019-11-20 09:21:30 +01:00
|
|
|
] ++ lib.optional stdenv.isLinux "--with-randomdev=/dev/random"
|
2021-12-21 14:26:15 +01:00
|
|
|
++ lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ]
|
|
|
|
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "BUILD_CC=$(CC_FOR_BUILD)";
|
2015-03-26 20:27:48 +01:00
|
|
|
|
2019-10-30 01:12:09 +01:00
|
|
|
NIX_CFLAGS_COMPILE = builtins.toString [
|
2018-05-16 23:36:32 +02:00
|
|
|
"-Wno-error=pointer-compare"
|
|
|
|
"-Wno-error=format-truncation"
|
2019-11-02 23:41:50 +01:00
|
|
|
"-Wno-error=stringop-truncation"
|
|
|
|
"-Wno-error=format-overflow"
|
2020-06-08 14:21:49 +02:00
|
|
|
"-Wno-error=stringop-overflow=8"
|
2018-05-16 23:36:32 +02:00
|
|
|
];
|
2017-11-12 12:16:47 +01:00
|
|
|
|
2015-03-26 20:27:48 +01:00
|
|
|
installFlags = [ "DESTDIR=\${out}" ];
|
2008-03-14 14:40:32 +01:00
|
|
|
|
2009-07-24 01:57:11 +02:00
|
|
|
postInstall =
|
|
|
|
''
|
2015-03-26 20:27:48 +01:00
|
|
|
mv $out/$out/* $out
|
|
|
|
DIR=$out/$out
|
|
|
|
while rmdir $DIR 2>/dev/null; do
|
|
|
|
DIR="$(dirname "$DIR")"
|
|
|
|
done
|
|
|
|
|
2009-07-24 01:57:11 +02:00
|
|
|
cp client/scripts/linux $out/sbin/dhclient-script
|
|
|
|
substituteInPlace $out/sbin/dhclient-script \
|
2021-03-14 17:05:16 +01:00
|
|
|
--replace /sbin/ip ${iproute2}/sbin/ip
|
2009-07-24 01:57:11 +02:00
|
|
|
wrapProgram "$out/sbin/dhclient-script" --prefix PATH : \
|
2010-08-06 12:34:34 +02:00
|
|
|
"${nettools}/bin:${nettools}/sbin:${iputils}/bin:${coreutils}/bin:${gnused}/bin"
|
2009-07-24 01:57:11 +02:00
|
|
|
'';
|
2008-03-14 14:40:32 +01:00
|
|
|
|
2009-09-29 18:14:33 +02:00
|
|
|
preConfigure =
|
|
|
|
''
|
2014-06-24 23:58:38 +02:00
|
|
|
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
|
2009-07-30 12:04:48 +02:00
|
|
|
sed -i "includes/dhcpd.h" \
|
2020-10-26 15:19:52 +01:00
|
|
|
-e "s|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
|
2019-03-23 05:44:16 +01:00
|
|
|
|
|
|
|
export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar'
|
2009-09-29 18:14:33 +02:00
|
|
|
'';
|
2009-07-30 12:04:48 +02:00
|
|
|
|
2021-10-27 22:57:21 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2008-05-09 00:08:58 +02: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.
|
|
|
|
'';
|
|
|
|
|
2020-01-10 01:34:25 +01:00
|
|
|
homepage = "https://www.isc.org/dhcp/";
|
2021-07-11 22:11:33 +02:00
|
|
|
license = licenses.mpl20;
|
2014-08-07 06:08:10 +02:00
|
|
|
platforms = platforms.unix;
|
2008-03-14 14:40:32 +01:00
|
|
|
};
|
2005-08-21 18:11:25 +02:00
|
|
|
}
|