about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2024-06-29 13:36:44 -0400
committerGitHub <noreply@github.com>2024-06-29 13:36:44 -0400
commitdb933756e0353a895b99ec19b5985b7f0e8c84b8 (patch)
treefd0319ced1586da54586189269f34b173312912d
parent71db2c94d80cef5cc94f043e086dd0759e14f5da (diff)
parent98442699a0ff85a8a74bf3f066f7f6ac3c8aad9b (diff)
Merge pull request #323413 from NixOS/backport-323402-to-release-24.05
[Backport release-24.05] netbsd.libcMinimal: Cut down on deps, don't build tags
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/0001-Allow-building-libc-without-generating-tags.patch53
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/package.nix (renamed from pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix)29
3 files changed, 74 insertions, 10 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index eeccd0fa07eab..3c9f83ab48d0a 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -98,7 +98,7 @@ makeScopeWithSplicing' {
         inherit (buildNetbsd) makeMinimal;
       };
 
-      libcMinimal = self.callPackage ./pkgs/libcMinimal.nix {
+      libcMinimal = self.callPackage ./pkgs/libcMinimal/package.nix {
         inherit (self) headers csu;
         inherit (buildNetbsd)
           netbsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/0001-Allow-building-libc-without-generating-tags.patch b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/0001-Allow-building-libc-without-generating-tags.patch
new file mode 100644
index 0000000000000..0c13f650ceba0
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/0001-Allow-building-libc-without-generating-tags.patch
@@ -0,0 +1,53 @@
+From 62acd447e36d5009d3008e025df72c08690905d5 Mon Sep 17 00:00:00 2001
+From: John Ericson <John.Ericson@Obsidian.Systems>
+Date: Thu, 20 Jun 2024 15:48:54 -0400
+Subject: [PATCH] Allow building libc without generating tags
+
+When bootstrapping from scratch, it is nice to avoid dependencies (like
+`ctags`/`genassym`/etc.) that are not strictly needed.
+
+This makefile change introduces a new `MK_LIBC_TAGS` variable, defaulted
+to `yes`, to control whether `make all` / `make install` should
+build/install (respectively) the tags.
+
+The underlying rules for tags can still be run regardless of the choice
+of variable.
+---
+ lib/libc/Makefile | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/lib/libc/Makefile b/lib/libc/Makefile
+index f2dab2a090e7..c6aa5e45f959 100644
+--- a/lib/libc/Makefile
++++ b/lib/libc/Makefile
+@@ -132,7 +132,12 @@ MKREPRO_SED=   -e 's;${NETBSDSRCDIR:C/${REGEX_SPECIALS}/\\\\&/g};/usr/src;'
+ .endif
+ 
+ .if !defined(MLIBDIR) && ${RUMPRUN} != "yes"
++realall: ${SRCS}
++
++.if ${MK_LIBC_TAGS:Uyes} == "yes"
+ realall: tags
++.endif
++
+ tags: ${SRCS}
+ 	${_MKTARGET_CREATE}
+ 	-${TOOL_CTAGS} -f ${.TARGET}.tmp -w ${.ALLSRC:M*.c}
+@@ -146,11 +151,14 @@ tags: ${SRCS}
+ .endif
+ 	rm -f ${.TARGET}.tmp
+ 
++.if ${MK_LIBC_TAGS:Uyes} == "yes"
+ FILES=		tags
+ FILESNAME=	libc.tags
+ FILESDIR=	/var/db
+ .endif
+ 
++.endif
++
+ 
+ # workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
+ # multibyte for libc.so.  the quirk should be removed when we support
+-- 
+2.42.0
+
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/package.nix
index bbab20d53d51e..c1ef1744140ed 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/package.nix
@@ -28,7 +28,6 @@ mkDerivation {
     "out"
     "dev"
     "man"
-    "tags"
   ];
   USE_FORT = "yes";
   MKPROFILE = "no";
@@ -39,32 +38,44 @@ mkDerivation {
     "sys"
     "external/bsd/jemalloc"
   ];
+
+  patches = [
+    # https://mail-index.netbsd.org/tech-toolchain/2024/06/24/msg004438.html
+    #
+    # The patch is vendored because the archive software inlined my
+    # attachment so I am not sure how to programmatically download it.
+    ./0001-Allow-building-libc-without-generating-tags.patch
+  ];
+
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
     makeMinimal
     install
+    tsort
+    lorder
     mandoc
     groff
+    statHook
     flex
     byacc
-    genassym
     gencat
-    lorder
-    tsort
-    statHook
-    rpcgen
   ];
+
   buildInputs = [
     headers
     csu
   ];
+
   env.NIX_CFLAGS_COMPILE = "-B${csu}/lib -fcommon";
-  meta.platforms = lib.platforms.netbsd;
+
   SHLIBINSTALLDIR = "$(out)/lib";
   MKPICINSTALL = "yes";
+  MK_LIBC_TAGS = "no";
   NLSDIR = "$(out)/share/nls";
+
   makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db" ];
+
   postInstall = ''
     pushd ${headers}
     find include -type d -exec mkdir -p "$dev/{}" ';'
@@ -75,11 +86,11 @@ mkDerivation {
     find lib -type d -exec mkdir -p "$out/{}" ';'
     find lib '(' -type f -o -type l ')' -exec cp -pr "{}" "$out/{}" ';'
     popd
-
-    moveToOutput var/db/libc.tags "$tags"
   '';
 
   postPatch = ''
     sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' lib/lib*/sys/Makefile.inc
   '';
+
+  meta.platforms = lib.platforms.netbsd;
 }