From ceaff61c09cc45af511884a3e99804955682c692 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 14 Mar 2018 14:12:12 -0500 Subject: [PATCH] Pull in the podToHtml.pl script and rules from 3.15 This lets src/cap5 build with Perl installations that lack Perl's podchecker and pod2html scripts (e.g. Fedora 27). --- configure/RULES.Db | 14 +++++++++++++ configure/RULES_BUILD | 4 ++++ src/cap5/Makefile | 4 ---- src/tools/Makefile | 1 + src/tools/podToHtml.pl | 45 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/tools/podToHtml.pl diff --git a/configure/RULES.Db b/configure/RULES.Db index fcb7737f4..615fb2b5a 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -301,6 +301,20 @@ $(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file)))) .PRECIOUS: $(COMMON_DBDS) $(COMMON_DIR)/%Include.dbd +##################################################### HTML files + +$(COMMON_DIR)/%.html: %.pm $(TOOLS)/podToHtml.pl + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ + +$(COMMON_DIR)/%.html: ../%.pm $(TOOLS)/podToHtml.pl + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ + +.PRECIOUS: $(COMMON_DIR)/%.html %.html + ##################################################### DB files $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 2c8de45c5..fb04b9e4c 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -500,6 +500,10 @@ $(INSTALL_HTML)/$(HTMLS_DIR)/%: ../% $(ECHO) "Installing html $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) +$(INSTALL_HTML)/$(HTMLS_DIR)/%: $(COMMON_DIR)/% + $(ECHO) "Installing generated html $@" + @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL_TEMPLATES_SUBDIR)/%: ../% $(ECHO) "Installing $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) diff --git a/src/cap5/Makefile b/src/cap5/Makefile index f749864c5..cde47ce8e 100644 --- a/src/cap5/Makefile +++ b/src/cap5/Makefile @@ -66,10 +66,6 @@ ifdef T_A $(RM) $@ $@_new $(PERL) $(XSUBPP) -typemap $(EXTUTILS)/typemap $< > $@_new && $(MV) $@_new $@ - %.html: ../%.pm - $(RM) $@ - podchecker $< && pod2html --infile=$< --outfile=$@ - $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH)/%: % $(ECHO) "Installing loadable shared library $@" @$(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH) diff --git a/src/tools/Makefile b/src/tools/Makefile index 672944958..bcf12700d 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -28,6 +28,7 @@ PERL_SCRIPTS += makeMakefile.pl PERL_SCRIPTS += makeTestfile.pl PERL_SCRIPTS += mkmf.pl PERL_SCRIPTS += munch.pl +PERL_SCRIPTS += podToHtml.pl PERL_SCRIPTS += replaceVAR.pl PERL_SCRIPTS += tap-to-junit-xml.pl PERL_SCRIPTS += useManifestTool.pl diff --git a/src/tools/podToHtml.pl b/src/tools/podToHtml.pl new file mode 100644 index 000000000..99ee5b426 --- /dev/null +++ b/src/tools/podToHtml.pl @@ -0,0 +1,45 @@ +#!/usr/bin/env perl +#************************************************************************* +# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +use strict; +use warnings; + +use Getopt::Std; +use Pod::Simple::HTML; + +our ($opt_o); + +$Getopt::Std::OUTPUT_HELP_VERSION = 1; +&HELP_MESSAGE if !getopts('o:') || @ARGV != 1; + +my $infile = shift @ARGV; + +if (!$opt_o) { + ($opt_o = $infile) =~ s/\. \w+ $/.html/x; + $opt_o =~ s/^.*\///; +} + +open my $out, '>', $opt_o or + die "Can't create $opt_o: $!\n"; + +my $podHtml = Pod::Simple::HTML->new(); + +$podHtml->html_css('style.css'); +$podHtml->perldoc_url_prefix(''); +$podHtml->perldoc_url_postfix('.html'); +$podHtml->set_source($infile); +$podHtml->output_string(\my $html); +$podHtml->run; + +print $out $html; +close $out; + +sub HELP_MESSAGE { + print STDERR "Usage: podToHtml.pl [-o file.html] file.pod\n"; + exit 2; +}