Skip to content

Commit

Permalink
only set the shared library search path ...
Browse files Browse the repository at this point in the history
... environment variable that is relevant for the operating system
that we're building on
  • Loading branch information
rschupp committed Feb 11, 2017
1 parent 5a74f28 commit 2ac7078
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion myldr/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ sub MY::postamble
my $make_frag = <<"EOT";
LD=$ld
CC=$cc
CFLAGS=$cflags -DPARL_EXE=\\"parl$exe\\" -DPAR_PACKER_VERSION=\\"\$(VERSION)\\"
CFLAGS=$cflags -DLDLIBPTHNAME=\\"$Config{ldlibpthname}\\" -DPARL_EXE=\\"parl$exe\\" -DPAR_PACKER_VERSION=\\"\$(VERSION)\\"
OPTIMIZE=$optimize
LDFLAGS=$Config{ldflags}
PERL_LDFLAGS=$ldflags
Expand Down
32 changes: 12 additions & 20 deletions myldr/mktmpdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,20 @@ void par_setup_libpath( const char * stmpdir )
{
const char *key = NULL , *val = NULL;
int i;
char *ld_path = LDLIBPTHNAME;
char *ld_path_env = NULL;

/* NOTE: array is NULL terminated */
const char *ld_path_keys[] = {
"LD_LIBRARY_PATH", "LIBPATH", "LIBRARY_PATH",
"PATH", "DYLD_LIBRARY_PATH", "SHLIB_PATH", NULL
};

/* parentheses around the "for" condition are there to shut up compiler warnings */
for ( i = 0 ; (key = ld_path_keys[i]); i++ ) {
if ( (val = par_getenv(key)) == NULL || strlen(val) == 0 ) {
par_setenv(key, stmpdir);
}
else if ( !strstr(val, stmpdir) ) {
/* prepend stmpdir to (value of) environment variable */
ld_path_env = malloc(
strlen(stmpdir) + strlen(path_sep) + strlen(val) + 1);
sprintf(
ld_path_env, "%s%s%s",
stmpdir, path_sep, val);
par_setenv(key, ld_path_env);
}
if ( (val = par_getenv(ld_path)) == NULL || strlen(val) == 0 ) {
par_setenv(ld_path, stmpdir);
}
else if ( !strstr(val, stmpdir) ) {
/* prepend stmpdir to (value of) environment variable */
ld_path_env = malloc(
strlen(stmpdir) + strlen(path_sep) + strlen(val) + 1);
sprintf(
ld_path_env, "%s%s%s",
stmpdir, path_sep, val);
par_setenv(ld_path, ld_path_env);
}
}

Expand Down

0 comments on commit 2ac7078

Please sign in to comment.