2006-08-25 04:12:43 +02:00
|
|
|
#!/usr/bin/perl -i -p
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
$prefix=shift;
|
|
|
|
$ver=shift;
|
2006-11-20 23:12:43 +01:00
|
|
|
$libdir=shift;
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (/INSTALLDIR_AUTOREPLACE/) {
|
2009-01-13 00:55:56 +01:00
|
|
|
$_=qq{our \$installdir="$prefix";};
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
|
|
|
elsif (/VERSION_AUTOREPLACE/) {
|
|
|
|
$_=qq{our \$version="$ver";};
|
|
|
|
}
|
|
|
|
elsif (/^use lib/) {
|
2008-05-14 08:42:01 +02:00
|
|
|
# The idea here is to figure out if the libdir the Makefile.PL
|
2009-02-04 19:45:54 +01:00
|
|
|
# was configured to use is in perl's normal search path.
|
2008-05-14 08:42:01 +02:00
|
|
|
# If not, hard code it into ikiwiki.
|
|
|
|
if ((grep { $_ eq $libdir } @INC) &&
|
|
|
|
(! exists $ENV{PERL5LIB} || ! length $ENV{PERL5LIB} ||
|
|
|
|
$ENV{PERL5LIB} ne $libdir)) {
|
2006-11-20 23:12:43 +01:00
|
|
|
$_="";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$_="use lib '$libdir';\n";
|
|
|
|
}
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
2008-04-28 21:37:17 +02:00
|
|
|
elsif ($. == 1 && ($ENV{NOTAINT} || ! exists $ENV{NOTAINT}) && m{^(#!.*perl.*?) -T$}) {
|
2007-02-20 02:09:48 +01:00
|
|
|
$_=qq{$1\n};
|
|
|
|
}
|
2008-04-29 04:13:12 +02:00
|
|
|
elsif (/^\$ENV{PATH}="(.*)";/) {
|
2008-04-28 19:44:37 +02:00
|
|
|
$_="\$ENV{PATH}=\"$1:$prefix/bin\";\n";
|
|
|
|
}
|