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