Skip to content

Commit

Permalink
Merge pull request #6 from eddyb/patch-1
Browse files Browse the repository at this point in the history
Link static lib directly into .node, remove OSX hack.
  • Loading branch information
Dave Herman committed Dec 28, 2015
2 parents e42256b + 21c7477 commit e2b3e37
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions templates/binding.gyp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,20 @@ Required context:

"variables": {
"rust_inputs": [{{#each project.rust.inputs}}{{#unless @first}}, {{/unless}}"{{this}}"{{/each}}],
"static_lib": "target/{{build.cfg.cargo}}/<(STATIC_LIB_PREFIX){{project.name}}<(STATIC_LIB_SUFFIX)",
"shared_lib": "target/{{build.cfg.cargo}}/<(SHARED_LIB_PREFIX){{project.name}}<(SHARED_LIB_SUFFIX)"
"static_lib": "target/{{build.cfg.cargo}}/<(STATIC_LIB_PREFIX){{project.name}}<(STATIC_LIB_SUFFIX)"
},

"sources": ["<(INTERMEDIATE_DIR)/binding.cc"], {{~! built client-side }}

"include_dirs": ["<!(neon include-path)"], {{~! computed client-side }}

"libraries": ["../<(shared_lib)"], {{~! gyp weirdly determines libraries from a subdirectory so ../ is needed }}
"libraries": ["../<(static_lib)"], {{~! gyp weirdly determines libraries from a subdirectory so ../ is needed }}

"actions": [{
"action_name": "cargo",
"inputs": ["<@(rust_inputs)"],
"outputs": ["../<(static_lib)"],
"action": [{{#each build.cargo.cmd}}"{{this}}", {{/each}}"cargo", "rustc", {{#if build.release}}"--release", {{/if}}"--", "--crate-type", "staticlib"]
}, {
"action_name": "shared_lib",
"inputs": ["<(static_lib)"],
"outputs": ["../<(shared_lib)"],
# FIXME: OSX-specific
"action": ["gcc", "-dynamiclib", "-Wl,-undefined,dynamic_lookup", "-Wl,-force_load,<(static_lib)", "-o", "<(shared_lib)"]
}, {
"action_name": "generate",
"inputs": [],
Expand Down

0 comments on commit e2b3e37

Please sign in to comment.