On 3/8/23 02:04, Alejandro Colomar wrote: > We keep them as .so "includes" in our source code, but if some > distribution wants to have them as symlinks in their filesystem, make it > easy for them to install as such, by specifying 'LINK_PAGES=symlink'. > > Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx> > --- > > Hi! > > I'm going to add support for installing link pages as symlinks. Debian > installs them this way, so I think it makes sense to help distributors > use our upstream build system to install in their preferred way, since > otherwise, to be more useful. to be more useful, since otherwise, our build system is something that only we find useful, but nobody really uses. :) > > Here's the implementation I came up with, but I'd like to hear comments > about the interface (the LINK_PAGES variable). Would you make it > different? > > Thanks! > > Alex > > > lib/cmd.mk | 1 + > lib/install-man.mk | 9 +++++++++ > 2 files changed, 10 insertions(+) > > diff --git a/lib/cmd.mk b/lib/cmd.mk > index 17f3a8ee5..9cd09fe89 100644 > --- a/lib/cmd.mk > +++ b/lib/cmd.mk > @@ -16,6 +16,7 @@ GREP := grep > GZIP := gzip > HEAD := head > INSTALL := install > +LN := ln > LOCALE := locale > PKG-CONFIG := pkg-config > SED := sed > diff --git a/lib/install-man.mk b/lib/install-man.mk > index 174f503ca..aaa545290 100644 > --- a/lib/install-man.mk > +++ b/lib/install-man.mk > @@ -12,6 +12,9 @@ include $(srcdir)/lib/install.mk > include $(srcdir)/lib/src.mk > > > +LINK_PAGES := so # Alternatives: "so", "symlink" > + > + > mandir := $(datarootdir)/man > man1dir := $(mandir)/man1 > man2dir := $(mandir)/man2 > @@ -147,6 +150,12 @@ $(_manpages): > -e '/^\.so /s, man7/\(.*\)\.7$$, $(notdir $(man7dir))/\1$(man7ext),' \ > -e '/^\.so /s, man8/\(.*\)\.8$$, $(notdir $(man8dir))/\1$(man8ext),' \ > $@ > +ifeq ($(LINK_PAGES),symlink) > + if $(GREP) '^\.so ' <$@ >/dev/null; then \ > + $(SED) 's,^\.so \(.*\),../\1,' <$@ \ > + | $(XARGS) -I tgt $(LN) -fsT tgt $@; \ > + fi > +endif > > $(_mandirs): %/.: | $$(dir %). $(_mandir)/. > -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature