diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-10-06 00:51:05 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-10-06 15:33:28 -0400 |
commit | dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053 (patch) | |
tree | d87630adc2508824be5623c858a9babe632b4ef7 /pkgs/os-specific/bsd/netbsd/default.nix | |
parent | 3413bc7d800ce97618751e072b8d3113efc8da37 (diff) | |
download | nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar.gz nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar.bz2 nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar.lz nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar.xz nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.tar.zst nixpkgs-dcf7a5ec3dac6a53ce1a27e0806bd93309b9d053.zip |
netbsd: Adapt to BSD-common infra changes for FreeBSD
See https://github.com/NixOS/nixpkgs/pull/82131 for the rest of the changes for FreeBSD. This is PRed separately because it is a macOS moderate rebuild so we target staging. The main change is that we CD to the path we're building *after* applying patches, so we can patch other parts of the tree (from `extraPaths`) as needed. Another change is that `netbsd.install` no longer depends on `fts`, which it evidently no longer needs.
Diffstat (limited to 'pkgs/os-specific/bsd/netbsd/default.nix')
-rw-r--r-- | pkgs/os-specific/bsd/netbsd/default.nix | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index ae93d42b676..82e7dafdd3b 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -3,7 +3,7 @@ , buildPackages, splicePackages, newScope , bsdSetupHook, makeSetupHook, fetchcvs, groff, mandoc, byacc, flex , zlib -, writeText, symlinkJoin +, writeScript, writeText, runtimeShell, symlinkJoin }: let @@ -121,12 +121,12 @@ in lib.makeScopeWithSplicing installPhase = "includesPhase"; dontBuild = true; } // attrs // { + # Files that use NetBSD-specific macros need to have nbtool_config.h + # included ahead of them on non-NetBSD platforms. postPatch = lib.optionalString (!stdenv'.hostPlatform.isNetBSD) '' - # Files that use NetBSD-specific macros need to have nbtool_config.h - # included ahead of them on non-NetBSD platforms. set +e grep -Zlr "^__RCSID - ^__BEGIN_DECLS" | xargs -0r grep -FLZ nbtool_config.h | + ^__BEGIN_DECLS" $BSD_PATH | xargs -0r grep -FLZ nbtool_config.h | xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/' set -e '' + attrs.postPatch or ""; @@ -146,7 +146,7 @@ in lib.makeScopeWithSplicing skipIncludesPhase = true; postPatch = '' - patchShebangs configure + patchShebangs $BSD_PATH/configure ${self.make.postPatch} ''; @@ -281,11 +281,12 @@ in lib.makeScopeWithSplicing # HACK: to ensure parent directories exist. This emulates GNU # install’s -D option. No alternative seems to exist in BSD install. - install = let binstall = writeText "binstall" '' - #!${stdenv.shell} - for last in $@; do true; done + install = let binstall = writeScript "binstall" '' + #!${runtimeShell} + set -eu + for last in "$@"; do true; done mkdir -p $(dirname $last) - xinstall "$@" + @out@/bin/xinstall "$@" ''; in mkDerivation { path = "usr.bin/xinstall"; version = "9.2"; @@ -297,13 +298,14 @@ in lib.makeScopeWithSplicing mandoc groff rsync ]; skipIncludesPhase = true; - buildInputs = with self; compatIfNeeded ++ [ fts ]; + buildInputs = with self; compatIfNeeded; installPhase = '' runHook preInstall install -D install.1 $out/share/man/man1/install.1 install -D xinstall $out/bin/xinstall install -D -m 0550 ${binstall} $out/bin/binstall + substituteInPlace $out/bin/binstall --subst-var out ln -s $out/bin/binstall $out/bin/install runHook postInstall @@ -391,6 +393,7 @@ in lib.makeScopeWithSplicing install mandoc groff rsync ]; }; + ## ## END BOOTSTRAPPING ## @@ -705,10 +708,10 @@ in lib.makeScopeWithSplicing SHLIBINSTALLDIR = "$(out)/lib"; makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; postPatch = '' - sed -i '1i #undef bool_t' el.h - substituteInPlace config.h \ + sed -i '1i #undef bool_t' $BSD_PATH/el.h + substituteInPlace $BSD_PATH/config.h \ --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" "" - substituteInPlace readline/Makefile --replace /usr/include "$out/include" + substituteInPlace $BSD_PATH/readline/Makefile --replace /usr/include "$out/include" ''; NIX_CFLAGS_COMPILE = [ "-D__noinline=" @@ -728,8 +731,8 @@ in lib.makeScopeWithSplicing buildInputs = with self; compatIfNeeded; SHLIBINSTALLDIR = "$(out)/lib"; postPatch = '' - substituteInPlace term.c --replace /usr/share $out/share - substituteInPlace setupterm.c \ + substituteInPlace $BSD_PATH/term.c --replace /usr/share $out/share + substituteInPlace $BSD_PATH/setupterm.c \ --replace '#include <curses.h>' 'void use_env(bool);' ''; postBuild = '' @@ -757,10 +760,10 @@ in lib.makeScopeWithSplicing MKDOC = "no"; # missing vfontedpr makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${self.libterminfo}/lib" ]; postPatch = lib.optionalString (!stdenv.isDarwin) '' - substituteInPlace printw.c \ + substituteInPlace $BSD_PATH/printw.c \ --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \ --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));' - substituteInPlace scanw.c \ + substituteInPlace $BSD_PATH/scanw.c \ --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));' ''; }; @@ -985,7 +988,7 @@ in lib.makeScopeWithSplicing # man0 generates a man.pdf using ps2pdf, but doesn't install it later, # so we can avoid the dependency on ghostscript postPatch = '' - substituteInPlace man0/Makefile --replace "ps2pdf" "echo noop " + substituteInPlace $BSD_PATH/man0/Makefile --replace "ps2pdf" "echo noop " ''; makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/share" |