Skip to content

Commit ca01048

Browse files
committed
build: install both addon and plugin during npm install
1 parent 2889a4b commit ca01048

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ plugin: configure
3939
node scripts/cleanup.js
4040

4141
.PHONY: addon
42-
addon:
43-
node scripts/configure.js
42+
addon: configure
4443
node-gyp rebuild
4544

4645
.PHONY: _travis
@@ -50,6 +49,14 @@ _travis:
5049
LLNODE_DEBUG=true \
5150
npm test
5251

52+
# `configure` is run during preinstall.
53+
# This is run by `npm install`.
54+
.PHONY: npm-build
55+
npm-build:
56+
./gyp_llnode
57+
$(MAKE) -C out/
58+
node-gyp rebuild
59+
5360
.PHONY: clean
5461
clean:
5562
$(RM) -r out

binding.gyp

Lines changed: 7 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",
@@ -26,8 +27,12 @@
2627
"<(lldb_dir)/include",
2728
"<!(node -e \"require('nan')\")"
2829
],
30+
"cflags" : [ "-std=c++11" ],
2931
"conditions": [
3032
[ "OS == 'mac'", {
33+
"xcode_settings": {
34+
"OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ],
35+
},
3136
"conditions": [
3237
[ "lldb_build_dir == ''", {
3338
"variables": {
@@ -36,8 +41,8 @@
3641
"xcode_settings": {
3742
"OTHER_LDFLAGS": [
3843
"-F<(mac_shared_frameworks)",
39-
"-Wl,-rpath,<(mac_shared_frameworks)",
40-
"-framework LLDB",
44+
"-Wl,-rpath,<(mac_shared_frameworks)",
45+
"-framework LLDB",
4146
],
4247
},
4348
},

package.json

Lines changed: 2 additions & 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
},
@@ -22,6 +22,7 @@
2222
},
2323
"files": [
2424
"Makefile",
25+
"binding.gyp",
2526
"llnode.gyp.json",
2627
"gyp_llnode",
2728
"common.gypi",

scripts/configure.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function getLinuxLib(version) {
340340
console.log('Checking for shared libraries, version is ' + version);
341341
try {
342342
const libDir = child_process.execFileSync('llvm-config-' + version,
343-
['--libdir']).toString().trim();
343+
['--libdir']).toString().trim();
344344
const soPath = path.join(libDir, `liblldb-${version}.so`);
345345
const stat = fs.lstatSync(soPath);
346346
if (stat.isFile() || stat.isSymbolicLink()) {
@@ -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)