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