* Use DESTDIR and not PREFIX to specify installation prefix for packaging.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 25 Aug 2006 02:12:43 +0000 (02:12 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 25 Aug 2006 02:12:43 +0000 (02:12 +0000)
* Support running "perl Makefile.PL PREFIX=foo" to build ikiwiki to run
  from a different directory.

IkiWiki.pm
Makefile.PL
debian/changelog
debian/copyright
debian/rules
doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn
doc/usage.mdwn
pm_filter [new file with mode: 0755]

index 5ebec5d0b1cf94d1b7a030f3336d0335029db421..b6e160ab6e0010ab1007c98d80e7ebb0c6b19a1a 100644 (file)
@@ -15,6 +15,8 @@ memoize("pagespec_translate");
 use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase
             %renderedfiles %pagesources %depends %hooks %forcerebuild};
 
+my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
+
 sub defaultconfig () { #{{{
        wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$)},
        wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/,
@@ -44,8 +46,8 @@ sub defaultconfig () { #{{{
        srcdir => undef,
        destdir => undef,
        pingurl => [],
-       templatedir => "/usr/share/ikiwiki/templates",
-       underlaydir => "/usr/share/ikiwiki/basewiki",
+       templatedir => "$installdir/share/ikiwiki/templates",
+       underlaydir => "$installdir/share/ikiwiki/basewiki",
        setup => undef,
        adminuser => undef,
        adminemail => undef,
index f2f5ba4a19659f950775cd62c320e42787fa78e1..7123aef89a9ca4627e62ef1419f850a0976b12b2 100755 (executable)
@@ -14,7 +14,7 @@ pure_install:: extra_install
 VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
 
 ikiwiki: ikiwiki.pl
-       perl -pe '$$_="" if /use lib/; $$_="our \$$version=\"$(VER)\";\n" if /VERSION_AUTOREPLACE/' ikiwiki.pl > ikiwiki
+       ./pm_filter $(PREFIX) $(VER) < ikiwiki.pl > ikiwiki
 
 extra_build:
        ./ikiwiki.pl doc html --templatedir=templates --underlaydir=basewiki \
@@ -33,29 +33,30 @@ extra_clean:
        rm -f ikiwiki.man ikiwiki-mass-rebuild.man
 
 extra_install:
-       install -d $(PREFIX)/share/ikiwiki/templates
-       cp templates/* $(PREFIX)/share/ikiwiki/templates
+       install -d $(DESTDIR)/usr/share/ikiwiki/templates
+       cp templates/* $(DESTDIR)/usr/share/ikiwiki/templates
 
-       install -d $(PREFIX)/share/ikiwiki/basewiki
-       cp -a basewiki/* $(PREFIX)/share/ikiwiki/basewiki
+       install -d $(DESTDIR)/usr/share/ikiwiki/basewiki
+       cp -a basewiki/* $(DESTDIR)/usr/share/ikiwiki/basewiki
 
-       install -d $(PREFIX)/share/man/man1
-       install ikiwiki.man $(PREFIX)/share/man/man1/ikiwiki.1
+       install -d $(DESTDIR)/usr/share/man/man1
+       install ikiwiki.man $(DESTDIR)/usr/share/man/man1/ikiwiki.1
        
-       install -d $(PREFIX)/share/man/man8
-       install ikiwiki-mass-rebuild.man $(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8
+       install -d $(DESTDIR)/usr/share/man/man8
+       install ikiwiki-mass-rebuild.man $(DESTDIR)/usr/share/man/man8/ikiwiki-mass-rebuild.8
        
-       install -d $(PREFIX)/sbin
-       install ikiwiki-mass-rebuild $(PREFIX)/sbin
+       install -d $(DESTDIR)/usr/sbin
+       install ikiwiki-mass-rebuild $(DESTDIR)/usr/sbin
 
-       install -d $(PREFIX)/lib/w3m/cgi-bin
-       install ikiwiki-w3m.cgi $(PREFIX)/lib/w3m/cgi-bin
+       install -d $(DESTDIR)/usr/lib/w3m/cgi-bin
+       install ikiwiki-w3m.cgi $(DESTDIR)/usr/lib/w3m/cgi-bin
 }
 }
 
 WriteMakefile(
        'NAME'          => 'IkiWiki',
-       'PM_FILTER'     => 'grep -v "removed by Makefile"',
+       'PM_FILTER'     => './pm_filter $(PREFIX) $(VER)',
        'EXE_FILES'     => ['ikiwiki'],
+       'MAN1PODS'      => {},
        'clean'         => {FILES => 'ikiwiki'},
 );
index cc6b286ef94d400cbd24845d7c695d2a07148e28..0672428b1ada52c8efc9d034839970dd9790ba43 100644 (file)
@@ -27,8 +27,11 @@ ikiwiki (1.22) UNRELEASED; urgency=low
   * Make all pages pull in a local.css style sheet, if present. This won't
     be included in ikiwiki, but can be created to make local styling changes
     w/o needing to merge in every new change to the distributed style.css.
+  * Use DESTDIR and not PREFIX to specify installation prefix for packaging.
+  * Support running "perl Makefile.PL PREFIX=foo" to build ikiwiki to run
+    from a different directory.
 
- -- Joey Hess <joeyh@debian.org>  Thu, 24 Aug 2006 16:29:24 -0400
+ -- Joey Hess <joeyh@debian.org>  Thu, 24 Aug 2006 21:28:45 -0400
 
 ikiwiki (1.21) unstable; urgency=low
 
index 1b567623db7d8072d035e4e423596a93f587b57f..9b3639b35880a020f87a76b4f203da43b3589239 100644 (file)
@@ -11,7 +11,7 @@ The smiley icons were copied from Moin Moin, which has these copyrights:
        Copyright (C) 1999, 2000 Martin Pool <mbp@humbug.org.au>
 Moin Moin is licensed under the terms of GPL version 2 or later.
 
-The basewiki and templates are licensed using a varient of the BSD license:
+The basewiki and templates are licensed using a variant of the BSD license:
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
index 48ce274db6e1908eb5bf9ae11955140a218c336e..3358db5d90e11505fd90eebfb53af91815e1ef34 100755 (executable)
@@ -23,7 +23,7 @@ binary-indep: build
        dh_testroot
        dh_clean -k
        $(MAKE) pure_install INSTALLDIRS=vendor \
-               PREFIX=$(shell pwd)/debian/ikiwiki/$(shell perl -MConfig -e 'print $$Config{prefix}')
+               DESTDIR=$(shell pwd)/debian/ikiwiki
        dh_install wikilist etc/ikiwiki
        dh_installdocs html
        dh_link usr/share/common-licenses/GPL usr/share/doc/ikiwiki/html/GPL
index af2ee35cbdfdcae03890cddc211dd5972336e7f1..e66cad173df67126a2ae338f18f8f233048c4001 100644 (file)
@@ -41,8 +41,4 @@ isn't entirely clear (perhaps because ordinary Perl modules do not need to be
 configured at build time depending on the installation directory).  It does mention
 that DESTDIR is the thing used by packaging tools.
 
-       It would probably be nice if ikiwiki offered a separate build-time
-       setting to control where it looked for its data files, though it already
-       offers a way to do it at runtime (--underlaydir and --templatedir).
-
-       --[[Joey]]
+       Thanks for clarifying that. [[bugs/done]] --[[Joey]]
index e0c7800d5928a091e37f0224cca470bf8f9be6f8..daef18c1fa3728cf9c4c9878cd44ffccda8d0362 100644 (file)
@@ -91,13 +91,15 @@ configuration options of their own.
 * --templatedir
 
   Specify the directory that the page [[templates]] are stored in.
-  Default is `/usr/share/ikiwiki/templates`.
+  Default is `/usr/share/ikiwiki/templates`, or another location as
+  configured at build time.
 
 * --underlaydir
 
   Specify the directory that is used to underlay the source directory.
   Source files will be taken from here unless overridden by a file in the
-  source directory. Default is `/usr/share/ikiwiki/basewiki`.
+  source directory. Default is `/usr/share/ikiwiki/basewiki` or another
+  location as configured at build time.
 
 * --wrappermode mode
 
diff --git a/pm_filter b/pm_filter
new file mode 100755 (executable)
index 0000000..89449bd
--- /dev/null
+++ b/pm_filter
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -i -p
+
+BEGIN {
+       $prefix=shift;
+       $ver=shift;
+}
+
+if (/INSTALLDIR_AUTOREPLACE/) {
+       $_=qq{my \$installdir="$prefix";};
+}
+elsif (/VERSION_AUTOREPLACE/) {
+       $_=qq{our \$version="$ver";};
+}
+elsif (/^use lib/) {
+       $_="";
+}