Skip to content

Commit f6c1d08

Browse files
committed
Fix install_modules
- Manually install Devel::PPPort's static lib as make install wasn't doing it - Hack ExtUtils::MakeMaker's Makefile.aperl to include DynaLoader in perlmain.c Previously when Perl was rebuilt with those modules missing from perlmain.c, Cwd would fail to load its XS module and fallback to the pure perl version whose abs_path didn't handle cosmo's /zip correctly.
1 parent fbf4c8b commit f6c1d08

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
MANIFEST
2+
.apperl
3+
.vscode

lib/Perl/Dist/APPerl.pm

+15-1
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,11 @@ sub Build {
11171117
my @toremove = ("$TEMPDIR$proxyConfig{installbin}/perl", "$TEMPDIR$proxyConfig{installbin}/perl$proxyConfig{version}");
11181118
print 'rm '.join(' ', @toremove)."\n";
11191119
unlink(@toremove) == scalar(@toremove) or die "Failed to unlink some files";
1120+
# HACK install Devel::PPort lib as this doesn't get done for some reason
1121+
if (-f "$TEMPDIR$proxyConfig{installarchlib}/Devel/PPPort.pm") {
1122+
_copy_recursive("lib/auto/Devel/PPPort", "$TEMPDIR$proxyConfig{installarchlib}/auto/Devel");
1123+
unlink("$TEMPDIR$proxyConfig{installarchlib}/auto/Devel/PPPort/.exists");
1124+
}
11201125
}
11211126
else {
11221127
make_path($ZIP_ROOT);
@@ -1236,7 +1241,16 @@ sub Build {
12361241
# build a new perl binary, convert to APE, and repack zip
12371242
#_command_or_die('make', 'perl.com.dbg');
12381243
#_command_or_die(dirname($proxyConfig{cc})."/x86_64-linux-musl-objcopy", '-S', '-O', 'binary', 'perl.com.dbg', 'perl.com');
1239-
_command_or_die('make', 'perl.com');
1244+
_command_or_die('make', 'Makefile.aperl');
1245+
# HACK, add in DynaLoader as it's missing
1246+
open(my $makefile, '<', 'Makefile.aperl') or die "failed to open Makefile.aperl";
1247+
my @newlines = map { $_ =~ s/writemain\((grep[^\)]+\))/writemain((DynaLoader, $1)/; $_} <$makefile>;
1248+
close($makefile);
1249+
open(my $newmakefile, '>', 'Makefile.aperl') or die "failed to open Makefile.aperl for writing";
1250+
print $newmakefile $_ foreach @newlines;
1251+
close($newmakefile);
1252+
# finally rebuild perl
1253+
_command_or_die('make', '-f', 'Makefile.aperl', 'perl.com');
12401254
$PERL_APE = abs_path('./perl.com');
12411255
}
12421256
else {

0 commit comments

Comments
 (0)