X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4e54fa1144065b7ff99e88e6c61ff1fdcf6175c9..965f66d87a03792c13fd0fd6e4e38c9458753748:/Makefile.PL

diff --git a/Makefile.PL b/Makefile.PL
index 69ba5e5ef..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)
+	$(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
@@ -75,7 +94,7 @@ underlay_install:
 	install -d $(DESTDIR)$(PREFIX)/share/ikiwiki
 	for dir in `cd underlays && $(FIND) . -follow -type d`; do \
 		install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
-		for file in `$(FIND) underlays/$$dir -follow -maxdepth 1 -type f -not -name \\*.full.js -not -name \\*.full.css`; do \
+		for file in `$(FIND) underlays/$$dir -follow -maxdepth 1 -type f ! -name jquery.js ! -name jquery-ui.css ! -name jquery-ui.js ! -name jquery.tmpl.js`; do \
 			cp -pRL $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir 2>/dev/null || \
 			install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \
 		done; \
@@ -96,7 +115,7 @@ underlay_install:
 		install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
 		for file in $$theme/*; do \
 			if echo "$$file" | grep -q style.css; then \
-				(cat doc/style.css; cat $$theme/base.css 2>/dev/null; cat $$file) >> $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
+				(cat doc/style.css; cat $$theme/base.css 2>/dev/null; cat $$file) > $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
 			elif echo "$$file" | grep -q base.css; then \
 				:; \
 			elif [ -f "$$file" ]; then \
@@ -187,5 +206,6 @@ WriteMakefile(
 		'HTML::Parser'		=> "0",
 		'URI'			=> "0",
 		'Data::Dumper'		=> "2.11",
+		'YAML::XS'		=> "0",
 	},
 );