Skip to content

Commit 8172c06

Browse files
authored
Have ExtUtils::MakeMaker maintain all rpath arguments
ExtUtils::MakeMaker previously dropped any rpath argument that isn't an existing directory. This is too restrictive because: * the directory could be created after the Makefile is generated * rpaths can be the variables $ORIGIN on Linux or @rpath, @loader_path, or @executable_path on Mac Also, do a Makefile escape of any single '$' in the rpath value ($ -> $$). Since the rpath value may also be consumed in a test in Makefile.PL where it doesn't need to be escaped, it's inconvenient to unescape it there. See #439
1 parent 5422e75 commit 8172c06

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/ExtUtils/Liblist/Kid.pm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ sub _unix_os2_ext {
7676
# Handle possible linker path arguments.
7777
if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) { # save path flag type
7878
my ( $ptype ) = $1;
79-
unless ( -d $thislib ) {
80-
warn "$ptype$thislib ignored, directory does not exist\n"
81-
if $verbose;
82-
next;
83-
}
8479
my ( $rtype ) = $ptype;
8580
if ( ( $ptype eq '-R' ) or ( $ptype =~ m!^-Wl,-[Rr]! ) ) {
8681
if ( $Config{'lddlflags'} =~ /-Wl,-[Rr]/ ) {
@@ -89,8 +84,15 @@ sub _unix_os2_ext {
8984
elsif ( $Config{'lddlflags'} =~ /-R/ ) {
9085
$rtype = '-R';
9186
}
87+
if ($thislib =~ s{(?<!\$)\$(?!\$)}{\\\$\$}g) {
88+
print "Escaping single dollar sign for Makefile\n";
89+
}
90+
} elsif (!-d $thislib ) {
91+
warn "$ptype$thislib ignored, directory does not exist\n"
92+
if $verbose;
93+
next;
9294
}
93-
unless ( File::Spec->file_name_is_absolute( $thislib ) ) {
95+
if (-d $thislib && !File::Spec->file_name_is_absolute( $thislib ) ) {
9496
warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n";
9597
$thislib = $self->catdir( $pwd, $thislib );
9698
}

0 commit comments

Comments
 (0)