aboutsummaryrefslogtreecommitdiff
path: root/Makefile.PL
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2014-10-12 11:08:13 -0400
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2014-10-12 11:08:13 -0400
commit67e778f461ed0f5da0a109573b57d9f1022bcf9e (patch)
tree7e3047920ca2541f167c5326bda47ca6e0e4535b /Makefile.PL
parent47fff754c8e37466f6b8f1e5a70cc296431c41e3 (diff)
downloadikiwiki-67e778f461ed0f5da0a109573b57d9f1022bcf9e.tar
ikiwiki-67e778f461ed0f5da0a109573b57d9f1022bcf9e.tar.gz
Replace shebang paths with the build-time $(PERL).
On non-Debian systems, /usr/bin/perl might not be the best available Perl interpreter. Use whichever perl was used to run Makefile.PL, unless it was "/usr/bin/perl", in which case there's nothing to do.
Diffstat (limited to 'Makefile.PL')
-rwxr-xr-xMakefile.PL23
1 files changed, 21 insertions, 2 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 13ed103c7..61fe336b8 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -27,6 +27,7 @@ extramodules=$(shell if [ "$$PROFILE" = 1 ]; then printf -- "-d:NYTProf"; fi)
outprogs=ikiwiki.out ikiwiki-transition.out ikiwiki-calendar.out
scripts=ikiwiki-update-wikilist ikiwiki-makerepo
sysconfdir_scripts=ikiwiki-mass-rebuild ikiwiki-update-wikilist
+shebang_scripts=$(shell $(FIND) . -type f \( -name '*.in' -o -name '*.cgi' -o -name '*.pm' -o -name '*.pm.example' -o -name '*.t' -o -name '*.setup' -o -name 'ikiwiki-mass-rebuild' -o -name 'ikiwiki-update-wikilist' -o -name 'gitremotes' -o -name 'mdwn2man' -o -name 'pm_filter' -o -name 'po2wiki' -o -name 'externaldemo' \))
PROBABLE_INST_LIB=$(shell \\
if [ "$(INSTALLDIRS)" = "perl" ]; then \\
@@ -45,7 +46,7 @@ PROBABLE_INST_LIB=$(shell \\
ikiwiki.setup:
HOME=/home/me $(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -dumpsetup ikiwiki.setup
-extra_build: $(outprogs) ikiwiki.setup docwiki sysconfdir
+extra_build: perl_shebangs $(outprogs) ikiwiki.setup docwiki sysconfdir
./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
@@ -59,10 +60,28 @@ extra_build: $(outprogs) ikiwiki.setup docwiki sysconfdir
docwiki:
$(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -refresh
+perl_shebangs:
+ifneq "$(PERL)" "/usr/bin/perl"
+ for file in $(shebang_scripts); do \
+ $(SED) -e "1s|^#!/usr/bin/perl|#!$(PERL)|" < $$file > "$$file.new"; \
+ [ -x $$file ] && chmod +x "$$file.new"; \
+ mv -f "$$file.new" $$file; \
+ done
+endif
+
+perl_shebangs_clean:
+ifneq "$(PERL)" "/usr/bin/perl"
+ for file in $(shebang_scripts); do \
+ $(SED) -e "1s|^#!$(PERL)|#!/usr/bin/perl|" < $$file > "$$file.new"; \
+ [ -x $$file ] && chmod +x "$$file.new"; \
+ mv -f "$$file.new" $$file; \
+ done
+endif
+
sysconfdir:
$(PERL) -pi -e "s|\"/etc/ikiwiki|\"$(SYSCONFDIR)|g" $(sysconfdir_scripts)
-extra_clean:
+extra_clean: perl_shebangs_clean
$(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.in -setup docwiki.setup -clean
rm -f *.man $(outprogs) ikiwiki.setup plugins/*.pyc
$(MAKE) -C po clean