Skip to content

Commit 9a58d8c

Browse files
committed
build: allow custom lldb headers path with npm install
It's possible to set a custom lldb headers path if configuring the build manually. This commit also allows users to do it when using `npm install`. This is useful when using lldb built from source, for example. PR-URL: #315 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent f7f9347 commit 9a58d8c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ make plugin
286286
287287
# To configure and build both the plugin and the addon
288288
npm install --llnode_build_addon=true
289+
# To configure and build with a specific path to headers
290+
npm install --llnode_lldb_include_dir=/path/to/lldb/include
291+
289292
# Without npm
290293
LLNODE_BUILD_ADDON=true node scripts/configure.js && node scripts/install.js && node scripts/cleanup.js
291294
# Or use make

scripts/configure.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ function configureInstallation(osName, buildDir) {
5151
// - What level of lldb we are running.
5252
// - If we need to download the headers. (Linux may have them installed)
5353
let installation;
54-
let includeDir;
54+
let includeDir = process.env.npm_config_llnode_lldb_include_dir ||
55+
process.env.LLNODE_LLDB_INCLUDE_DIR;
5556
const config = {
5657
variables: {}
5758
};
@@ -82,11 +83,13 @@ function configureInstallation(osName, buildDir) {
8283
process.exit(1);
8384
}
8485

85-
if (installation.includeDir === undefined) {
86-
// Could not find the headers, need to download them
87-
includeDir = lldb.cloneHeaders(installation.version, buildDir);
88-
} else {
89-
includeDir = installation.includeDir;
86+
if (!includeDir) {
87+
if (installation.includeDir === undefined) {
88+
// Could not find the headers, need to download them
89+
includeDir = lldb.cloneHeaders(installation.version, buildDir);
90+
} else {
91+
includeDir = installation.includeDir;
92+
}
9093
}
9194
config.variables['lldb_include_dir%'] = includeDir;
9295
return {

scripts/lldb.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function getLldbVersion(lldbExe) {
146146
return undefined;
147147
}
148148
// Ignore minor revisions like 3.8.1
149-
const versionMatch = lldbStr.match(/version (\d.\d)/);
149+
const versionMatch = lldbStr.match(/version (\d+.\d+)/);
150150
if (versionMatch) {
151151
return versionMatch[1];
152152
}

0 commit comments

Comments
 (0)