more triage
[ikiwiki] / doc / patchqueue / hard-coded_location_for_man_pages_and_w3m_cgi_wrapper.mdwn
1 Hi,
2
3 some operating systems use PREFIX/man instead of PREFIX/share/man as the base
4 directory for man pages and PREFIX/libexec/ instead of PREFIX/lib/ for files
5 like CGI programs.
6 At the moment the location of the installed man pages and the w3m cgi wrapper
7 is hard-coded in Makefile.PL.
8 The patch below makes it possible to install those files to alternative directories
9 while the default stays as it is now.
10
11 > It should be possible to use the existing MakeMaker variables such as
12 > INSTALLMAN1DIR (though MakeMaker lacks one for man8). I'd prefer not
13 > adding new variables where MakeMaker already has them. --[[Joey]]
14
15 <pre>
16
17   - Introduce two variables, IKI_MANDIR and IKI_W3MCGIDIR, to be set from
18     the command line. This enables locations for man pages and the w3m
19     cgi wrapper other than the hard-coded defaults in Makefile.PL.
20
21 --- Makefile.PL.orig    2007-05-20 03:03:58.000000000 +0200
22 +++ Makefile.PL
23 @@ -3,9 +3,32 @@ use warnings;
24  use strict;
25  use ExtUtils::MakeMaker;
26  
27 +my %params = ( 'IKI_MANDIR' => '$(PREFIX)/share/man',
28 +               'IKI_W3MCGIDIR' => '$(PREFIX)/lib/w3m/cgi-bin'
29 +             );
30 +
31 +@ARGV = grep {
32 +  my ($key, $value) = split(/=/, $_, 2);
33 +  if ( exists $params{$key} ) {
34 +    $params{$key} = $value;
35 +    print "Using $params{$key} for $key.\n";
36 +    0
37 +  } else {
38 +    1
39 +  }
40 +} @ARGV;
41 +
42 +
43  # Add a few more targets.
44  sub MY::postamble {
45 -q{
46 +  package MY;
47 +
48 +  my $scriptvars = <<"EOSCRIPTVARS";
49 +IKI_MANDIR = $params{'IKI_MANDIR'}
50 +IKI_W3MCGIDIR = $params{'IKI_W3MCGIDIR'}
51 +EOSCRIPTVARS
52 +
53 +  my $script = q{
54  all:: extra_build
55  clean:: extra_clean
56  install:: extra_install
57 @@ -56,23 +79,24 @@ extra_install:
58                 done; \
59         done
60  
61 -       install -d $(DESTDIR)$(PREFIX)/share/man/man1
62 -       install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
63 +       install -d $(DESTDIR)$(IKI_MANDIR)/man1
64 +       install -m 644 ikiwiki.man $(DESTDIR)$(IKI_MANDIR)/man1/ikiwiki.1
65         
66 -       install -d $(DESTDIR)$(PREFIX)/share/man/man8
67 -       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/ma
68 n8/ikiwiki-mass-rebuild.8
69 +       install -d $(DESTDIR)$(IKI_MANDIR)/man8
70 +       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(IKI_MANDIR)/man8/iki
71 wiki-mass-rebuild.8
72         
73         install -d $(DESTDIR)$(PREFIX)/sbin
74         install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
75  
76 -       install -d $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
77 -       install ikiwiki-w3m.cgi $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
78 +       install -d $(DESTDIR)$(IKI_W3MCGIDIR)
79 +       install ikiwiki-w3m.cgi $(DESTDIR)$(IKI_W3MCGIDIR)
80  
81         install -d $(DESTDIR)$(PREFIX)/bin
82         install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
83  
84         $(MAKE) -C po install PREFIX=$(PREFIX)
85 -}
86 +};
87 +  return $scriptvars.$script;
88  }
89  
90  WriteMakefile(
91
92 </pre>