From 2fdb8597162d722e302fe43c3a80ecfe1670616c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 3 Sep 2021 14:02:58 +0000 Subject: [PATCH] netbsd: Make hard/soft float match systems settings --- .../bsd/netbsd/compat-no-force-native.patch | 3 +- pkgs/os-specific/bsd/netbsd/default.nix | 35 ++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch b/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch index 3b6548779bdd..cd442d95f412 100644 --- a/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch +++ b/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch @@ -16,7 +16,8 @@ index 4bcf227f0e75..9ed1d6eea6ff 100644 -HOSTLIB= nbcompat +LIB= nbcompat - .include +-.include ++.include @@ -94,63 +94,37 @@ include/.stamp: diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index 73d5bd26e10a..86c89a995a69 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -28,6 +28,12 @@ let selfTargetTarget = pkgsTargetTarget.netbsd or {}; # might be missing }; + defaultMakeFlags = [ + "MKSOFTFLOAT=${if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft" + then "yes" + else "no"}" + ]; + in lib.makeScopeWithSplicing splicePackages newScope @@ -90,6 +96,8 @@ in lib.makeScopeWithSplicing BSD_PATH = attrs.path; + makeFlags = defaultMakeFlags; + strictDeps = true; meta = with lib; { @@ -97,6 +105,7 @@ in lib.makeScopeWithSplicing platforms = platforms.unix; license = licenses.bsd2; }; + } // lib.optionalAttrs stdenv'.hasCC { # TODO should CC wrapper set this? CPP = "${stdenv'.cc.targetPrefix}cpp"; @@ -185,12 +194,14 @@ in lib.makeScopeWithSplicing # temporarily use gnuinstall for bootstrapping # bsdinstall will be built later - makeFlags = [ + makeFlags = defaultMakeFlags ++ [ "INSTALL=${buildPackages.coreutils}/bin/install" "DATADIR=$(out)/share" # Can't sort object files yet "LORDER=echo" "TSORT=cat" + # Can't process man pages yet + "MKSHARE=no" ]; RENAME = "-D"; @@ -493,7 +504,7 @@ in lib.makeScopeWithSplicing makeMinimal install mandoc groff nbperf ]; - makeFlags = [ "TOOLDIR=$(out)" ]; + makeFlags = defaultMakeFlags ++ [ "TOOLDIR=$(out)" ]; extraPaths = with self; [ libterminfo.src (fetchNetBSD "usr.bin/tic" "9.2" "1mwdfg7yx1g43ss378qsgl5rqhsxskqvsd2mqvrn38qw54i8v5i1") @@ -563,7 +574,7 @@ in lib.makeScopeWithSplicing headersOnly = true; noCC = true; meta.platforms = lib.platforms.netbsd; - makeFlags = [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ]; + makeFlags = defaultMakeFlags ++ [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ]; }; common = fetchNetBSD "common" "9.2" "1pfylz9r3ap5wnwwbwczbfjb1m5qdyspzbnmxmcdkpzz2zgj64b9"; @@ -602,7 +613,7 @@ in lib.makeScopeWithSplicing # multiple header dirs, see above + self.include.postConfigure; - makeFlags = [ "FIRMWAREDIR=$(out)/libdata/firmware" ]; + makeFlags = defaultMakeFlags ++ [ "FIRMWAREDIR=$(out)/libdata/firmware" ]; hardeningDisable = [ "pic" ]; MKKMOD = "no"; NIX_CFLAGS_COMPILE = [ "-Wa,--no-warn" ]; @@ -670,7 +681,7 @@ in lib.makeScopeWithSplicing buildInputs = with self; [ libterminfo libcurses ]; propagatedBuildInputs = with self; compatIfNeeded; SHLIBINSTALLDIR = "$(out)/lib"; - makeFlags = [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; + makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; postPatch = '' sed -i '1i #undef bool_t' el.h substituteInPlace config.h \ @@ -722,7 +733,7 @@ in lib.makeScopeWithSplicing ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)="; propagatedBuildInputs = with self; compatIfNeeded; MKDOC = "no"; # missing vfontedpr - makeFlags = [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; + makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; postPatch = lib.optionalString (!stdenv.isDarwin) '' substituteInPlace printw.c \ --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \ @@ -749,7 +760,7 @@ in lib.makeScopeWithSplicing path = "lib/librpcsvc"; version = "9.2"; sha256 = "1q34pfiyjbrgrdqm46jwrsqms49ly6z3b0xh1wg331zga900vq5n"; - makeFlags = [ "INCSDIR=$(out)/include/rpcsvc" ]; + makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(out)/include/rpcsvc" ]; meta.platforms = lib.platforms.netbsd; nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook netbsdSetupHook @@ -848,7 +859,7 @@ in lib.makeScopeWithSplicing # Hack to prevent a symlink being installed here for compatibility. SHLINKINSTALLDIR = "/usr/libexec"; USE_FORT = "yes"; - makeFlags = [ "BINDIR=$(out)/libexec" "CLIBOBJ=${self.libc}/lib" ]; + makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/libexec" "CLIBOBJ=${self.libc}/lib" ]; extraPaths = with self; [ libc.src ] ++ libc.extraPaths; }; @@ -879,7 +890,7 @@ in lib.makeScopeWithSplicing SHLIBINSTALLDIR = "$(out)/lib"; MKPICINSTALL = "yes"; NLSDIR = "$(out)/share/nls"; - makeFlags = [ "FILESDIR=$(out)/var/db"]; + makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db"]; postInstall = '' pushd ${self.headers} find . -type d -exec mkdir -p $out/\{} \; @@ -933,7 +944,7 @@ in lib.makeScopeWithSplicing noCC = true; version = "9.2"; sha256 = "0svfc0byk59ri37pyjslv4c4rc7zw396r73mr593i78d39q5g3ad"; - makeFlags = [ "BINDIR=$(out)/share" ]; + makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ]; }; misc = mkDerivation { @@ -941,7 +952,7 @@ in lib.makeScopeWithSplicing noCC = true; version = "9.2"; sha256 = "1j2cdssdx6nncv8ffj7f7ybl7m9hadjj8vm8611skqdvxnjg6nbc"; - makeFlags = [ "BINDIR=$(out)/share" ]; + makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ]; }; man = mkDerivation { @@ -949,7 +960,7 @@ in lib.makeScopeWithSplicing noCC = true; version = "9.2"; sha256 = "1l4lmj4kmg8dl86x94sr45w0xdnkz8dn4zjx0ipgr9bnq98663zl"; - makeFlags = [ "FILESDIR=$(out)/share" ]; + makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/share" ]; }; # # END MISCELLANEOUS