Skip to content

Commit ee47787

Browse files
author
Sam
committed
Merge pull request libgit2#73 from deepak1556/gyp-transit
Gyp transition for libgit2
2 parents b71f617 + a0e5308 commit ee47787

File tree

3 files changed

+326
-24
lines changed

3 files changed

+326
-24
lines changed

binding.gyp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
'targets': [
33
{
44
'target_name': 'gitteh',
5+
56
'sources': [
67
'src/gitteh.cc',
78
'src/signature.cc',
@@ -14,32 +15,27 @@
1415
'src/remote.cc',
1516
'src/index.cc',
1617
],
18+
1719
'todosources': [
1820
'src/index_entry.cc',
1921
'src/tag.cc',
2022
'src/rev_walker.cc',
2123
'src/ref.cc',
2224
],
2325

26+
'dependencies': [
27+
'<(module_root_dir)/deps/libgit2.gyp:libgit2'
28+
],
29+
2430
'include_dirs': [
2531
'deps/v8-convert',
26-
'deps/libgit2/include',
2732
"<!(node -e \"require('nan')\")"
2833
],
2934

30-
'libraries': [
31-
'-L<!(pwd)/deps/libgit2/build',
32-
'-lgit2'
33-
],
34-
3535
'cflags': [
3636
'-Wall'
3737
],
3838

39-
'ldflags': [
40-
'-Wl,-rpath,\$$ORIGIN/../../deps/libgit2/build'
41-
],
42-
4339
'conditions': [
4440
['OS=="mac"', {
4541
'xcode_settings': {

deps/libgit2.gyp

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
{
2+
'targets': [{
3+
'target_name': 'libgit2',
4+
'type': 'static_library',
5+
6+
'defines': [
7+
'GIT_THREADS',
8+
'SRC_UTIL_H_'
9+
],
10+
11+
'dependencies': [
12+
'zlib',
13+
'http_parser'
14+
],
15+
16+
'direct_dependent_settings': {
17+
'include_dirs': [
18+
'libgit2/include'
19+
]
20+
},
21+
22+
'include_dirs': [
23+
'libgit2/include',
24+
'libgit2/src',
25+
'libgit2/deps/regex'
26+
],
27+
28+
'sources': [
29+
'libgit2/src/array.h',
30+
'libgit2/src/attr_file.c',
31+
'libgit2/src/attr_file.h',
32+
'libgit2/src/attr.c',
33+
'libgit2/src/attr.h',
34+
'libgit2/src/blob.c',
35+
'libgit2/src/blob.h',
36+
'libgit2/src/branch.c',
37+
'libgit2/src/branch.h',
38+
'libgit2/src/bswap.h',
39+
'libgit2/src/buf_text.c',
40+
'libgit2/src/buf_text.h',
41+
'libgit2/src/buffer.c',
42+
'libgit2/src/buffer.h',
43+
'libgit2/src/cache.c',
44+
'libgit2/src/cache.h',
45+
'libgit2/src/cc-compact.h',
46+
'libgit2/src/checkout.c',
47+
'libgit2/src/checkout.h',
48+
'libgit2/src/clone.c',
49+
'libgit2/src/commit_list.c',
50+
'libgit2/src/commit_list.h',
51+
'libgit2/src/commit.c',
52+
'libgit2/src/commit.h',
53+
'libgit2/src/common.h',
54+
'libgit2/src/compress.c',
55+
'libgit2/src/compress.h',
56+
'libgit2/src/config_cache.c',
57+
'libgit2/src/config_file.c',
58+
'libgit2/src/config_file.h',
59+
'libgit2/src/config.c',
60+
'libgit2/src/config.h',
61+
'libgit2/src/crlf.c',
62+
'libgit2/src/date.c',
63+
'libgit2/src/delta-apply.c',
64+
'libgit2/src/delta-apply.h',
65+
'libgit2/src/delta.c',
66+
'libgit2/src/delta.h',
67+
'libgit2/src/diff_driver.c',
68+
'libgit2/src/diff_driver.h',
69+
'libgit2/src/diff_file.c',
70+
'libgit2/src/diff_file.h',
71+
'libgit2/src/diff_patch.c',
72+
'libgit2/src/diff_patch.h',
73+
'libgit2/src/diff_print.c',
74+
'libgit2/src/diff_tform.c',
75+
'libgit2/src/diff_xdiff.c',
76+
'libgit2/src/diff_xdiff.h',
77+
'libgit2/src/diff.c',
78+
'libgit2/src/diff.h',
79+
'libgit2/src/errors.c',
80+
'libgit2/src/fetch.c',
81+
'libgit2/src/fetch.h',
82+
'libgit2/src/fetchhead.c',
83+
'libgit2/src/fetchhead.h',
84+
'libgit2/src/filebuf.c',
85+
'libgit2/src/filebuf.h',
86+
'libgit2/src/fileops.c',
87+
'libgit2/src/fileops.h',
88+
'libgit2/src/filter.c',
89+
'libgit2/src/filter.h',
90+
'libgit2/src/fnmatch.c',
91+
'libgit2/src/fnmatch.h',
92+
'libgit2/src/global.c',
93+
'libgit2/src/global.h',
94+
'libgit2/src/graph.c',
95+
'libgit2/src/hash.c',
96+
'libgit2/src/hash.h',
97+
'libgit2/src/hashsig.c',
98+
'libgit2/src/hashsig.h',
99+
'libgit2/src/ignore.c',
100+
'libgit2/src/ignore.h',
101+
'libgit2/src/index.c',
102+
'libgit2/src/index.h',
103+
'libgit2/src/indexer.c',
104+
'libgit2/src/iterator.c',
105+
'libgit2/src/iterator.h',
106+
'libgit2/src/khash.h',
107+
'libgit2/src/map.h',
108+
'libgit2/src/merge_file.c',
109+
'libgit2/src/merge_file.h',
110+
'libgit2/src/merge.c',
111+
'libgit2/src/merge.h',
112+
'libgit2/src/message.c',
113+
'libgit2/src/message.h',
114+
'libgit2/src/mwindow.c',
115+
'libgit2/src/mwindow.h',
116+
'libgit2/src/netops.c',
117+
'libgit2/src/netops.h',
118+
'libgit2/src/notes.c',
119+
'libgit2/src/notes.h',
120+
'libgit2/src/object_api.c',
121+
'libgit2/src/object.c',
122+
'libgit2/src/object.h',
123+
'libgit2/src/odb_loose.c',
124+
'libgit2/src/odb_pack.c',
125+
'libgit2/src/odb.c',
126+
'libgit2/src/odb.h',
127+
'libgit2/src/offmap.h',
128+
'libgit2/src/oid.c',
129+
'libgit2/src/oid.h',
130+
'libgit2/src/oidmap.h',
131+
'libgit2/src/pack-objects.c',
132+
'libgit2/src/pack-objects.h',
133+
'libgit2/src/pack.c',
134+
'libgit2/src/pack.h',
135+
'libgit2/src/path.c',
136+
'libgit2/src/path.h',
137+
'libgit2/src/pathspec.c',
138+
'libgit2/src/pathspec.h',
139+
'libgit2/src/pool.c',
140+
'libgit2/src/pool.h',
141+
'libgit2/src/posix.c',
142+
'libgit2/src/posix.h',
143+
'libgit2/src/pqueue.c',
144+
'libgit2/src/pqueue.h',
145+
'libgit2/src/push.c',
146+
'libgit2/src/push.h',
147+
'libgit2/src/refdb_fs.c',
148+
'libgit2/src/refdb_fs.h',
149+
'libgit2/src/refdb.c',
150+
'libgit2/src/refdb.h',
151+
'libgit2/src/reflog.c',
152+
'libgit2/src/reflog.h',
153+
'libgit2/src/refs.c',
154+
'libgit2/src/refs.h',
155+
'libgit2/src/refspec.c',
156+
'libgit2/src/refspec.h',
157+
'libgit2/src/remote.c',
158+
'libgit2/src/remote.h',
159+
'libgit2/src/repo_template.h',
160+
'libgit2/src/repository.c',
161+
'libgit2/src/repository.h',
162+
'libgit2/src/reset.c',
163+
'libgit2/src/revparse.c',
164+
'libgit2/src/revwalk.c',
165+
'libgit2/src/revwalk.h',
166+
'libgit2/src/sha1_lookup.c',
167+
'libgit2/src/sha1_lookup.h',
168+
'libgit2/src/signature.c',
169+
'libgit2/src/signature.h',
170+
'libgit2/src/stash.c',
171+
'libgit2/src/status.c',
172+
'libgit2/src/status.h',
173+
'libgit2/src/strmap.h',
174+
'libgit2/src/submodule.c',
175+
'libgit2/src/submodule.h',
176+
'libgit2/src/tag.c',
177+
'libgit2/src/tag.h',
178+
'libgit2/src/thread-utils.c',
179+
'libgit2/src/thread-utils.h',
180+
'libgit2/src/trace.c',
181+
'libgit2/src/trace.h',
182+
'libgit2/src/transport.c',
183+
'libgit2/src/tree-cache.c',
184+
'libgit2/src/tree-cache.h',
185+
'libgit2/src/tree.c',
186+
'libgit2/src/tree.h',
187+
'libgit2/src/tsort.c',
188+
'libgit2/src/util.c',
189+
'libgit2/src/util.h',
190+
'libgit2/src/vector.c',
191+
'libgit2/src/vector.h',
192+
'libgit2/src/hash/hash_generic.c',
193+
'libgit2/src/hash/hash_generic.h',
194+
'libgit2/src/hash/openssl.h',
195+
'libgit2/src/transports/cred_helpers.c',
196+
'libgit2/src/transports/cred.c',
197+
'libgit2/src/transports/git.c',
198+
'libgit2/src/transports/http.c',
199+
'libgit2/src/transports/local.c',
200+
'libgit2/src/transports/smart_pkt.c',
201+
'libgit2/src/transports/smart_protocol.c',
202+
'libgit2/src/transports/smart.c',
203+
'libgit2/src/transports/smart.h',
204+
'libgit2/src/transports/ssh.c',
205+
'libgit2/src/transports/winhttp.c',
206+
'libgit2/src/xdiff/xdiff.h',
207+
'libgit2/src/xdiff/xdiffi.c',
208+
'libgit2/src/xdiff/xdiffi.h',
209+
'libgit2/src/xdiff/xemit.c',
210+
'libgit2/src/xdiff/xemit.h',
211+
'libgit2/src/xdiff/xhistogram.c',
212+
'libgit2/src/xdiff/xinclude.h',
213+
'libgit2/src/xdiff/xmacros.h',
214+
'libgit2/src/xdiff/xmerge.c',
215+
'libgit2/src/xdiff/xpatience.c',
216+
'libgit2/src/xdiff/xprepare.c',
217+
'libgit2/src/xdiff/xprepare.h',
218+
'libgit2/src/xdiff/xtypes.h',
219+
'libgit2/src/xdiff/xutils.c',
220+
'libgit2/src/xdiff/xutils.h'
221+
],
222+
223+
'conditions': [
224+
["OS=='linux'", {
225+
'cflags': [
226+
'-w'
227+
]
228+
}],
229+
230+
["OS!='win'", {
231+
'libraries': [
232+
'-lpthread'
233+
],
234+
235+
'sources': [
236+
'libgit2/src/unix/map.c',
237+
'libgit2/src/unix/posix.h',
238+
'libgit2/src/unix/realpath.c'
239+
],
240+
241+
'cflags': [
242+
'-Wno-missing-field-initializers',
243+
'-Wno-unused-variable'
244+
],
245+
246+
'xcode_settings': {
247+
'WARNING_CFLAGS': [
248+
'-Wno-missing-field-initializers',
249+
'-Wno-unused-variable'
250+
]
251+
}
252+
}]
253+
]
254+
}, {
255+
'target_name': 'zlib',
256+
'type': 'static_library',
257+
258+
'defines': [
259+
'NO_VIZ',
260+
'STDC',
261+
'NO_GZIP'
262+
],
263+
264+
'include_dirs': [
265+
'libgit2/include/',
266+
'libgit2/deps/regex/'
267+
],
268+
269+
'direct_dependent_settings': {
270+
'include_dirs': [
271+
'libgit2/deps/zlib'
272+
]
273+
},
274+
275+
'sources': [
276+
'libgit2/deps/zlib/adler32.c',
277+
'libgit2/deps/zlib/crc32.c',
278+
'libgit2/deps/zlib/crc32.h',
279+
'libgit2/deps/zlib/deflate.c',
280+
'libgit2/deps/zlib/deflate.h',
281+
'libgit2/deps/zlib/inffast.c',
282+
'libgit2/deps/zlib/inffast.h',
283+
'libgit2/deps/zlib/inffixed.h',
284+
'libgit2/deps/zlib/inflate.c',
285+
'libgit2/deps/zlib/inflate.h',
286+
'libgit2/deps/zlib/inftrees.c',
287+
'libgit2/deps/zlib/inftrees.h',
288+
'libgit2/deps/zlib/trees.c',
289+
'libgit2/deps/zlib/tree.h',
290+
'libgit2/deps/zlib/zconf.h',
291+
'libgit2/deps/zlib/zlib.h',
292+
'libgit2/deps/zlib/zutil.c',
293+
'libgit2/deps/zlib/zutil.h'
294+
]
295+
}, {
296+
'target_name': 'http_parser',
297+
'type': 'static_library',
298+
299+
'direct_dependent_settings': {
300+
'include_dirs': [
301+
'libgit2/deps/http-parser'
302+
]
303+
},
304+
305+
'sources': [
306+
'libgit2/deps/http-parser/http_parser.c',
307+
'libgit2/deps/http-parser/http_parser.h'
308+
],
309+
310+
'conditions': [
311+
["OS=='win'", {
312+
'msvs_disabled_warnings': [
313+
4244 # conversion from 'ssize_t' to 'int32_t' , possible loss of data
314+
]
315+
}]
316+
]
317+
}]
318+
}

install.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ function passthru() {
2424
}
2525

2626
var libgit2Dir = path.join(__dirname, "deps/libgit2");
27-
var buildDir = path.join(libgit2Dir, "build");
2827

2928
async.series([
3029
function(cb) {
3130
console.log("[gitteh] Downloading libgit2 dependency.");
31+
3232
if (fs.existsSync(path.join(__dirname, '.git'))) {
3333
console.log("[gitteh] ...via git submodule");
3434
passthru("git submodule update --init", cb);
@@ -38,19 +38,7 @@ async.series([
3838
var url = "https://github.com/libgit2/libgit2/tarball/" + libgit2Version;
3939
request.get(url).pipe(zlib.createUnzip()).pipe(tar.Extract({path: libgit2Dir})).on('end', cb);
4040
}
41-
},
42-
function(cb) {
43-
console.log("[gitteh] Building libgit2 dependency.");
44-
passthru("mkdir -p " + buildDir, cb);
45-
},
46-
function(cb) {
47-
pushd(buildDir);
48-
passthru("cmake -DCMAKE_C_FLAGS='-fPIC' -DTHREADSAFE=1 -DBUILD_CLAR=0 ..", cb);
49-
},
50-
function(cb) {
51-
console.log("[gitteh] Build Successful.");
52-
passthru("cmake --build .", cb);
53-
popd();
41+
5442
}
5543
], function(err) {
5644
if(err) process.exit(err);

0 commit comments

Comments
 (0)