Index | Thread | Search

From:
"John Ericson" <git@JohnEricson.me>
Subject:
Re: [PATCH] Allow building libc without generating tags
To:
"Theo de Raadt" <deraadt@openbsd.org>
Cc:
tech@openbsd.org
Date:
Wed, 15 May 2024 10:30:12 -0400

Download raw body.

Thread
For regular OpenBSD development (that takes plan on OpenBSD), I agree there is
no pressing reason to disable building tags.

I however am coming from Nixpkgs where we do exotic bootstrapping things. In
particular, this patch comes from this PR [1], which would be our third
supported BSD cross compilation. There is a also FreeBSD native bootstrap in the
works [2], and there is also work porting over GNU Guix's almost-ex-nihilo Linux
bootstrap [3]. Our perspective based on such endeavors is that we much rather
first build libc alone, and later build the tags as a separate far downstream
build step.

It's reasonable for you all to simply decide none of this external activity is a
valid motivation for something to belong in the src repository, of course. But I
hoping this patch is minimal enough to be worth the burden (for you, not me) to
keep upstream.

[1]: https://github.com/NixOS/nixpkgs/pull/311836

[2]: https://github.com/NixOS/nixpkgs/pull/311795 / https://github.com/nixos-bsd/nixbsd

[3]: https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/

John

On Wed, May 15, 2024, at 2:29 AM, Theo de Raadt wrote:
> Why?
> 
> I don't see any point to this choice.  It is a mandatory file produced by
> libc build and install.
> 
> John Ericson <git@JohnEricson.me> wrote:
> 
> > When bootstrapping from scratch, it is nice to avoid dependencies (like
> > `ctags`) that are not strictly needed.
> > 
> > This makefile change introduces a new `LIBC_TAGS` variable, defaulted to
> > `y` (i.e. "yes": do build tags, just like today), 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 | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/libc/Makefile b/lib/libc/Makefile
> > index 4bb4b67fcbb..9cfae207130 100644
> > --- a/lib/libc/Makefile
> > +++ b/lib/libc/Makefile
> > @@ -26,7 +26,14 @@ SYMBOL_LISTS= ${LIBCSRCDIR}/Symbols.list \
> >  LIBCSRCDIR=${.CURDIR}
> >  .include "${LIBCSRCDIR}/Makefile.inc"
> >  
> > +all: ${SRCS}
> > +
> > +LIBC_TAGS ?= yes
> > +.if ${LIBC_TAGS} == "yes"
> >  all: tags
> > +beforeinstall: install_tags
> > +.endif
> > +
> >  tags: ${SRCS}
> >  ctags -w ${.ALLSRC:M*.c}
> >  egrep "^SYSENTRY(.*)|^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" \
> > @@ -34,7 +41,8 @@ tags: ${SRCS}
> >      sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
> >      >> tags; sort -o tags tags
> >  
> > -beforeinstall:
> > +.PHONY: install_tags
> > +install_tags:
> >  ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 tags \
> >  ${DESTDIR}/var/db/lib${LIB}.tags
> >  
> > -- 
> > 2.42.0
> > 
>