Skip to content

Commit

Permalink
build: install both addon and plugin during npm install
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Dec 23, 2017
1 parent 1fe3939 commit ac737d2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ build/
out/
npm-debug.log
node_modules/

# generated by scripts/configure.js
options.gypi
.project
addon.node
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ plugin: configure
node scripts/cleanup.js

.PHONY: addon
addon:
node scripts/configure.js
addon: configure
node-gyp rebuild

.PHONY: _travis
Expand All @@ -50,6 +49,14 @@ _travis:
LLNODE_DEBUG=true \
npm test

# `configure` is run during preinstall.
# This is run by `npm install`.
.PHONY: npm-build
npm-build:
./gyp_llnode
$(MAKE) -C out/
node-gyp rebuild

.PHONY: clean
clean:
$(RM) -r out
Expand Down
9 changes: 7 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

"targets": [{
"target_name": "addon",
"type": "loadable_module",
"sources": [
"src/addon.cc",
"src/llnode_module.cc",
Expand All @@ -26,8 +27,12 @@
"<(lldb_dir)/include",
"<!(node -e \"require('nan')\")"
],
"cflags" : [ "-std=c++11" ],
"conditions": [
[ "OS == 'mac'", {
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ],
},
"conditions": [
[ "lldb_build_dir == ''", {
"variables": {
Expand All @@ -36,8 +41,8 @@
"xcode_settings": {
"OTHER_LDFLAGS": [
"-F<(mac_shared_frameworks)",
"-Wl,-rpath,<(mac_shared_frameworks)",
"-framework LLDB",
"-Wl,-rpath,<(mac_shared_frameworks)",
"-framework LLDB",
],
},
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"//": "(Blame C++)",
"scripts": {
"preinstall": "node scripts/configure.js",
"install": "./gyp_llnode && ( gmake -C out/ || make -C out/ )",
"install": "( gmake npm-build || make npm-build )",
"postinstall": "node scripts/cleanup.js",
"test": "tape test/*-test.js"
},
Expand All @@ -22,6 +22,7 @@
},
"files": [
"Makefile",
"binding.gyp",
"llnode.gyp.json",
"gyp_llnode",
"common.gypi",
Expand Down
4 changes: 2 additions & 2 deletions scripts/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function getLinuxLib(version) {
console.log('Checking for shared libraries, version is ' + version);
try {
const libDir = child_process.execFileSync('llvm-config-' + version,
['--libdir']).toString().trim();
['--libdir']).toString().trim();
const soPath = path.join(libDir, `liblldb-${version}.so`);
const stat = fs.lstatSync(soPath);
if (stat.isFile() || stat.isSymbolicLink()) {
Expand All @@ -353,7 +353,7 @@ function getLinuxLib(version) {
console.log(err);
// Return undefined, we will download the headers.
}
// On Redhat lib are just installed in /usr/lib
// On Redhat libs are just installed in /usr/lib
if (fs.existsSync('/usr/lib/lldblldb.so')) {
return {
buildDir: '/usr',
Expand Down

0 comments on commit ac737d2

Please sign in to comment.