2 # $Cambridge: exim/doc/doc-docbook/OS-Fixups,v 1.3 2010/05/28 15:38:18 nm4 Exp $
5 # Script to hack around using absolute paths in xsl:import with fixups.
6 # Let every OS define its own manipulations.
7 # Uses the Perl $^O values to identify the current OS.
9 # Define filter_$^O to do substitutions, will be called for every line of
14 s{"/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/}
15 {"/usr/local/share/xsl/docbook/};
16 s{"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"}
17 {"/usr/local/share/xml/docbook/4.2/docbookx.dtd"};
22 # SUSE 10 with extra pkgs
23 s{"/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/}
24 {"/usr/share/xml/docbook/stylesheet/nwalsh/1.71.1/};
25 s{"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"}
26 {"/usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd"};
31 # NB - this uses the Mac Ports installations
32 s{"/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/}
33 {"/opt/local/share/xsl/docbook-xsl/};
34 s{"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"}
35 {"/opt/local/share/xml/docbook/4.2/docbookx.dtd"};
39 # Define OS filters above.
42 $os_filter = $main::{"filter_$^O"} if exists $main::{"filter_$^O"};
44 unless (defined $os_filter)
46 print "No changes defined for your OS ($^O).\n";
50 for my $fn (<*.xsl>, <*.xml>)
52 my $orig = "$fn.orig";
53 rename($fn, $orig) or die "Failed to rename($fn, $orig): $!\n";
54 # Most portable is two-argument form, and none of our filenames are
55 # untrusted or contain whitespace.
56 open(OLD, "< $orig") or die "Failed to read-open($orig): $!\n";
57 open(NEW, "> $fn") or die "Failed to write-open($fn): $!\n";
61 print NEW $_ or die "Write to \"$fn\" failed: $!\n";
63 close(NEW) or die "Failed to close($fn) after writing: $!\n";