dhcp: cross compile

This commit is contained in:
Michael Eden 2019-03-23 00:44:16 -04:00 committed by Frederik Rietdijk
parent a55aa5e9a8
commit d888baa517
1 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper { stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper
, coreutils, gnused, openldap ? null , coreutils, gnused, openldap ? null
, buildPackages, lib
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -19,7 +20,11 @@ stdenv.mkDerivation rec {
./set-hostname.patch ./set-hostname.patch
]; ];
buildInputs = [ perl makeWrapper openldap ]; nativeBuildInputs = [ perl ];
buildInputs = [ makeWrapper openldap ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
configureFlags = [ configureFlags = [
"--enable-failover" "--enable-failover"
@ -31,6 +36,7 @@ stdenv.mkDerivation rec {
"--enable-early-chroot" "--enable-early-chroot"
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--localstatedir=/var" "--localstatedir=/var"
(lib.optional stdenv.isLinux "--with-randomdev=/dev/random")
] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ]; ] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];
NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-compare" ]; NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-compare" ];
@ -57,6 +63,8 @@ stdenv.mkDerivation rec {
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file" substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
sed -i "includes/dhcpd.h" \ sed -i "includes/dhcpd.h" \
-"es|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g" -"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; { meta = with stdenv.lib; {