Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: allow custom lldb headers path with npm install #315

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ make plugin

# To configure and build both the plugin and the addon
npm install --llnode_build_addon=true
# To configure and build with a specific path to headers
npm install --llnode_lldb_include_dir=/path/to/lldb/include

# Without npm
LLNODE_BUILD_ADDON=true node scripts/configure.js && node scripts/install.js && node scripts/cleanup.js
# Or use make
Expand Down
15 changes: 9 additions & 6 deletions scripts/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function configureInstallation(osName, buildDir) {
// - What level of lldb we are running.
// - If we need to download the headers. (Linux may have them installed)
let installation;
let includeDir;
let includeDir = process.env.npm_config_llnode_lldb_include_dir ||
process.env.LLNODE_LLDB_INCLUDE_DIR;
const config = {
variables: {}
};
Expand Down Expand Up @@ -82,11 +83,13 @@ function configureInstallation(osName, buildDir) {
process.exit(1);
}

if (installation.includeDir === undefined) {
// Could not find the headers, need to download them
includeDir = lldb.cloneHeaders(installation.version, buildDir);
} else {
includeDir = installation.includeDir;
if (!includeDir) {
if (installation.includeDir === undefined) {
// Could not find the headers, need to download them
includeDir = lldb.cloneHeaders(installation.version, buildDir);
} else {
includeDir = installation.includeDir;
}
}
config.variables['lldb_include_dir%'] = includeDir;
return {
Expand Down
2 changes: 1 addition & 1 deletion scripts/lldb.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function getLldbVersion(lldbExe) {
return undefined;
}
// Ignore minor revisions like 3.8.1
const versionMatch = lldbStr.match(/version (\d.\d)/);
const versionMatch = lldbStr.match(/version (\d+.\d+)/);
if (versionMatch) {
return versionMatch[1];
}
Expand Down