fix use ordering
[ikiwiki] / pm_filter
CommitLineData
f4d99ac1 1#!/usr/bin/perl -i -p
2
3BEGIN {
4 $prefix=shift;
5 $ver=shift;
5bc73d7f 6 $libdir=shift;
f4d99ac1 7}
8
9if (/INSTALLDIR_AUTOREPLACE/) {
10 $_=qq{my \$installdir="$prefix";};
11}
12elsif (/VERSION_AUTOREPLACE/) {
13 $_=qq{our \$version="$ver";};
14}
15elsif (/^use lib/) {
2c6f41e5
JH
16 # The idea here is to figure out if the libdir the Makefile.PL
17 # was configure to use is in perl's normal search path.
18 # If not, hard code it into ikiwiki.
19 if ((grep { $_ eq $libdir } @INC) &&
20 (! exists $ENV{PERL5LIB} || ! length $ENV{PERL5LIB} ||
21 $ENV{PERL5LIB} ne $libdir)) {
5bc73d7f 22 $_="";
23 }
24 else {
25 $_="use lib '$libdir';\n";
26 }
f4d99ac1 27}
dbb5d111 28elsif ($. == 1 && ($ENV{NOTAINT} || ! exists $ENV{NOTAINT}) && m{^(#!.*perl.*?) -T$}) {
34f1c2ae 29 $_=qq{$1\n};
30}
8fdb37d7 31elsif (/^\$ENV{PATH}="(.*)";/) {
9f02ee86
JH
32 $_="\$ENV{PATH}=\"$1:$prefix/bin\";\n";
33}