diff options
-rw-r--r-- | Configurations/unix-Makefile.tmpl | 10 | ||||
-rwxr-xr-x | util/write-man-symlinks | 48 |
2 files changed, 57 insertions, 1 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 92e181befb..59e404b5c7 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -940,6 +940,7 @@ install_man_docs: build_man_docs $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man1; \ done @set -e; for x in dummy $(MANDOCS3); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ @@ -947,6 +948,7 @@ install_man_docs: build_man_docs $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man3; \ done @set -e; for x in dummy $(MANDOCS5); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ @@ -954,6 +956,7 @@ install_man_docs: build_man_docs $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man5; \ done @set -e; for x in dummy $(MANDOCS7); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ @@ -961,33 +964,38 @@ install_man_docs: build_man_docs $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man7; \ done -uninstall_man_docs: +uninstall_man_docs: build_man_docs @$(ECHO) "*** Uninstalling manpages" @set -e; for x in dummy $(MANDOCS1); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man1; \ done @set -e; for x in dummy $(MANDOCS3); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man3; \ done @set -e; for x in dummy $(MANDOCS5); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man5; \ done @set -e; for x in dummy $(MANDOCS7); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ + $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) $(DESTDIR)$(MANDIR)/man7; \ done install_html_docs: build_html_docs diff --git a/util/write-man-symlinks b/util/write-man-symlinks new file mode 100755 index 0000000000..97b72a3840 --- /dev/null +++ b/util/write-man-symlinks @@ -0,0 +1,48 @@ +#! /usr/bin/env perl +# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + + +require 5.10.0; +use warnings; +use strict; + +use FindBin; +use lib "$FindBin::Bin/perl"; + +use OpenSSL::Util::Pod; + +if ($#ARGV + 1 != 5 || $ARGV[0] !~ /^(un)?install$/) { + print "Usage: write-man-symlinks [install|uninstall] src-dir build-dir man-page-name target-dir\n"; + exit; +} + +my $action = $ARGV[0]; +my $srcdir = $ARGV[1]; +my $builddir = $ARGV[2]; +my $manname = $ARGV[3]; +my $targetdir = $ARGV[4]; + +$manname =~ m|(.+)\.(.+)|; +my $mainf = $1; +my $section = $2; +die "Bad src file" if !defined $mainf; +my $podfile = "$srcdir/$mainf.pod"; +#Some pod files are generated and are in the build dir +unless (-e $podfile) { + $podfile = "$builddir/$mainf.pod"; +} +my %podinfo = extract_pod_info($podfile); + +for my $name (@{$podinfo{names}}) { + next if $name eq $mainf; + if ($action eq "install") { + symlink "$targetdir/$manname", "$targetdir/$name.$section"; + } else { + unlink "$targetdir/$name.$section"; + } +} |