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: merge gyp_llnode into scripts/configure.js #182

Merged
merged 1 commit into from
Mar 31, 2018
Merged
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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ dist: trusty
before_install:
- sudo apt-get -qq update
- sudo apt-get install lldb-3.9 liblldb-3.9-dev -y
- git clone https://chromium.googlesource.com/external/gyp.git tools/gyp
node_js:
- "4"
- "6"
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ format:
.PHONY: configure
configure:
node scripts/configure.js
./gyp_llnode

.PHONY: plugin
plugin: configure
$(MAKE) -C out/
node-gyp rebuild
node scripts/cleanup.js

.PHONY: _travis
Expand All @@ -47,7 +46,7 @@ _travis:

.PHONY: clean
clean:
$(RM) -r out
$(RM) options.gypi
$(RM) -r build
$(RM) config.gypi
$(RM) lldb
$(RM) llnode.so llnode.dylib
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ If you have `lldb` available on your `PATH`, simply run:
npm install -g llnode
```

To use a particular build of lldb, use the `--lldb_exe` option. For example,
on Linux the executable on the `PATH` might be `lldb-3.9`:
To build llnode against a specific lldb version matching an lldb executable,
use the `--lldb_exe` npm option. For example, on Linux the executable on the
`PATH` might be `lldb-3.9`:

```bash
npm install --lldb_exe=`which lldb-3.9` -g llnode
Expand Down Expand Up @@ -245,20 +246,20 @@ make plugin
To configure the build yourself:

```bash
# Detect available LLDB installation and download headers if necessary
# Detect available lldb installation and download headers if necessary
node scripts/configure.js

# To configure with the detected LLDB installation
./gyp_llnode
# To configure with a specified LLDB installation on OS X/macOS
./gyp_llnode -Dlldb_build_dir=/usr/local/Cellar/llvm/5.0.0
# To configure with a specified LLDB installation on Linux
./gyp_llnode -Dlldb_dir=/usr/lib/llvm-3.9/
# To configure with a specified LLDB installation on FreeBSD
./gyp_llnode -Dlldb_dir=/usr/local/llvm39/

# Build
make -C out/ -j9
# To configure with the detected lldb installation
node-gyp configure
# To configure with a specified path to headers, where `$lldb_header_dir/include`
# contains the <lldb/*/*.h> headers
node-gyp configure -- -Dlldb_header_dir=/usr/local/Cellar/llvm/5.0.0
# To configure with a specified path to the libraries, where `$lldb_lib_dir/lib`
# contains `liblldb.so` or `liblldb.dylib`
node-gyp configure -- -Dlldb_lib_dir=/usr/lib/llvm-3.9

# Build the plugin
node-gyp build

# Move the built plugin to the project directory
node scripts/cleanup.js
Expand Down
71 changes: 70 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
@@ -1,3 +1,72 @@
{
"targets": [{ "target_name": "none", "type": "none" }]
"includes": [
"llnode.gypi",
"config.gypi"
],

"variables": {
# gyp does not appear to let you test for undefined variables, so define
# lldb_lib_dir as empty so we can test it later.
"lldb_lib_dir%": ""
},

"targets": [{
"target_name": "plugin",
"type": "shared_library",
"product_prefix": "",

"include_dirs": [
".",
"<(lldb_header_dir)/include",
],

"sources": [
"src/llnode.cc",
"src/llv8.cc",
"src/llv8-constants.cc",
"src/llscan.cc",
],

"cflags" : [ "-std=c++11" ],

"conditions": [
[ "OS == 'mac'", {
# Necessary for node v4.x
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ],
"OTHER_LDFLAGS": [ "-stdlib=libc++" ],
},

"conditions": [
[ "lldb_lib_dir == ''", {
"variables": {
"mac_shared_frameworks": "/Applications/Xcode.app/Contents/SharedFrameworks",
},
"xcode_settings": {
"OTHER_LDFLAGS": [
"-F<(mac_shared_frameworks)",
"-Wl,-rpath,<(mac_shared_frameworks)",
"-framework LLDB",
],
},
},
# lldb_lib_dir != ""
{
"xcode_settings": {
"OTHER_LDFLAGS": [
"-Wl,-rpath,<(lldb_lib_dir)/lib",
"-L<(lldb_lib_dir)/lib",
"-l<(lldb_lib)",
],
},
}],
],
}],
]
},
{
"target_name": "install",
"type":"none",
"dependencies" : [ "plugin" ]
}],
}
99 changes: 0 additions & 99 deletions gyp_llnode

This file was deleted.

1 change: 0 additions & 1 deletion llnode.gyp

This file was deleted.

54 changes: 0 additions & 54 deletions llnode.gyp.json

This file was deleted.

2 changes: 1 addition & 1 deletion common.gypi → llnode.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"msvs_multi_core_compile": "0", # we do enable multicore compiles, but not using the V8 way
"gcc_version%": "unknown",
"clang%": 1,
"lldb_dir%": "lldb",
"lldb_header_dir%": "lldb",
"lldb_lib%": "lldb",
"conditions": [
["GENERATOR == 'ninja'", {
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
"bin": {
"llnode": "llnode.sh"
},
"//": "(Blame C++)",
"scripts": {
"preinstall": "node scripts/configure.js",
"install": "./gyp_llnode && ( gmake -C out/ || make -C out/ )",
"install": "node-gyp rebuild",

This comment was marked as off-topic.

This comment was marked as off-topic.

"postinstall": "node scripts/cleanup.js",
"test": "tape test/*-test.js"
},
Expand All @@ -22,9 +21,8 @@
},
"files": [
"Makefile",
"llnode.gyp.json",
"gyp_llnode",
"common.gypi",
"binding.gyp",
"llnode.gypi",
"src/",
"scripts/"
],
Expand Down
19 changes: 14 additions & 5 deletions scripts/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const os = require('os');
const child_process = require('child_process');
const fs = require('fs');

const cwd = process.cwd();
const osName = os.type();
Expand All @@ -11,12 +12,20 @@ if (osName === 'Darwin') {
libExt = 'dylib';
}

const llnodeLib = `llnode.${libExt}`;
const llnodeLib = `plugin.${libExt}`;
const destLib = `llnode.${libExt}`;

// Move the library somewhere easy to remember.
console.log(`Copying ${cwd}/out/Release/${llnodeLib} to ${cwd}/${llnodeLib}`);
child_process.execSync(`mv ${cwd}/out/Release/${llnodeLib} ${cwd}/${llnodeLib}`);
let buildPath = `${cwd}/build/Release/${llnodeLib}`;

if (!fs.existsSync(buildPath)) {
buildPath = `${cwd}/build/Debug/${llnodeLib}`;
}

const destPath = `${cwd}/${destLib}`;

console.log(`Moving ${buildPath} to ${destPath}`);
fs.renameSync(buildPath, destPath);

console.log(`${os.EOL}llnode plugin installed, load in lldb with:`);
console.log(`(lldb) plugin load ${cwd}/${llnodeLib}`);
console.log(`(lldb) plugin load ${destPath}`);
console.log(`or copy plugin to lldb system plugin directory, see www.npmjs.org/llnode${os.EOL}`);
Loading