Skip to content

Commit 2f35e85

Browse files
committed
build: install both addon and plugin during npm install
1 parent a283c85 commit 2f35e85

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ build/
88
out/
99
npm-debug.log
1010
node_modules/
11+
1112
# generated by scripts/configure.js
1213
options.gypi
13-
.project
14-
addon.node

Makefile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,26 @@ _travis:
2525
TEST_LLDB_BINARY=`which lldb-3.6` npm test
2626

2727
clean:
28-
rm -rf out
29-
rm -rf build
30-
rm -rf options.gypi
31-
rm -rf lldb
32-
rm -rf addon.node llnode.so
28+
$(RM) -r out
29+
$(RM) -r build
30+
$(RM) options.gypi
31+
$(RM) lldb
32+
$(RM) llnode.so llnode.dylib
3333

34-
addon:
34+
configure: scripts/configure.js
3535
node scripts/configure.js
36+
37+
addon: configure
3638
node-gyp rebuild
3739

38-
plugin:
39-
node ./scripts/configure.js
40+
plugin: configure
4041
./gyp_llnode
4142
$(MAKE) -C out/
4243

43-
.PHONY: all addon clean plugin format
44+
# configure is run during preinstall
45+
npm-build:
46+
./gyp_llnode
47+
$(MAKE) -C out/
48+
node-gyp rebuild
49+
50+
.PHONY: all addon clean plugin format npm-build

binding.gyp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
"targets": [{
1515
"target_name": "addon",
16+
"type": "loadable_module",
1617
"sources": [
1718
"src/addon.cc",
1819
"src/llnode_module.cc",
@@ -36,8 +37,8 @@
3637
"xcode_settings": {
3738
"OTHER_LDFLAGS": [
3839
"-F<(mac_shared_frameworks)",
39-
"-Wl,-rpath,<(mac_shared_frameworks)",
40-
"-framework LLDB",
40+
"-Wl,-rpath,<(mac_shared_frameworks)",
41+
"-framework LLDB",
4142
],
4243
},
4344
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"//": "(Blame C++)",
1313
"scripts": {
1414
"preinstall": "node scripts/configure.js",
15-
"install": "./gyp_llnode && ( gmake -C out/ || make -C out/ )",
15+
"install": "( gmake npm-build || make npm-build )",
1616
"postinstall": "node scripts/cleanup.js",
1717
"test": "tape test/*-test.js"
1818
},

scripts/configure.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ function getLinuxLib(version) {
342342
const libDir = child_process.execFileSync('llvm-config-' + version,
343343
['--libdir']).toString().trim();
344344
const soPath = path.join(libDir, `liblldb-${version}.so`);
345-
const stat = fs.lstatSync(soPath);
346-
if (stat.isFile() || stat.isSymbolicLink()) {
345+
const stat = fs.statSync(soPath);
346+
if (stat.isFile()) {
347347
return {
348348
buildDir: path.dirname(libDir),
349349
lib: `lldb-${version}`
@@ -353,7 +353,7 @@ function getLinuxLib(version) {
353353
console.log(err);
354354
// Return undefined, we will download the headers.
355355
}
356-
// On Redhat lib are just installed in /usr/lib
356+
// On Redhat libs are just installed in /usr/lib
357357
if (fs.existsSync('/usr/lib/lldblldb.so')) {
358358
return {
359359
buildDir: '/usr',

0 commit comments

Comments
 (0)