From f4d99ac1ca03121255e545df89e7d841a02cc0bf Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 25 Aug 2006 02:12:43 +0000 Subject: * 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. --- IkiWiki.pm | 6 +++-- Makefile.PL | 29 ++++++++++++----------- debian/changelog | 5 +++- debian/copyright | 2 +- debian/rules | 2 +- doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn | 6 +---- doc/usage.mdwn | 6 +++-- pm_filter | 16 +++++++++++++ 8 files changed, 46 insertions(+), 26 deletions(-) create mode 100755 pm_filter diff --git a/IkiWiki.pm b/IkiWiki.pm index 5ebec5d0b..b6e160ab6 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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, diff --git a/Makefile.PL b/Makefile.PL index f2f5ba4a1..7123aef89 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,7 +14,7 @@ pure_install:: extra_install VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/' 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'}, ); diff --git a/debian/changelog b/debian/changelog index cc6b286ef..0672428b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 24 Aug 2006 16:29:24 -0400 + -- Joey Hess Thu, 24 Aug 2006 21:28:45 -0400 ikiwiki (1.21) unstable; urgency=low diff --git a/debian/copyright b/debian/copyright index 1b567623d..9b3639b35 100644 --- a/debian/copyright +++ b/debian/copyright @@ -11,7 +11,7 @@ The smiley icons were copied from Moin Moin, which has these copyrights: Copyright (C) 1999, 2000 Martin Pool 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 diff --git a/debian/rules b/debian/rules index 48ce274db..3358db5d9 100755 --- a/debian/rules +++ b/debian/rules @@ -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 diff --git a/doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn b/doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn index af2ee35cb..e66cad173 100644 --- a/doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn +++ b/doc/bugs/PREFIX_not_honoured_for_underlaydir.mdwn @@ -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]] diff --git a/doc/usage.mdwn b/doc/usage.mdwn index e0c7800d5..daef18c1f 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -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 index 000000000..89449bd91 --- /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/) { + $_=""; +} -- cgit v1.2.3