Skip to content

Commit

Permalink
dhcp: cross compile
Browse files Browse the repository at this point in the history
  • Loading branch information
illegalprime committed Mar 27, 2019
1 parent 749c0a9 commit f9a4a6e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkgs/tools/networking/dhcp/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper
, coreutils, gnused, openldap ? null
, buildPackages, lib
}:

stdenv.mkDerivation rec {
Expand All @@ -19,7 +20,11 @@ stdenv.mkDerivation rec {
./set-hostname.patch
];

buildInputs = [ perl makeWrapper openldap ];
nativeBuildInputs = [ perl ];

buildInputs = [ makeWrapper openldap ];

depsBuildBuild = [ buildPackages.stdenv.cc ];

configureFlags = [
"--enable-failover"
Expand All @@ -31,6 +36,7 @@ stdenv.mkDerivation rec {
"--enable-early-chroot"
"--sysconfdir=/etc"
"--localstatedir=/var"
(lib.optional stdenv.isLinux "--with-randomdev=/dev/random")
] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];

NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-compare" ];
Expand All @@ -57,6 +63,8 @@ stdenv.mkDerivation rec {
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
sed -i "includes/dhcpd.h" \
-"es|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar'
'';

meta = with stdenv.lib; {
Expand Down

0 comments on commit f9a4a6e

Please sign in to comment.