From 7042262b52d2b7b40e2600d9ea727882a5374245 Mon Sep 17 00:00:00 2001
From: Florian Franzmann <bwlf@bandrate.org>
Date: Sat, 25 Jul 2020 16:22:52 +0200
Subject: [PATCH] Put manpages into their proper section

---
 Configurations/unix-Makefile.tmpl | 5 +++--
 util/process_docs.pl              | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 3a24d55..dc760ab 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -281,7 +281,8 @@ HTMLDIR=$(DOCDIR)/html
 # MANSUFFIX is for the benefit of anyone who may want to have a suffix
 # appended after the manpage file section number.  "ssl" is popular,
 # resulting in files such as config.5ssl rather than config.5.
-MANSUFFIX=
+MANSUFFIX=ssl
+MANSECTION=SSL
 HTMLSUFFIX=html
 
 # For "optional" echo messages, to get "real" silence
@@ -824,7 +825,7 @@ install_man_docs:
 	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
 	@$(ECHO) "*** Installing manpages"
 	$(PERL) $(SRCDIR)/util/process_docs.pl \
-		"--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX)
+		"--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) --mansection=$(MANSECTION)
 
 uninstall_man_docs:
 	@$(ECHO) "*** Uninstalling manpages"
diff --git a/util/process_docs.pl b/util/process_docs.pl
index 30b149e..b3f8aa8 100755
--- a/util/process_docs.pl
+++ b/util/process_docs.pl
@@ -37,6 +37,7 @@ GetOptions(\%options,
            'type=s',            # The result type, 'man' or 'html'
            'suffix:s',          # Suffix to add to the extension.
                                 # Only used with type=man
+           'mansection:s',      # Section to put to manpage in
            'remove',            # To remove files rather than writing them
            'dry-run|n',         # Only output file names on STDOUT
            'debug|D+',
@@ -97,7 +98,7 @@ foreach my $section (sort @{$options{section}}) {
         my $name = uc $podname;
         my $suffix = { man  => ".$podinfo{section}".($options{suffix} // ""),
                        html => ".html" } -> {$options{type}};
-        my $generate = { man  => "pod2man --name=$name --section=$podinfo{section} --center=OpenSSL --release=$config{version} \"$podpath\"",
+        my $generate = { man  => "pod2man --name=$name --section=$podinfo{section}$options{mansection} --center=OpenSSL --release=$config{version} \"$podpath\"",
                          html => "pod2html \"--podroot=$options{sourcedir}\" --htmldir=$updir --podpath=man1:man3:man5:man7 \"--infile=$podpath\" \"--title=$podname\" --quiet"
                          } -> {$options{type}};
         my $output_dir = catdir($options{destdir}, "man$podinfo{section}");
-- 
2.27.0

