[openssl] master update

Richard Levitte levitte at openssl.org
Fri Nov 29 08:54:04 UTC 2019


The branch master has been updated
       via  cff64af5532d3a1b0e2e9adf88454887efba01b2 (commit)
       via  b0940b33a60cbfab03153287181372d0066410a6 (commit)
       via  df8f116ecd6e25577eb1e47a213df17d64e87b4a (commit)
       via  829f86bb7b52e58c2db333b8e2eb7ad990724746 (commit)
      from  fbd03b1c5984d1dd42ef99e1a5da70ed587f3380 (commit)


- Log -----------------------------------------------------------------
commit cff64af5532d3a1b0e2e9adf88454887efba01b2
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Nov 20 14:58:20 2019 +0100

    Configure: make it possible to have generated generators
    
    This makes it possible to chain GENERATOR statements, which allows
    constructs like this:
    
        GENERATE[something.html]=something.pod
        GENERATE[something.pod]=something.pod.in
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/6236)

commit b0940b33a60cbfab03153287181372d0066410a6
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Aug 31 22:57:25 2016 +0200

    Adapt *.tmpl to generate docs at build time
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/6236)

commit df8f116ecd6e25577eb1e47a213df17d64e87b4a
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Aug 31 22:56:02 2016 +0200

    Add doc/build.info to build the documentation
    
    This build.info is entirely generated when configuring
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/6236)

commit 829f86bb7b52e58c2db333b8e2eb7ad990724746
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Aug 31 22:54:39 2016 +0200

    Add the possibility to generate documentation at build time
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/6236)

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                           |   4 +
 Configurations/common.tmpl           |  35 ++++++-
 Configurations/descrip.mms.tmpl      |  53 ++++++++--
 Configurations/unix-Makefile.tmpl    | 192 ++++++++++++++++++++++++++++++++---
 Configurations/windows-makefile.tmpl |  46 +++++++--
 Configure                            |  52 ++++++++--
 INSTALL                              |  10 +-
 build.info                           |   2 +-
 doc/build.info                       |  66 ++++++++++++
 9 files changed, 416 insertions(+), 44 deletions(-)
 create mode 100644 doc/build.info

diff --git a/.gitignore b/.gitignore
index eb95e48bfe..0d02ecdf8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -157,6 +157,10 @@ doc/man1/openssl-x509.pod
 /test/fips_test_suite.c
 /test/shatest.c
 
+# Generated docs directories
+/doc/html
+/doc/man
+
 ##### Generic patterns
 # Auto generated assembly language source files
 *.s
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index a2591da727..5db3471fe2 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -151,10 +151,18 @@
                              generator_incs => $unified_info{includes}->{$script},
                              generator_deps => $unified_info{depends}->{$script},
                              deps => $unified_info{depends}->{$src},
-                             incs => [ @{$unified_info{includes}->{$obj}},
-                                       @{$unified_info{includes}->{$bin}} ],
-                             defs => [ @{$unified_info{defines}->{$obj}},
-                                       @{$unified_info{defines}->{$bin}} ],
+                             incs => [ defined $obj
+                                           ? @{$unified_info{includes}->{$obj}}
+                                           : (),
+                                       defined $bin
+                                           ? @{$unified_info{includes}->{$bin}}
+                                           : () ],
+                             defs => [ defined $obj
+                                           ? @{$unified_info{defines}->{$obj}}
+                                           : (),
+                                       defined $bin
+                                           ? @{$unified_info{defines}->{$bin}}
+                                           : () ],
                              %opts);
          foreach (@{$unified_info{depends}->{$src}}) {
              dogenerate($_, $obj, $bin, %opts);
@@ -436,6 +444,22 @@
      $cache{$dir} = 1;
  }
 
+ # dodocs is responsible for building documentation from .pods.
+ # It will call generatesrc.
+ sub dodocs {
+     my $type = shift;
+     my $section = shift;
+     foreach my $doc (@{$unified_info{"${type}docs"}->{$section}}) {
+         next if $cache{$doc};
+         $OUT .= generatesrc(src => $doc,
+                             generator => $unified_info{generate}->{$doc});
+         foreach ((@{$unified_info{depends}->{$doc}})) {
+             dogenerate($_, undef, undef, %opts);
+         }
+         $cache{$doc} = 1;
+     }
+ }
+
  # Start with populating the cache with all the overrides
  %cache = map { $_ => 1 } @{$unified_info{overrides}};
 
@@ -448,6 +472,7 @@
  foreach (@{$unified_info{modules}})   { domodule($_); }
  foreach (@{$unified_info{programs}})  { dobin($_);    }
  foreach (@{$unified_info{scripts}})   { doscript($_); }
-
+ foreach (sort keys %{$unified_info{htmldocs}}) { dodocs('html', $_); }
+ foreach (sort keys %{$unified_info{mandocs}})  { dodocs('man', $_); }
  foreach (sort keys %{$unified_info{dirinfo}})  { dodir($_); }
 -}
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index 28e7663a54..cb1fd9c5b5 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -143,6 +143,10 @@ INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
+HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
+HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
+HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
+HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 catfile("apps","openssl") -}
@@ -405,7 +409,7 @@ NODEBUG=@
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
+{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
 {- dependmagic('build_libs'); -} : build_libs_nodep
 {- dependmagic('build_modules'); -} : build_modules_nodep
 {- dependmagic('build_programs'); -} : build_programs_nodep
@@ -415,18 +419,23 @@ build_libs_nodep : $(LIBS), $(SHLIBS)
 build_modules_nodep : $(MODULES)
 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
 
+build_docs: build_html_docs
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 # Kept around for backward compatibility
 build_apps build_tests : build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
 	@ ! {- output_off() if $disabled{makedepend}; "" -}
 	@ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
 	@ WRITE SYS$OUTPUT "         target system doesn't have $(PERL),"
 	@ WRITE SYS$OUTPUT "         then make will fail..."
 	@ ! {- output_on() if $disabled{makedepend}; "" -}
 
+all : build_sw build_docs
+
 test : tests
 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
         @ ! {- output_off() if $disabled{tests}; "" -}
@@ -459,7 +468,9 @@ list-tests :
         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
         @ ! {- output_on() if !$disabled{tests}; "" -}
 
-install : install_sw install_ssldirs install_docs
+install : install_sw install_ssldirs install_docs install_final
+
+install_final :
         @ WRITE SYS$OUTPUT ""
         @ WRITE SYS$OUTPUT "######################################################################"
         @ WRITE SYS$OUTPUT ""
@@ -496,6 +507,10 @@ libclean :
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
 
 clean : libclean
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
@@ -659,11 +674,21 @@ vmsconfig.pm : configdata.pm
         WRITE CONFIG "1;"
         CLOSE CONFIG
 
-install_html_docs : check_INSTALLTOP
-        sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
-        $(PERL) {- sourcefile("util", "process_docs.pl") -} -
-                --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
-                --type=html
+install_html_docs : check_INSTALLTOP build_html_docs
+        @ WRITE SYS$OUTPUT "*** Installing HTML docs"
+        - CREATE/DIR ossl_installroot:[HTML.MAN1]
+        - CREATE/DIR ossl_installroot:[HTML.MAN3]
+        - CREATE/DIR ossl_installroot:[HTML.MAN5]
+        - CREATE/DIR ossl_installroot:[HTML.MAN7]
+        {- join("\n        ",
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
+                  @{$unified_info{htmldocs}->{man1}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
+                  @{$unified_info{htmldocs}->{man3}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
+                  @{$unified_info{htmldocs}->{man5}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
+                  @{$unified_info{htmldocs}->{man7}} )) -}
 
 check_INSTALLTOP :
         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
@@ -756,7 +781,17 @@ reconfigure reconf :
       my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
       my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+	  my $title = basename($args{src}, ".html");
+	  return <<"EOF";
+$args{src}: $args{generator}->[0]
+	pipe pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. -
+		       --podpath=man1:man3:man5:man7 "--infile=\$<" -
+		      "--title=$title" -
+	| \$(PERL) -pe "s|href=""http://man\\.he\\.net/(man\d/[^""]+)(?:\\.html)?""|href=""../\$1.html|g;" -
+	> \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           my $mkdef = sourcefile('util', 'mkdef.pl');
           my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 6113ab4a34..c3c83f95cd 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -162,6 +162,38 @@ MISC_SCRIPTS={-
                                && $unified_info{attributes}->{scripts}->{$_}->{misc} }
                         @{$unified_info{scripts}}))
 -}
+HTMLDOCS1={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man1}})) -}
+HTMLDOCS3={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man3}})) -}
+HTMLDOCS5={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man5}})) -}
+HTMLDOCS7={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man7}})) -}
+MANDOCS1={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man1}})) -}
+MANDOCS3={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man3}})) -}
+MANDOCS5={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man5}})) -}
+MANDOCS7={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man7}})) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 catfile("apps","openssl") -}
@@ -387,11 +419,15 @@ LANG=C
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
+{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
 {- dependmagic('build_libs'); -}: build_libs_nodep
 {- dependmagic('build_modules'); -}: build_modules_nodep
 {- dependmagic('build_programs'); -}: build_programs_nodep
 
+build_docs: build_man_docs build_html_docs
+build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 build_generated: $(GENERATED_MANDATORY)
 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
 build_modules_nodep: $(MODULES)
@@ -402,13 +438,15 @@ build_apps build_tests: build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
 	@ : {- output_off() if $disabled{makedepend}; "" -}
 	@echo "Warning: consider configuring with no-makedepend, because if"
 	@echo "         target system doesn't have $(PERL),"
 	@echo "         then make will fail..."
 	@ : {- output_on() if $disabled{makedepend}; "" -}
 
+all: build_sw build_docs
+
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
 	@ : {- output_off() if $disabled{tests}; "" -}
@@ -458,6 +496,8 @@ libclean:
 	$(RM) *{- platform->defext() -}
 
 clean: libclean
+	$(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+	$(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
 	$(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
 	$(RM) $(GENERATED_MANDATORY) $(GENERATED)
 	-$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
@@ -764,29 +804,131 @@ uninstall_runtime_libs:
 	@ : {- output_on() unless windowsdll(); "" -}
 
 
-install_man_docs:
+install_man_docs: build_man_docs
 	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
 	@$(ECHO) "*** Installing manpages"
-	$(PERL) $(SRCDIR)/util/process_docs.pl \
-		--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
+	@set -e; for x in dummy $(MANDOCS1); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$$fn"; \
+		cp $$x $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+		chmod 755 $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS3); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$$fn"; \
+		cp $$x $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+		chmod 755 $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS5); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$$fn"; \
+		cp $$x $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+		chmod 755 $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS7); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$$fn"; \
+		cp $$x $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+		chmod 755 $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+	done
 
 uninstall_man_docs:
 	@$(ECHO) "*** Uninstalling manpages"
-	$(PERL) $(SRCDIR)/util/process_docs.pl \
-		--destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
-		--remove
+	@set -e; for x in dummy $(MANDOCS1); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn"; \
+		$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS3); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn"; \
+		$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS5); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn"; \
+		$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+	done
+	@set -e; for x in dummy $(MANDOCS7); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn"; \
+		$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+	done
 
-install_html_docs:
+install_html_docs: build_html_docs
 	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
+	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
 	@$(ECHO) "*** Installing HTML manpages"
-	$(PERL) $(SRCDIR)/util/process_docs.pl \
-		--destdir=$(DESTDIR)$(HTMLDIR) --type=html
+	@set -e; for x in dummy $(HTMLDOCS1); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
+		cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+		chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS3); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
+		cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+		chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS5); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
+		cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+		chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS7); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
+		cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+		chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+	done
 
 uninstall_html_docs:
-	@$(ECHO) "*** Uninstalling manpages"
-	$(PERL) $(SRCDIR)/util/process_docs.pl \
-		--destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
-
+	@$(ECHO) "*** Uninstalling HTML manpages"
+	@set -e; for x in dummy $(HTMLDOCS1); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
+		$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS3); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
+		$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS5); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
+		$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+	done
+	@set -e; for x in dummy $(HTMLDOCS7); do \
+		if [ "$$x" = "dummy" ]; then continue; fi; \
+		fn=`basename $$x`; \
+		$(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
+		$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+	done
 
 # Developer targets (note: these are only available on Unix) #########
 
@@ -1027,7 +1169,25 @@ reconfigure reconf:
       my $defs = join("", map { " -D".$_ } @{$args{defs}});
       my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+	  my $title = basename($args{src}, ".html");
+	  return <<"EOF";
+$args{src}: $args{generator}->[0]
+	pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
+		 --podpath=man1:man3:man5:man7 "--infile=\$<" "--title=$title" \\
+	| \$(PERL) -pe 's|href="http://man\\.he\\.net/(man\\d/[^"]+)(?:\\.html)?"|href="../\$1.html|g;' \\
+	> \$\@
+EOF
+      } elsif ($args{src} =~ /\.(\d)$/) {
+	  my $section = $1;
+	  my $name = uc basename($args{src}, ".$section");
+	  return <<"EOF";
+$args{src}: $args{generator}->[0]
+	pod2man --name=$name --section=$section --center=OpenSSL \\
+		--release=\$(VERSION) \$< \\
+	> \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
           my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index d0bce73664..7bc09df78d 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -111,6 +111,10 @@ MISC_SCRIPTS={-
                          && $unified_info{attributes}->{scripts}->{$_}->{misc} }
                   @{$unified_info{scripts}})
 -}
+HTMLDOCS1={- join(" ", @{$unified_info{htmldocs}->{man1}}) -}
+HTMLDOCS3={- join(" ", @{$unified_info{htmldocs}->{man3}}) -}
+HTMLDOCS5={- join(" ", @{$unified_info{htmldocs}->{man5}}) -}
+HTMLDOCS7={- join(" ", @{$unified_info{htmldocs}->{man7}}) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 "\"".catfile("apps","openssl")."\"" -}
@@ -338,11 +342,14 @@ PROCESSOR= {- $config{processor} -}
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
+{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
 {- dependmagic('build_libs'); -}: build_libs_nodep
 {- dependmagic('build_modules'); -}: build_modules_nodep
 {- dependmagic('build_programs'); -}: build_programs_nodep
 
+build_docs: build_html_docs
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 build_generated: $(GENERATED_MANDATORY)
 build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
 build_modules_nodep: $(MODULES)
@@ -353,13 +360,15 @@ build_apps build_tests: build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
 	@{- output_off() if $disabled{makedepend}; "" -}
 	@$(ECHO) "Warning: consider configuring with no-makedepend, because if"
 	@$(ECHO) "         target system doesn't have $(PERL),"
 	@$(ECHO) "         then make will fail..."
 	@{- output_on() if $disabled{makedepend}; "" -}
 
+all: build_sw build_docs
+
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep
 	@{- output_off() if $disabled{tests}; "" -}
@@ -393,6 +402,10 @@ libclean:
 	-del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
 
 clean: libclean
+	-rmdir /Q /S $(HTMLDOCS1)
+	-rmdir /Q /S $(HTMLDOCS3)
+	-rmdir /Q /S $(HTMLDOCS5)
+	-rmdir /Q /S $(HTMLDOCS7)
 	{- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
 	-del /Q /F $(MODULES)
 	-del /Q /F $(SCRIPTS)
@@ -496,9 +509,21 @@ install_programs: install_runtime_libs build_programs
 
 uninstall_runtime:
 
-install_html_docs:
-        "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
-                "--destdir=$(INSTALLTOP)\html" --type=html
+install_html_docs: build_html_docs
+	@if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
+	@echo *** Installing HTML docs
+	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1"
+	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3"
+	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5"
+	@"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7"
+	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \
+                                        "$(INSTALLTOP)\html\man1"
+	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \
+                                        "$(INSTALLTOP)\html\man3"
+	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \
+                                        "$(INSTALLTOP)\html\man5"
+	@"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \
+                                        "$(INSTALLTOP)\html\man7"
 
 uninstall_html_docs:
 
@@ -540,7 +565,16 @@ reconfigure reconf:
       my $deps = @{$args{deps}} ?
           '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+	  my $title = basename($args{src}, ".html");
+	  return <<"EOF";
+$args{src}: $args{generator}->[0]
+	pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
+		 --podpath=man1:man3:man5:man7 "--infile=\$<" "--title=$title" \\
+	| \$(PERL) -pe "s|href=\\"http://man\\.he\\.net/(man\d/[^\\"]+)(?:\\.html)?\\"|href=\\"../\$1.html|g;" \\
+	> \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
                                               "util", "mkdef.pl")),
diff --git a/Configure b/Configure
index 8087da52e6..bad09ed8a3 100755
--- a/Configure
+++ b/Configure
@@ -1777,6 +1777,8 @@ if ($builder eq "unified") {
         my %defines = ();
         my %depends = ();
         my %generate = ();
+        my %htmldocs = ();
+        my %mandocs = ();
 
         # Support for $variablename in build.info files.
         # Embedded perl code is the ultimate master, still.  If its output
@@ -1837,6 +1839,10 @@ if ($builder eq "unified") {
         # don't use it if the build tree is different.
         my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir);
 
+
+        if ($buildinfo_debug) {
+            print STDERR "DEBUG: Reading ",catfile($sourced, $f),"\n";
+        }
         push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
         my $template =
             Text::Template->new(TYPE => 'FILE',
@@ -1948,7 +1954,14 @@ if ($builder eq "unified") {
                                          @s);
                 }
             },
-
+            qr/^\s* HTMLDOCS ${index_re} = ${value_re} $/x
+            => sub { push @{$htmldocs{$expand_variables->($+{INDEX})}},
+                         tokenize($expand_variables->($+{VALUE}))
+                         if !@skip || $skip[$#skip] > 0 },
+            qr/^\s* MANDOCS ${index_re} = ${value_re} $/x
+            => sub { push @{$mandocs{$expand_variables->($+{INDEX})}},
+                         tokenize($expand_variables->($+{VALUE}))
+                         if !@skip || $skip[$#skip] > 0 },
             qr/^\s* ORDINALS ${index_re} = ${value_re} $/x
             => sub { push @{$ordinals{$expand_variables->($+{INDEX})}},
                          tokenize($expand_variables->($+{VALUE}))
@@ -2111,10 +2124,18 @@ EOF
             my $dest = $_;
             my $ddest = cleanfile($buildd, $_, $blddir);
             die "more than one generator for $dest: "
-                    ,join(" ", @{$generate{$_}}),"\n"
-                    if scalar @{$generate{$_}} > 1;
+                ,join(" ", @{$generate{$_}}),"\n"
+                if scalar @{$generate{$_}} > 1;
             my @generator = split /\s+/, $generate{$dest}->[0];
-            $generator[0] = cleanfile($sourced, $generator[0], $blddir),
+            my $gen = $generator[0];
+            $generator[0] = cleanfile($sourced, $gen, $blddir);
+
+            # If the generator isn't in the source tree, we assume it's
+            # generated in the build tree
+            if ($generate{$gen}) {
+                $generator[0] = cleanfile($buildd, $gen, $blddir);
+            }
+
             $unified_info{generate}->{$ddest} = [ @generator ];
         }
 
@@ -2206,6 +2227,20 @@ EOF
                 }
             }
         }
+
+        foreach my $section (keys %htmldocs) {
+            foreach (@{$htmldocs{$section}}) {
+                my $htmldocs = cleanfile($buildd, $_, $blddir);
+                $unified_info{htmldocs}->{$section}->{$htmldocs} = 1;
+            }
+        }
+
+        foreach my $section (keys %mandocs) {
+            foreach (@{$mandocs{$section}}) {
+                my $mandocs = cleanfile($buildd, $_, $blddir);
+                $unified_info{mandocs}->{$section}->{$mandocs} = 1;
+            }
+        }
     }
 
     my $ordinals_text = join(', ', sort keys %ordinals);
@@ -2366,7 +2401,8 @@ EOF
         $unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
     }
     # Two level structures
-    foreach my $l1 (("sources", "shared_sources", "ldadd", "depends")) {
+    foreach my $l1 (("sources", "shared_sources", "ldadd", "depends",
+                     "htmldocs", "mandocs")) {
         foreach my $l2 (sort keys %{$unified_info{$l1}}) {
             my @items =
                 sort
@@ -2412,7 +2448,11 @@ EOF
     my %loopinfo = ( "lib" => [ @{$unified_info{libraries}} ],
                      "dso" => [ @{$unified_info{modules}} ],
                      "bin" => [ @{$unified_info{programs}} ],
-                     "script" => [ @{$unified_info{scripts}} ] );
+                     "script" => [ @{$unified_info{scripts}} ],
+                     "docs" => [ (map { @{$unified_info{htmldocs}->{$_} // []} }
+                                  keys %{$unified_info{htmldocs} // {}}),
+                                 (map { @{$unified_info{mandocs}->{$_} // []} }
+                                  keys %{$unified_info{mandocs} // {}}) ] );
     foreach my $type (keys %loopinfo) {
         foreach my $product (@{$loopinfo{$type}}) {
             my %dirs = ();
diff --git a/INSTALL b/INSTALL
index 0bddf761a1..1c8b580114 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1156,7 +1156,15 @@
  described here. Examine the Makefiles themselves for the full list.
 
  all
-                The default target to build all the software components.
+                The target to build all the software components and
+                documentation.
+
+ build_sw
+                Build all the software components.
+                THIS IS THE DEFAULT TARGET.
+
+ build_docs
+                Build all documentation components.
 
  clean
                 Remove all build artefacts and return the directory to a "clean"
diff --git a/build.info b/build.info
index a050ae9530..a28ddbe739 100644
--- a/build.info
+++ b/build.info
@@ -1,6 +1,6 @@
 # Note that some of these directories are filtered in Configure.  Look for
 # %skipdir there for further explanations.
-SUBDIRS=crypto ssl apps test util tools fuzz engines providers doc/man1
+SUBDIRS=crypto ssl apps test util tools fuzz engines providers doc
 
 LIBS=libcrypto libssl
 INCLUDE[libcrypto]=. include
diff --git a/doc/build.info b/doc/build.info
new file mode 100644
index 0000000000..47728fed56
--- /dev/null
+++ b/doc/build.info
@@ -0,0 +1,66 @@
+SUBDIRS = man1
+
+{-
+ use File::Spec::Functions qw(:DEFAULT abs2rel rel2abs);
+ use File::Basename;
+
+ foreach my $section ((1, 3, 5, 7)) {
+     my @htmlfiles = ();
+     my @manfiles = ();
+     my %podfiles =
+         map { $_ => 1 } glob catfile($sourcedir, "man$section", "*.pod");
+     my %podinfiles = 
+         map { $_ => 1 } glob catfile($sourcedir, "man$section", "*.pod.in");
+
+     foreach (keys %podinfiles) {
+         (my $p = $_) =~ s|\.in$||i;
+         $podfiles{$p} = 1;
+     }
+
+     foreach my $p (sort keys %podfiles) {
+         my $podfile = abs2rel($p, $sourcedir);
+         my $podname = basename($podfile, '.pod');
+         my $podinfile = $podinfiles{"$p.in"} ? "$podfile.in" : undef;
+
+         my $podname = basename($podfile, ".pod");
+
+         my $htmlfile = abs2rel(catfile($buildtop, "doc", "html", "man$section",
+                                        "$podname.html"),
+                                catdir($buildtop, "doc"));
+         my $manfile = abs2rel(catfile($buildtop, "doc", "man", "man$section",
+                                       "$podname.$section"),
+                               catdir($buildtop, "doc"));
+
+         # The build.info format requires file specs to be in Unix format.
+         # Especially, since VMS file specs use [ and ], the build.info parser
+         # will otherwise get terribly confused.
+         if ($^O eq 'VMS') {
+             $htmlfile = VMS::Filespec::unixify($htmlfile);
+             $manfile = VMS::Filespec::unixify($manfile);
+             $podfile = VMS::Filespec::unixify($podfile);
+             $podinfile = VMS::Filespec::unixify($podinfile)
+                 if defined $podinfile;
+         } elsif ($^O eq 'MSWin32') {
+             $htmlfile =~ s|\\|/|g;
+             $manfile =~ s|\\|/|g;
+             $podfile =~ s|\\|/|g;
+             $podinfile =~ s|\\|/|g
+                 if defined $podinfile;
+         }
+         push @htmlfiles, $htmlfile;
+         push @manfiles, $manfile;
+         $OUT .= << "_____";
+DEPEND[$htmlfile]=$podfile
+GENERATE[$htmlfile]=$podfile
+DEPEND[$manfile]=$podfile
+GENERATE[$manfile]=$podfile
+_____
+         $OUT .= << "_____" if $podinfile;
+DEPEND[$podfile]=$podinfile ../configdata.pm
+GENERATE[$podfile]=$podinfile
+_____
+     }
+     $OUT .= "HTMLDOCS[man$section]=" . join(" \\\n", @htmlfiles) . "\n";
+     $OUT .= "MANDOCS[man$section]=" . join(" \\\n", @manfiles) . "\n";
+ }
+ -}


More information about the openssl-commits mailing list