@@ -157,19 +157,24 @@ write_file(
157157 "//conditions:default": [],
158158 }) + select({
159159 ":https_apple": [
160+ "#define GIT_SHA256_COMMON_CRYPTO 1",
160161 "#define GIT_HTTPS 1",
161162 "#define GIT_SECURE_TRANSPORT 1",
162163 ],
163164 ":https_setting": [
165+ "#define GIT_SHA256_OPENSSL 1",
164166 "#define GIT_HTTPS 1",
165167 "#define GIT_OPENSSL 1",
166168 ],
167169 # target.contains("windows")
168170 ":https_windows": [
171+ "#define GIT_SHA256_WIN32 1",
169172 "#define GIT_HTTPS 1",
170173 "#define GIT_WINHTTP 1",
171174 ],
172- "//conditions:default": [],
175+ "//conditions:default": [
176+ "#define GIT_SHA256_BUILTIN 1",
177+ ],
173178 }) + select({
174179 ":apple": ["#define GIT_USE_ICONV 1"],
175180 "//conditions:default": [],
@@ -187,52 +192,59 @@ cc_library(
187192cc_library(
188193 name = "git2",
189194 srcs = [
190- "src/allocators/failalloc.c",
191- "src/allocators/stdalloc.c",
192- "src/allocators/win32_leakcheck.c",
195+ "src/util/ allocators/failalloc.c",
196+ "src/util/ allocators/stdalloc.c",
197+ "src/util/ allocators/win32_leakcheck.c",
193198 # Use the CollisionDetection SHA1 implementation.
194- "src/hash/sha1 /collisiondetect.c",
195- "src/hash/sha1 /sha1dc/sha1.c",
196- "src/hash/sha1 /sha1dc/ubc_check.c",
199+ "src/util/hash /collisiondetect.c",
200+ "src/util/hash /sha1dc/sha1.c",
201+ "src/util/hash /sha1dc/ubc_check.c",
197202 ] + glob(
198203 include = [
199- "src/*.c",
200- "src/xdiff /*.c",
201- "src/transports /*.c",
202- "src/streams /*.c",
203- "src/hash /*.c",
204+ "src/libgit2/ *.c",
205+ "src/util /*.c",
206+ "src/libgit2/xdiff /*.c",
207+ "src/libgit2/transports /*.c",
208+ "src/libgit2/streams /*.c",
204209 ],
205210 exclude = [
206- "src/win32/**",
207- "src/unix/**",
211+ "src/util/ win32/**",
212+ "src/util/ unix/**",
208213 ],
209214 ) + select({
210- "@platforms//os:windows": glob(["src/win32/**/*.c"]),
211- "//conditions:default": glob(["src/unix/**/*.c"]),
215+ "@platforms//os:windows": glob(["src/util/win32/**/*.c"]),
216+ "//conditions:default": glob(["src/util/unix/**/*.c"]),
217+ }) + select({
218+ ":https_setting": [],
219+ "//conditions:default": [
220+ "src/util/hash/builtin.c",
221+ "src/util/hash/rfc6234/sha224-256.c",
222+ ],
212223 }),
213224 hdrs = [
214- "src/allocators/failalloc.h",
215- "src/allocators/stdalloc.h",
216- "src/allocators/win32_leakcheck.h",
225+ "src/util/ allocators/failalloc.h",
226+ "src/util/ allocators/stdalloc.h",
227+ "src/util/ allocators/win32_leakcheck.h",
217228 # Use the CollisionDetection SHA1 implementation.
218- "src/hash/sha1/collisiondetect.h",
219- "src/hash/sha1/sha1dc/sha1.h",
220- "src/hash/sha1/sha1dc/ubc_check.h",
229+ "src/util/hash/sha1dc/sha1.h",
230+ "src/util/hash/sha1dc/ubc_check.h",
221231 ] + glob(
222232 include = [
223- "src/*.h",
224- "src/xdiff/*.h",
225- "src/transports/*.h",
226- "src/streams/*.h",
227- "src/hash/*.h",
233+ "src/libgit2/*.h",
234+ "src/libgit2/streams/*.h",
235+ "src/libgit2/transports/*.h",
236+ "src/libgit2/xdiff/*.h",
237+ "src/util/*.h",
238+ "src/util/hash/*.h",
239+ "src/util/hash/rfc6234/*.h",
228240 ],
229241 exclude = [
230- "src/win32/**",
231- "src/unix/**",
242+ "src/util/ win32/**",
243+ "src/util/ unix/**",
232244 ],
233245 ) + select({
234- "@platforms//os:windows": glob(["src/win32/**/*.h"]),
235- "//conditions:default": glob(["src/unix/**/*.h"]),
246+ "@platforms//os:windows": glob(["src/util/ win32/**/*.h"]),
247+ "//conditions:default": glob(["src/util/ unix/**/*.h"]),
236248 }),
237249 copts = select({
238250 "@platforms//os:linux": [
@@ -266,6 +278,10 @@ cc_library(
266278 ":windows": ["STRSAFE_NO_DEPRECATE"],
267279 "//conditions:default": [],
268280 }),
281+ includes = [
282+ "src/libgit2",
283+ "src/util",
284+ ],
269285 linkstatic = True,
270286 strip_include_prefix = "src",
271287 visibility = ["//visibility:public"],
0 commit comments