| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,3 +18,4 @@ | |||
| 18 | 18 | !/include/wrapper.h | |
| 19 | 19 | ||
| 20 | 20 | /generate/idefs.json | |
| 21 | + /binding.gyp | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ const ejs = require("ejs"); | |||
| 4 | 4 | const path = require("path"); | |
| 5 | 5 | const idefs = require("./idefs"); | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | 7 | var local = path.join.bind(null, __dirname); | |
| 9 | 8 | ||
| 10 | 9 | var classTemplate = ejs.compile( | |
@@ -17,16 +16,22 @@ var headerTemplate = ejs.compile( | |||
| 17 | 16 | filename: "header.h" | |
| 18 | 17 | }); | |
| 19 | 18 | ||
| 20 | - Object.keys(idefs).forEach(function(keyName) { | ||
| 21 | - var idef = idefs[keyName]; | ||
| 19 | + var bindingTemplate = ejs.compile( | ||
| 20 | + "" + fs.readFileSync(local("templates/binding.gyp.ejs")), {}); | ||
| 22 | 21 | ||
| 23 | - if (idef.ignore) { | ||
| 24 | - return; | ||
| 25 | - } | ||
| 22 | + var enabled = idefs.filter(function(idef) { | ||
| 23 | + idef.name = path.basename(idef.filename, ".h"); | ||
| 24 | + return !idef.ignore; | ||
| 25 | + }); | ||
| 26 | 26 | ||
| 27 | + enabled.forEach(function(idef) { | ||
| 27 | 28 | fs.writeFileSync(local("../include/", idef.filename), headerTemplate(idef)); | |
| 28 | 29 | ||
| 29 | 30 | fs.writeFileSync( | |
| 30 | 31 | local("../src/", path.basename(idef.filename, ".h")) + ".cc", | |
| 31 | 32 | classTemplate(idef)); | |
| 33 | + | ||
| 34 | + fs.writeFileSync(local("../binding.gyp"), bindingTemplate({ | ||
| 35 | + idefs: idefs | ||
| 36 | + })); | ||
| 32 | 37 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,46 @@ | |||
| 1 | + { | ||
| 2 | + "targets": [ | ||
| 3 | + { | ||
| 4 | + "target_name": "nodegit", | ||
| 5 | + | ||
| 6 | + "dependencies": [ | ||
| 7 | + "<(module_root_dir)/vendor/libgit2.gyp:libgit2" | ||
| 8 | + ], | ||
| 9 | + | ||
| 10 | + "sources": [ | ||
| 11 | + # Maintained. | ||
| 12 | + "src/nodegit.cc", | ||
| 13 | + "src/wrapper.cc", | ||
| 14 | + "src/functions/copy.cc", | ||
| 15 | + | ||
| 16 | + # Generated from libgit2 descriptor. | ||
| 17 | + <% idefs.forEach(function(idef) { -%> | ||
| 18 | + "src/<%- idef.name %>.cc", | ||
| 19 | + <% }); -%> | ||
| 20 | + ], | ||
| 21 | + | ||
| 22 | + "include_dirs": [ | ||
| 23 | + "vendor/libv8-convert", | ||
| 24 | + "<!(node -e \"require('nan')\")" | ||
| 25 | + ], | ||
| 26 | + | ||
| 27 | + "cflags": [ | ||
| 28 | + "-Wall", | ||
| 29 | + ], | ||
| 30 | + | ||
| 31 | + "conditions": [ | ||
| 32 | + [ | ||
| 33 | + "OS=='mac'", { | ||
| 34 | + "xcode_settings": { | ||
| 35 | + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
| 36 | + | ||
| 37 | + "WARNING_CFLAGS": [ | ||
| 38 | + "-Wno-unused-variable", | ||
| 39 | + ], | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + ] | ||
| 43 | + ] | ||
| 44 | + }, | ||
| 45 | + ] | ||
| 46 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,9 @@ | |||
| 29 | 29 | #include <nan.h> | |
| 30 | 30 | #include <string.h> | |
| 31 | 31 | ||
| 32 | - #include "git2.h" | ||
| 32 | + extern "C" { | ||
| 33 | + #include <git2.h> | ||
| 34 | + } | ||
| 33 | 35 | ||
| 34 | 36 | #include "../include/functions/copy.h" | |
| 35 | 37 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,9 @@ | |||
| 8 | 8 | #include <nan.h> | |
| 9 | 9 | #include <string> | |
| 10 | 10 | ||
| 11 | - #include "git2.h" | ||
| 11 | + extern "C" { | ||
| 12 | + #include <git2.h> | ||
| 13 | + } | ||
| 12 | 14 | ||
| 13 | 15 | <% if (typeof dependencies != 'undefined') { -%> | |
| 14 | 16 | <% for (d in dependencies) { -%> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments