aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/hard-coded_location_for_man_pages_and_w3m_cgi_wrapper.mdwn
blob: 7cf37fbb9e96e7e81429766c4fc512019c5ccd21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Hi,

some operating systems use PREFIX/man instead of PREFIX/share/man as the base
directory for man pages and PREFIX/libexec/ instead of PREFIX/lib/ for files
like CGI programs.
At the moment the location of the installed man pages and the w3m cgi wrapper
is hard-coded in Makefile.PL.
The patch below makes it possible to install those files to alternative directories
while the default stays as it is now.

> It should be possible to use the existing MakeMaker variables such as
> INSTALLMAN1DIR (though MakeMaker lacks one for man8). I'd prefer not
> adding new variables where MakeMaker already has them. --[[Joey]]

[[!tag patch patch/core]]

<pre>

  - Introduce two variables, IKI_MANDIR and IKI_W3MCGIDIR, to be set from
    the command line. This enables locations for man pages and the w3m
    cgi wrapper other than the hard-coded defaults in Makefile.PL.

--- Makefile.PL.orig    2007-05-20 03:03:58.000000000 +0200
+++ Makefile.PL
@@ -3,9 +3,32 @@ use warnings;
 use strict;
 use ExtUtils::MakeMaker;
 
+my %params = ( 'IKI_MANDIR' => '$(PREFIX)/share/man',
+               'IKI_W3MCGIDIR' => '$(PREFIX)/lib/w3m/cgi-bin'
+             );
+
+@ARGV = grep {
+  my ($key, $value) = split(/=/, $_, 2);
+  if ( exists $params{$key} ) {
+    $params{$key} = $value;
+    print "Using $params{$key} for $key.\n";
+    0
+  } else {
+    1
+  }
+} @ARGV;
+
+
 # Add a few more targets.
 sub MY::postamble {
-q{
+  package MY;
+
+  my $scriptvars = <<"EOSCRIPTVARS";
+IKI_MANDIR = $params{'IKI_MANDIR'}
+IKI_W3MCGIDIR = $params{'IKI_W3MCGIDIR'}
+EOSCRIPTVARS
+
+  my $script = q{
 all:: extra_build
 clean:: extra_clean
 install:: extra_install
@@ -56,23 +79,24 @@ extra_install:
                done; \
        done
 
-       install -d $(DESTDIR)$(PREFIX)/share/man/man1
-       install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
+       install -d $(DESTDIR)$(IKI_MANDIR)/man1
+       install -m 644 ikiwiki.man $(DESTDIR)$(IKI_MANDIR)/man1/ikiwiki.1
        
-       install -d $(DESTDIR)$(PREFIX)/share/man/man8
-       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/ma
n8/ikiwiki-mass-rebuild.8
+       install -d $(DESTDIR)$(IKI_MANDIR)/man8
+       install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(IKI_MANDIR)/man8/iki
wiki-mass-rebuild.8
        
        install -d $(DESTDIR)$(PREFIX)/sbin
        install ikiwiki-mass-rebuild $(DESTDIR)$(PREFIX)/sbin
 
-       install -d $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
-       install ikiwiki-w3m.cgi $(DESTDIR)$(PREFIX)/lib/w3m/cgi-bin
+       install -d $(DESTDIR)$(IKI_W3MCGIDIR)
+       install ikiwiki-w3m.cgi $(DESTDIR)$(IKI_W3MCGIDIR)
 
        install -d $(DESTDIR)$(PREFIX)/bin
        install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
 
        $(MAKE) -C po install PREFIX=$(PREFIX)
-}
+};
+  return $scriptvars.$script;
 }
 
 WriteMakefile(

</pre>