[exim-cvs] cvs commit: exim/exim-doc/doc-docbook Makefile OS…

Top Page
Delete this message
Reply to this message
Author: Nigel Metheringham
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-doc/doc-docbook Makefile OS-Fixups
nm4 2009/10/16 11:36:52 BST

  Modified files:
    exim-doc/doc-docbook Makefile 
  Added files:
    exim-doc/doc-docbook OS-Fixups 
  Log:
  doc os fixup script from Phil Pennock. fixes: #765


  Revision  Changes    Path
  1.13      +12 -0     exim/exim-doc/doc-docbook/Makefile
  1.1       +46 -0     exim/exim-doc/doc-docbook/OS-Fixups (new)


Index: OS-Fixups
====================================================================
#!/usr/bin/perl -w
# $Cambridge: exim/exim-doc/doc-docbook/OS-Fixups,v 1.1 2009/10/16 10:36:52 nm4 Exp $
use strict;

# Script to hack around using absolute paths in xsl:import with fixups.
# Let every OS define its own manipulations.
# Uses the Perl $^O values to identify the current OS.
#
# Define filter_$^O to do substitutions, will be called for every line of
# every .xsl file.

sub filter_freebsd
{
s{"/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/}
{"/usr/local/share/xsl/docbook/};
s{"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"}
{"/usr/local/share/xml/docbook/4.2/docbookx.dtd"};
}

# Define OS filters above.

my $os_filter;
$os_filter = $main::{"filter_$^O"} if exists $main::{"filter_$^O"};

  unless (defined $os_filter)
    {
    print "No changes defined for your OS ($^O).\n";
    exit 0;
    }


  for my $fn (<*.xsl>, <*.xml>)
    {
    my $orig = "$fn.orig";
    rename($fn, $orig) or die "Failed to rename($fn, $orig): $!\n";
    # Most portable is two-argument form, and none of our filenames are
    # untrusted or contain whitespace.
    open(OLD, "< $orig") or die "Failed to read-open($orig): $!\n";
    open(NEW, "> $fn") or die "Failed to write-open($fn): $!\n";
    while (<OLD>)
      {
      $os_filter->();
      print NEW $_ or die "Write to \"$fn\" failed: $!\n";
      }
    close(NEW) or die "Failed to close($fn) after writing: $!\n";
    close(OLD);
    }


  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-docbook/Makefile,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Makefile    1 Dec 2007 15:53:55 -0000    1.12
  +++ Makefile    16 Oct 2009 10:36:52 -0000    1.13
  @@ -1,4 +1,4 @@
  -# $Cambridge: exim/exim-doc/doc-docbook/Makefile,v 1.12 2007/12/01 15:53:55 nm4 Exp $
  +# $Cambridge: exim/exim-doc/doc-docbook/Makefile,v 1.13 2009/10/16 10:36:52 nm4 Exp $


# Make file for Exim documentation from xfpt source.

@@ -290,6 +290,18 @@
########################################################################


  +############################## OS FIXUP ################################
  +
  +# Yes, we've advanced so far in text processing that we now have to
  +# hardcode in complete paths and so become dependent upon exactly where
  +# files were installed for xsl:import.  Which of course varies by OS.
  +
  +os-fixup:
  +    ./OS-Fixups
  +
  +########################################################################
  +
  +
   ################################ CLEAN #################################


clean:; /bin/rm -rf exim.8 \