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/) {
|
2016-09-04 00:46:33 +02:00
|
|
|
$_=qq{our \$installdir="\Q$prefix\E";};
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
|
|
|
elsif (/VERSION_AUTOREPLACE/) {
|
2016-09-04 00:46:33 +02:00
|
|
|
$_=qq{our \$version="\Q$ver\E";};
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
2016-07-28 10:50:09 +02:00
|
|
|
elsif (/^(?:use FindBin; *)?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 {
|
2016-09-04 00:46:33 +02:00
|
|
|
$_="use lib \"\Q$libdir\E\";\n";
|
2006-11-20 23:12:43 +01:00
|
|
|
}
|
2006-08-25 04:12:43 +02:00
|
|
|
}
|
2009-05-22 19:45:38 +02:00
|
|
|
elsif ($. == 1 && ($ENV{NOTAINT}=0) && m{^(#!.*perl.*?)$}) {
|
|
|
|
$_=qq{$1 -T\n};
|
2007-02-20 02:09:48 +01:00
|
|
|
}
|
2015-06-15 03:35:51 +02:00
|
|
|
elsif (/^\$ENV\{PATH}="(.*)";/) {
|
2016-09-04 00:46:33 +02:00
|
|
|
$_="\$ENV{PATH}=\"\Q$1\E:\Q$prefix\E/bin\";\n";
|
2008-04-28 19:44:37 +02:00
|
|
|
}
|