Skip to content

Instantly share code, notes, and snippets.

@skaji
Last active August 29, 2015 14:01
Show Gist options
  • Save skaji/4f254e23bc2446a59f5d to your computer and use it in GitHub Desktop.
Save skaji/4f254e23bc2446a59f5d to your computer and use it in GitHub Desktop.
ExtUtils::MakeMaker fixes shebang line by $Config{startperl} which is the initial perl absolute path. However this conflicts relocated perl. So let's make $Config{startperl} relocatable too!
diff --git Config_heavy.pl Config_heavy.pl
index 87dbcd7..1ebbdfc 100644
--- Config_heavy.pl
+++ Config_heavy.pl
@@ -1023,7 +1023,7 @@ perl_patchlevel=''
perl_static_inline='static __inline__'
perladmin='root@3639d5d915c8.(none)'
perllibs='-lnsl -ldl -lm -lcrypt -lutil -lc'
-perlpath='/root/perl/bin/perl'
+perlpath='.../perl'
pg='pg'
phostname='hostname'
pidtype='pid_t'
@@ -1135,7 +1135,7 @@ src='.'
ssizetype='ssize_t'
st_ino_sign='1'
st_ino_size='8'
-startperl='#!/root/perl/bin/perl'
+startperl='#!.../perl'
startsh='#!/bin/sh'
static_ext=' '
stdchar='char'
@@ -1254,8 +1254,8 @@ zip='zip'
my $i = ord(8);
foreach my $c (7,6,5,4,3,2,1) { $i <<= 8; $i |= ord($c); }
our $byteorder = join('', unpack('aaaaaaaa', pack('L!', $i)));
-foreach my $what (qw(prefixexp archlibexp man1direxp man3direxp privlibexp scriptdirexp sitearchexp sitebinexp sitelibexp siteman1direxp siteman3direxp sitescriptexp siteprefixexp sitelib_stem installarchlib installman1dir installman3dir installprefixexp installprivlib installscript installsitearch installsitebin installsitelib installsiteman1dir installsiteman3dir installsitescript)) {
- s/^($what=)(['"])(.*?)\2/$1 . $2 . relocate_inc($3) . $2/me;
+foreach my $what (qw(startperl perlpath prefixexp archlibexp man1direxp man3direxp privlibexp scriptdirexp sitearchexp sitebinexp sitelibexp siteman1direxp siteman3direxp sitescriptexp siteprefixexp sitelib_stem installarchlib installman1dir installman3dir installprefixexp installprivlib installscript installsitearch installsitebin installsitelib installsiteman1dir installsiteman3dir installsitescript)) {
+ s/^($what=)(['"])(#!)?(.*?)\2/$1 . $2 . ($3 || "") . relocate_inc($4) . $2/me;
}
s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment