Skip to content

Commit d96726b

Browse files
authored
Merge pull request #323402 from obsidiansystems/netbsd-cleanup
netbsd.libcMinimal: Cut down on deps, don't build tags
2 parents 754f547 + f9dbc8f commit d96726b

File tree

3 files changed

+74
-10
lines changed

3 files changed

+74
-10
lines changed

pkgs/os-specific/bsd/netbsd/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ makeScopeWithSplicing' {
9898
inherit (buildNetbsd) makeMinimal;
9999
};
100100

101-
libcMinimal = self.callPackage ./pkgs/libcMinimal.nix {
101+
libcMinimal = self.callPackage ./pkgs/libcMinimal/package.nix {
102102
inherit (self) headers csu;
103103
inherit (buildNetbsd)
104104
netbsdSetupHook
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 62acd447e36d5009d3008e025df72c08690905d5 Mon Sep 17 00:00:00 2001
2+
From: John Ericson <[email protected]>
3+
Date: Thu, 20 Jun 2024 15:48:54 -0400
4+
Subject: [PATCH] Allow building libc without generating tags
5+
6+
When bootstrapping from scratch, it is nice to avoid dependencies (like
7+
`ctags`/`genassym`/etc.) that are not strictly needed.
8+
9+
This makefile change introduces a new `MK_LIBC_TAGS` variable, defaulted
10+
to `yes`, to control whether `make all` / `make install` should
11+
build/install (respectively) the tags.
12+
13+
The underlying rules for tags can still be run regardless of the choice
14+
of variable.
15+
---
16+
lib/libc/Makefile | 8 ++++++++
17+
1 file changed, 8 insertions(+)
18+
19+
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
20+
index f2dab2a090e7..c6aa5e45f959 100644
21+
--- a/lib/libc/Makefile
22+
+++ b/lib/libc/Makefile
23+
@@ -132,7 +132,12 @@ MKREPRO_SED= -e 's;${NETBSDSRCDIR:C/${REGEX_SPECIALS}/\\\\&/g};/usr/src;'
24+
.endif
25+
26+
.if !defined(MLIBDIR) && ${RUMPRUN} != "yes"
27+
+realall: ${SRCS}
28+
+
29+
+.if ${MK_LIBC_TAGS:Uyes} == "yes"
30+
realall: tags
31+
+.endif
32+
+
33+
tags: ${SRCS}
34+
${_MKTARGET_CREATE}
35+
-${TOOL_CTAGS} -f ${.TARGET}.tmp -w ${.ALLSRC:M*.c}
36+
@@ -146,11 +151,14 @@ tags: ${SRCS}
37+
.endif
38+
rm -f ${.TARGET}.tmp
39+
40+
+.if ${MK_LIBC_TAGS:Uyes} == "yes"
41+
FILES= tags
42+
FILESNAME= libc.tags
43+
FILESDIR= /var/db
44+
.endif
45+
46+
+.endif
47+
+
48+
49+
# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
50+
# multibyte for libc.so. the quirk should be removed when we support
51+
--
52+
2.42.0
53+

pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix renamed to pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal/package.nix

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mkDerivation {
2828
"out"
2929
"dev"
3030
"man"
31-
"tags"
3231
];
3332
USE_FORT = "yes";
3433
MKPROFILE = "no";
@@ -39,32 +38,44 @@ mkDerivation {
3938
"sys"
4039
"external/bsd/jemalloc"
4140
];
41+
42+
patches = [
43+
# https://mail-index.netbsd.org/tech-toolchain/2024/06/24/msg004438.html
44+
#
45+
# The patch is vendored because the archive software inlined my
46+
# attachment so I am not sure how to programmatically download it.
47+
./0001-Allow-building-libc-without-generating-tags.patch
48+
];
49+
4250
nativeBuildInputs = [
4351
bsdSetupHook
4452
netbsdSetupHook
4553
makeMinimal
4654
install
55+
tsort
56+
lorder
4757
mandoc
4858
groff
59+
statHook
4960
flex
5061
byacc
51-
genassym
5262
gencat
53-
lorder
54-
tsort
55-
statHook
56-
rpcgen
5763
];
64+
5865
buildInputs = [
5966
headers
6067
csu
6168
];
69+
6270
env.NIX_CFLAGS_COMPILE = "-B${csu}/lib -fcommon";
63-
meta.platforms = lib.platforms.netbsd;
71+
6472
SHLIBINSTALLDIR = "$(out)/lib";
6573
MKPICINSTALL = "yes";
74+
MK_LIBC_TAGS = "no";
6675
NLSDIR = "$(out)/share/nls";
76+
6777
makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db" ];
78+
6879
postInstall = ''
6980
pushd ${headers}
7081
find include -type d -exec mkdir -p "$dev/{}" ';'
@@ -75,11 +86,11 @@ mkDerivation {
7586
find lib -type d -exec mkdir -p "$out/{}" ';'
7687
find lib '(' -type f -o -type l ')' -exec cp -pr "{}" "$out/{}" ';'
7788
popd
78-
79-
moveToOutput var/db/libc.tags "$tags"
8089
'';
8190

8291
postPatch = ''
8392
sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' lib/lib*/sys/Makefile.inc
8493
'';
94+
95+
meta.platforms = lib.platforms.netbsd;
8596
}

0 commit comments

Comments
 (0)