]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/hard-coded_location_for_man_pages_and_w3m_cgi_wrapper.mdwn
response
[ikiwiki.git] / doc / bugs / 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 <pre>
12
13   - Introduce two variables, IKI_MANDIR and IKI_W3MCGIDIR, to be set from
14     the command line. This enables locations for man pages and the w3m
15     cgi wrapper other than the hard-coded defaults in Makefile.PL.
16
17 --- Makefile.PL.orig    2007-05-20 03:03:58.000000000 +0200
18 +++ Makefile.PL
19 @@ -3,9 +3,32 @@ use warnings;
20  use strict;
21  use ExtUtils::MakeMaker;
22  
23 +my %params = ( 'IKI_MANDIR' => '$(PREFIX)/share/man',
24 +               'IKI_W3MCGIDIR' => '$(PREFIX)/lib/w3m/cgi-bin'
25 +             );
26 +
27 +@ARGV = grep {
28 +  my ($key, $value) = split(/=/, $_, 2);
29 +  if ( exists $params{$key} ) {
30 +    $params{$key} = $value;
31 +    print "Using $params{$key} for $key.\n";
32 +    0
33 +  } else {
34 +    1
35 +  }
36 +} @ARGV;
37 +
38 +
39  # Add a few more targets.
40  sub MY::postamble {
41 -q{
42 +  package MY;
43 +
44 +  my $scriptvars = <<"EOSCRIPTVARS";
45 +IKI_MANDIR = $params{'IKI_MANDIR'}
46 +IKI_W3MCGIDIR = $params{'IKI_W3MCGIDIR'}
47 +EOSCRIPTVARS
48 +
49 +  my $script = q{
50  all:: extra_build
51  clean:: extra_clean
52  install:: extra_install
53 @@ -56,23 +79,24 @@ extra_install:
54                 done; \
55         done
56  
57 -       install -d $(DESTDIR)$(PREFIX)/share/man/man1
58 -       install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
59 +       install -d $(DESTDIR)$(IKI_MANDIR)/man1
60 +       install -m 644 ikiwiki.man $(DESTDIR)$(IKI_MANDIR)/man1/ikiwiki.1
61         
62 -       install -d $(DESTDIR)$(PREFIX)/share/man/man8
63 -       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/ma
64 n8/ikiwiki-mass-rebuild.8
65 +       install -d $(DESTDIR)$(IKI_MANDIR)/man8
66 +       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(IKI_MANDIR)/man8/iki
67 wiki-mass-rebuild.8
68         
69         install -d $(DESTDIR)$(PREFIX)/sbin
70         install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
71  
72 -       install -d $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
73 -       install ikiwiki-w3m.cgi $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
74 +       install -d $(DESTDIR)$(IKI_W3MCGIDIR)
75 +       install ikiwiki-w3m.cgi $(DESTDIR)$(IKI_W3MCGIDIR)
76  
77         install -d $(DESTDIR)$(PREFIX)/bin
78         install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
79  
80         $(MAKE) -C po install PREFIX=$(PREFIX)
81 -}
82 +};
83 +  return $scriptvars.$script;
84  }
85  
86  WriteMakefile(
87
88 </pre>