summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix39
-rw-r--r--pkgs/os-specific/bsd/netbsd/getent.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/locale.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/no-dynamic-linker.patch4
-rw-r--r--pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch4
-rw-r--r--pkgs/os-specific/bsd/setup-hook.sh7
9 files changed, 41 insertions, 33 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch b/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch
index f67ca2e5079..2aaa90b7614 100644
--- a/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch
+++ b/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch
@@ -1,6 +1,6 @@
 diff -u -r1.35.2.1 nbtool_config.h.in
---- a/nbtool_config.h.in	22 Apr 2015 07:18:58 -0000	1.35.2.1
-+++ b/nbtool_config.h.in	31 May 2018 01:46:53 -0000
+--- a/tools/compat/nbtool_config.h.in	22 Apr 2015 07:18:58 -0000	1.35.2.1
++++ b/tools/compat/nbtool_config.h.in	31 May 2018 01:46:53 -0000
 @@ -680,5 +680,14 @@
  /* Define if you have u_int8_t, but not uint8_t. */
  #undef uint8_t
diff --git a/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch b/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch
index 1a69e73e255..2758e256a61 100644
--- a/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch
+++ b/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch
@@ -6,8 +6,8 @@ Date:   Wed Sep 1 15:38:56 2021 +0000
 
 diff --git a/Makefile b/Makefile
 index b5adb8a5f2e9..1a914ef16739 100644
---- a/Makefile
-+++ b/Makefile
+--- a/tools/compat/Makefile
++++ b/tools/compat/Makefile
 @@ -76,11 +76,6 @@ _CURDIR:=	${.CURDIR}
  
  SRCS:=		${SRCS:M*.c}
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 cd442d95f41..117fb7e0429 100644
--- a/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch
+++ b/pkgs/os-specific/bsd/netbsd/compat-no-force-native.patch
@@ -8,8 +8,8 @@ Date:   Wed Sep 1 15:38:56 2021 +0000
 
 diff --git a/Makefile b/Makefile
 index 4bcf227f0e75..9ed1d6eea6ff 100644
---- a/Makefile
-+++ b/Makefile
+--- a/tools/compat/Makefile
++++ b/tools/compat/Makefile
 @@ -1,6 +1,6 @@
  #	$NetBSD: Makefile,v 1.87 2019/05/08 02:25:50 thorpej Exp $
  
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"
diff --git a/pkgs/os-specific/bsd/netbsd/getent.patch b/pkgs/os-specific/bsd/netbsd/getent.patch
index e9e34d19a31..18258b64861 100644
--- a/pkgs/os-specific/bsd/netbsd/getent.patch
+++ b/pkgs/os-specific/bsd/netbsd/getent.patch
@@ -1,8 +1,8 @@
 Author: Matthew Bauer
 Description: Remove unavailable getent databases
 Version: 7.1.2
---- a/getent.c	2018-04-16 13:33:49.000000000 -0500
-+++ b/getent.c	2018-04-16 13:29:30.000000000 -0500
+--- a/usr.bin/getent/getent.c	2018-04-16 13:33:49.000000000 -0500
++++ b/usr.bin/getent/getent.c	2018-04-16 13:29:30.000000000 -0500
 @@ -42,7 +42,6 @@
  #include <grp.h>
  #include <limits.h>
diff --git a/pkgs/os-specific/bsd/netbsd/locale.patch b/pkgs/os-specific/bsd/netbsd/locale.patch
index 1df9eb38562..4b7f4785528 100644
--- a/pkgs/os-specific/bsd/netbsd/locale.patch
+++ b/pkgs/os-specific/bsd/netbsd/locale.patch
@@ -1,5 +1,5 @@
---- a/locale.c	2018-06-11 14:39:06.449762000 -0400
-+++ b/locale.c	2018-06-11 14:42:28.461122899 -0400
+--- a/usr.bin/locale/locale.c	2018-06-11 14:39:06.449762000 -0400
++++ b/usr.bin/locale/locale.c	2018-06-11 14:42:28.461122899 -0400
 @@ -56,14 +56,8 @@
  #include <stringlist.h>
  #include <unistd.h>
diff --git a/pkgs/os-specific/bsd/netbsd/no-dynamic-linker.patch b/pkgs/os-specific/bsd/netbsd/no-dynamic-linker.patch
index 5a2b9092a5c..b3e9f3c88a1 100644
--- a/pkgs/os-specific/bsd/netbsd/no-dynamic-linker.patch
+++ b/pkgs/os-specific/bsd/netbsd/no-dynamic-linker.patch
@@ -4,8 +4,8 @@ rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/stand/efiboot/Makefile.efiboot,v: wa
 retrieving revision 1.16
 retrieving revision 1.17
 diff -u -p -r1.16 -r1.17
---- sys/arch/i386/stand/efiboot/Makefile.efiboot	2019/09/13 02:19:45	1.16
-+++ sys/arch/i386/stand/efiboot/Makefile.efiboot	2020/04/04 15:30:46	1.17
+--- a/sys/arch/i386/stand/efiboot/Makefile.efiboot	2019/09/13 02:19:45	1.16
++++ b/sys/arch/i386/stand/efiboot/Makefile.efiboot	2020/04/04 15:30:46	1.17
 @@ -41,6 +41,7 @@ BINMODE=444
  .PATH:	${.CURDIR}/../../libsa
  
diff --git a/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch b/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch
index ed85f8ea5b0..5cfb2a54c8d 100644
--- a/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch
+++ b/pkgs/os-specific/bsd/netbsd/sys-headers-incsdir.patch
@@ -1,7 +1,7 @@
 diff --git a/Makefile b/Makefile
 index 3f1e18dc659d..163362b82f94 100644
---- a/Makefile
-+++ b/Makefile
+--- a/sys/Makefile
++++ b/sys/Makefile
 @@ -2,6 +2,8 @@
  
  .include <bsd.own.mk>
diff --git a/pkgs/os-specific/bsd/setup-hook.sh b/pkgs/os-specific/bsd/setup-hook.sh
index 4bdfde68b62..7dd7de48ac4 100644
--- a/pkgs/os-specific/bsd/setup-hook.sh
+++ b/pkgs/os-specific/bsd/setup-hook.sh
@@ -48,6 +48,7 @@ addMakeFlags() {
   makeFlags="BINDIR=${!outputBin}/bin $makeFlags"
   makeFlags="LIBDIR=${!outputLib}/lib $makeFlags"
   makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags"
+  makeFlags="SHAREDIR=${!outputLib}/share $makeFlags"
   makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
   makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags"
   makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags"
@@ -61,10 +62,13 @@ setBSDSourceDir() {
   sourceRoot=$PWD/$sourceRoot
   export BSDSRCDIR=$sourceRoot
   export _SRC_TOP_=$BSDSRCDIR
-
   cd $sourceRoot
+}
+
+cdBSDPath() {
   if [ -d "$BSD_PATH" ]
     then sourceRoot=$sourceRoot/$BSD_PATH
+    cd $BSD_PATH
   fi
 }
 
@@ -104,6 +108,7 @@ moveUsrDir() {
 }
 
 postUnpackHooks+=(setBSDSourceDir)
+postPatchHooks+=(cdBSDPath)
 preConfigureHooks+=(addMakeFlags)
 preInstallHooks+=(includesPhase)
 fixupOutputHooks+=(moveUsrDir)