forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add lib path env when node_shared=true
When building the node with `--shared` option, the major output is the shared library. However, we still build a node executable which links to the shared lib. It's for testing purpose. When testing with the executable, some test cases move/copy the executable, change the relative path to the shared library and fail. Using lib path env would solve the issue. However, in macOS, need to change the install name for the shared library and use rpath in the executable. In AIX, `-brtl` linker option rebinds the symbols in the executable and addon modules could use them. Signed-off-by: Yihong Wang <yh.wang@ibm.com> PR-URL: nodejs#18626 Refs: nodejs#18535 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- Loading branch information
1 parent
e8020cf
commit 6e9c1fc
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable required-modules */ | ||
'use strict'; | ||
const path = require('path'); | ||
|
||
// If node executable is linked to shared lib, need to take care about the | ||
// shared lib path. | ||
exports.addLibraryPath = function(env) { | ||
if (!process.config.variables.node_shared) { | ||
return; | ||
} | ||
|
||
env = env || process.env; | ||
|
||
env.LD_LIBRARY_PATH = | ||
(env.LD_LIBRARY_PATH ? env.LD_LIBRARY_PATH + path.delimiter : '') + | ||
path.join(path.dirname(process.execPath), 'lib.target'); | ||
// For AIX. | ||
env.LIBPATH = | ||
(env.LIBPATH ? env.LIBPATH + path.delimiter : '') + | ||
path.join(path.dirname(process.execPath), 'lib.target'); | ||
// For Mac OSX. | ||
env.DYLD_LIBRARY_PATH = | ||
(env.DYLD_LIBRARY_PATH ? env.DYLD_LIBRARY_PATH + path.delimiter : '') + | ||
path.dirname(process.execPath); | ||
// For Windows. | ||
env.PATH = | ||
(env.PATH ? env.PATH + path.delimiter : '') + | ||
path.dirname(process.execPath); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters