ok/jj
1
0
Fork 0
forked from mirrors/jj

buck: build libgit2

Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
Austin Seipp 2024-06-25 20:29:11 -05:00
parent 3088b3781d
commit d563775c1e
3 changed files with 542 additions and 0 deletions

523
buck/third-party/libgit2/BUILD vendored Normal file
View file

@ -0,0 +1,523 @@
load("@root//buck/shims/jj.bzl", "jj")
VERSION = '1.8.1'
http_archive(
name = 'src',
sha256 = '8c1eaf0cf07cba0e9021920bfba9502140220786ed5d8a8ec6c7ad9174522f8e',
urls = [
f'https://github.com/libgit2/libgit2/archive/refs/tags/v{VERSION}.tar.gz',
],
type = 'tar.gz',
strip_prefix = f'libgit2-{VERSION}',
sub_targets = [
"deps/llhttp/api.c",
"deps/llhttp/http.c",
"deps/llhttp/llhttp.c",
"deps/llhttp/llhttp.h",
"deps/pcre/pcre_byte_order.c",
"deps/pcre/pcre_chartables.c",
"deps/pcre/pcre_compile.c",
"deps/pcre/pcre_config.c",
"deps/pcre/pcre_dfa_exec.c",
"deps/pcre/pcre_exec.c",
"deps/pcre/pcre_fullinfo.c",
"deps/pcre/pcre_get.c",
"deps/pcre/pcre_globals.c",
"deps/pcre/pcre_jit_compile.c",
"deps/pcre/pcre_maketables.c",
"deps/pcre/pcre_newline.c",
"deps/pcre/pcre_ord2utf8.c",
"deps/pcre/pcre_printint.c",
"deps/pcre/pcre_refcount.c",
"deps/pcre/pcre_string_utils.c",
"deps/pcre/pcre_study.c",
"deps/pcre/pcre_tables.c",
"deps/pcre/pcre_ucd.c",
"deps/pcre/pcre_valid_utf8.c",
"deps/pcre/pcre_version.c",
"deps/pcre/pcre_xclass.c",
"deps/pcre/pcreposix.c",
"deps/xdiff/xdiffi.c",
"deps/xdiff/xemit.c",
"deps/xdiff/xhistogram.c",
"deps/xdiff/xmerge.c",
"deps/xdiff/xpatience.c",
"deps/xdiff/xprepare.c",
"deps/xdiff/xutils.c",
"src/libgit2/annotated_commit.c",
"src/libgit2/apply.c",
"src/libgit2/attr.c",
"src/libgit2/attr_file.c",
"src/libgit2/attrcache.c",
"src/libgit2/blame.c",
"src/libgit2/blame_git.c",
"src/libgit2/blob.c",
"src/libgit2/branch.c",
"src/libgit2/buf.c",
"src/libgit2/cache.c",
"src/libgit2/checkout.c",
"src/libgit2/cherrypick.c",
"src/libgit2/clone.c",
"src/libgit2/commit.c",
"src/libgit2/commit_graph.c",
"src/libgit2/commit_list.c",
"src/libgit2/config.c",
"src/libgit2/config_cache.c",
"src/libgit2/config_list.c",
"src/libgit2/config_file.c",
"src/libgit2/config_mem.c",
"src/libgit2/config_parse.c",
"src/libgit2/config_snapshot.c",
"src/libgit2/crlf.c",
"src/libgit2/delta.c",
"src/libgit2/describe.c",
"src/libgit2/diff.c",
"src/libgit2/diff_driver.c",
"src/libgit2/diff_file.c",
"src/libgit2/diff_generate.c",
"src/libgit2/diff_parse.c",
"src/libgit2/diff_print.c",
"src/libgit2/diff_stats.c",
"src/libgit2/diff_tform.c",
"src/libgit2/diff_xdiff.c",
"src/libgit2/email.c",
"src/libgit2/fetch.c",
"src/libgit2/fetchhead.c",
"src/libgit2/filter.c",
"src/libgit2/grafts.c",
"src/libgit2/graph.c",
"src/libgit2/hashsig.c",
"src/libgit2/ident.c",
"src/libgit2/idxmap.c",
"src/libgit2/ignore.c",
"src/libgit2/index.c",
"src/libgit2/indexer.c",
"src/libgit2/iterator.c",
"src/libgit2/libgit2.c",
"src/libgit2/mailmap.c",
"src/libgit2/merge.c",
"src/libgit2/merge_driver.c",
"src/libgit2/merge_file.c",
"src/libgit2/message.c",
"src/libgit2/midx.c",
"src/libgit2/mwindow.c",
"src/libgit2/notes.c",
"src/libgit2/object.c",
"src/libgit2/object_api.c",
"src/libgit2/odb.c",
"src/libgit2/odb_loose.c",
"src/libgit2/odb_mempack.c",
"src/libgit2/odb_pack.c",
"src/libgit2/offmap.c",
"src/libgit2/oid.c",
"src/libgit2/oidarray.c",
"src/libgit2/oidmap.c",
"src/libgit2/pack.c",
"src/libgit2/pack-objects.c",
"src/libgit2/parse.c",
"src/libgit2/patch.c",
"src/libgit2/patch_generate.c",
"src/libgit2/patch_parse.c",
"src/libgit2/path.c",
"src/libgit2/pathspec.c",
"src/libgit2/proxy.c",
"src/libgit2/push.c",
"src/libgit2/reader.c",
"src/libgit2/rebase.c",
"src/libgit2/refdb.c",
"src/libgit2/refdb_fs.c",
"src/libgit2/reflog.c",
"src/libgit2/refs.c",
"src/libgit2/refspec.c",
"src/libgit2/remote.c",
"src/libgit2/repository.c",
"src/libgit2/reset.c",
"src/libgit2/revert.c",
"src/libgit2/revparse.c",
"src/libgit2/revwalk.c",
"src/libgit2/settings.c",
"src/libgit2/signature.c",
"src/libgit2/stash.c",
"src/libgit2/status.c",
"src/libgit2/strarray.c",
"src/libgit2/streams/mbedtls.c",
"src/libgit2/streams/openssl.c",
"src/libgit2/streams/openssl_dynamic.c",
"src/libgit2/streams/openssl_legacy.c",
"src/libgit2/streams/registry.c",
"src/libgit2/streams/schannel.c",
"src/libgit2/streams/socket.c",
"src/libgit2/streams/stransport.c",
"src/libgit2/streams/tls.c",
"src/libgit2/submodule.c",
"src/libgit2/sysdir.c",
"src/libgit2/tag.c",
"src/libgit2/trace.c",
"src/libgit2/trailer.c",
"src/libgit2/transaction.c",
"src/libgit2/transport.c",
"src/libgit2/transports/auth.c",
"src/libgit2/transports/auth_gssapi.c",
"src/libgit2/transports/auth_ntlmclient.c",
"src/libgit2/transports/auth_sspi.c",
"src/libgit2/transports/credential.c",
"src/libgit2/transports/credential_helpers.c",
"src/libgit2/transports/git.c",
"src/libgit2/transports/http.c",
"src/libgit2/transports/httpclient.c",
"src/libgit2/transports/httpparser.c",
"src/libgit2/transports/local.c",
"src/libgit2/transports/smart.c",
"src/libgit2/transports/smart_pkt.c",
"src/libgit2/transports/smart_protocol.c",
"src/libgit2/transports/ssh.c",
"src/libgit2/transports/ssh_libssh2.c",
"src/libgit2/transports/winhttp.c",
"src/libgit2/tree.c",
"src/libgit2/tree-cache.c",
"src/libgit2/worktree.c",
"src/util/alloc.c",
"src/util/allocators/failalloc.c",
"src/util/allocators/stdalloc.c",
"src/util/date.c",
"src/util/errors.c",
"src/util/filebuf.c",
"src/util/fs_path.c",
"src/util/futils.c",
"src/util/hash.c",
"src/util/hash/collisiondetect.c",
"src/util/hash/openssl.c",
"src/util/hash/sha1dc/sha1.c",
"src/util/hash/sha1dc/ubc_check.c",
"src/util/net.c",
"src/util/pool.c",
"src/util/posix.c",
"src/util/pqueue.c",
"src/util/rand.c",
"src/util/regexp.c",
"src/util/runtime.c",
"src/util/sortedcache.c",
"src/util/str.c",
"src/util/strmap.c",
"src/util/thread.c",
"src/util/tsort.c",
"src/util/unix/map.c",
"src/util/unix/realpath.c",
"src/util/win32/dir.c",
"src/util/win32/dir.h",
"src/util/win32/error.c",
"src/util/win32/error.h",
"src/util/win32/map.c",
"src/util/win32/mingw-compat.h",
"src/util/win32/msvc-compat.h",
"src/util/win32/path_w32.c",
"src/util/win32/path_w32.h",
"src/util/win32/posix.h",
"src/util/win32/posix_w32.c",
"src/util/win32/precompiled.c",
"src/util/win32/precompiled.h",
"src/util/win32/reparse.h",
"src/util/win32/thread.c",
"src/util/win32/thread.h",
"src/util/win32/utf-conv.c",
"src/util/win32/utf-conv.h",
"src/util/win32/version.h",
"src/util/win32/w32_buffer.c",
"src/util/win32/w32_buffer.h",
"src/util/win32/w32_common.h",
"src/util/win32/w32_leakcheck.c",
"src/util/win32/w32_leakcheck.h",
"src/util/win32/w32_util.c",
"src/util/win32/w32_util.h",
"src/util/win32/win32-compat.h",
"src/util/utf8.c",
"src/util/util.c",
"src/util/varint.c",
"src/util/vector.c",
"src/util/wildmatch.c",
"src/util/zstream.c",
],
)
jj.cxx_library(
name = "libgit2",
srcs = [
":src[deps/llhttp/api.c]",
":src[deps/llhttp/http.c]",
":src[deps/llhttp/llhttp.c]",
":src[deps/pcre/pcre_byte_order.c]",
":src[deps/pcre/pcre_chartables.c]",
":src[deps/pcre/pcre_compile.c]",
":src[deps/pcre/pcre_config.c]",
":src[deps/pcre/pcre_dfa_exec.c]",
":src[deps/pcre/pcre_exec.c]",
":src[deps/pcre/pcre_fullinfo.c]",
":src[deps/pcre/pcre_get.c]",
":src[deps/pcre/pcre_globals.c]",
":src[deps/pcre/pcre_jit_compile.c]",
":src[deps/pcre/pcre_maketables.c]",
":src[deps/pcre/pcre_newline.c]",
":src[deps/pcre/pcre_ord2utf8.c]",
":src[deps/pcre/pcre_printint.c]",
":src[deps/pcre/pcre_refcount.c]",
":src[deps/pcre/pcre_string_utils.c]",
":src[deps/pcre/pcre_study.c]",
":src[deps/pcre/pcre_tables.c]",
":src[deps/pcre/pcre_ucd.c]",
":src[deps/pcre/pcre_valid_utf8.c]",
":src[deps/pcre/pcre_version.c]",
":src[deps/pcre/pcre_xclass.c]",
":src[deps/pcre/pcreposix.c]",
":src[deps/xdiff/xdiffi.c]",
":src[deps/xdiff/xemit.c]",
":src[deps/xdiff/xhistogram.c]",
":src[deps/xdiff/xmerge.c]",
":src[deps/xdiff/xpatience.c]",
":src[deps/xdiff/xprepare.c]",
":src[deps/xdiff/xutils.c]",
":src[src/libgit2/annotated_commit.c]",
":src[src/libgit2/apply.c]",
":src[src/libgit2/attr.c]",
":src[src/libgit2/attr_file.c]",
":src[src/libgit2/attrcache.c]",
":src[src/libgit2/blame.c]",
":src[src/libgit2/blame_git.c]",
":src[src/libgit2/blob.c]",
":src[src/libgit2/branch.c]",
":src[src/libgit2/buf.c]",
":src[src/libgit2/cache.c]",
":src[src/libgit2/checkout.c]",
":src[src/libgit2/cherrypick.c]",
":src[src/libgit2/clone.c]",
":src[src/libgit2/commit.c]",
":src[src/libgit2/commit_graph.c]",
":src[src/libgit2/commit_list.c]",
":src[src/libgit2/config.c]",
":src[src/libgit2/config_cache.c]",
":src[src/libgit2/config_list.c]",
":src[src/libgit2/config_file.c]",
":src[src/libgit2/config_mem.c]",
":src[src/libgit2/config_parse.c]",
":src[src/libgit2/config_snapshot.c]",
":src[src/libgit2/crlf.c]",
":src[src/libgit2/delta.c]",
":src[src/libgit2/describe.c]",
":src[src/libgit2/diff.c]",
":src[src/libgit2/diff_driver.c]",
":src[src/libgit2/diff_file.c]",
":src[src/libgit2/diff_generate.c]",
":src[src/libgit2/diff_parse.c]",
":src[src/libgit2/diff_print.c]",
":src[src/libgit2/diff_stats.c]",
":src[src/libgit2/diff_tform.c]",
":src[src/libgit2/diff_xdiff.c]",
":src[src/libgit2/email.c]",
":src[src/libgit2/fetch.c]",
":src[src/libgit2/fetchhead.c]",
":src[src/libgit2/filter.c]",
":src[src/libgit2/grafts.c]",
":src[src/libgit2/graph.c]",
":src[src/libgit2/hashsig.c]",
":src[src/libgit2/ident.c]",
":src[src/libgit2/idxmap.c]",
":src[src/libgit2/ignore.c]",
":src[src/libgit2/index.c]",
":src[src/libgit2/indexer.c]",
":src[src/libgit2/iterator.c]",
":src[src/libgit2/libgit2.c]",
":src[src/libgit2/mailmap.c]",
":src[src/libgit2/merge.c]",
":src[src/libgit2/merge_driver.c]",
":src[src/libgit2/merge_file.c]",
":src[src/libgit2/message.c]",
":src[src/libgit2/midx.c]",
":src[src/libgit2/mwindow.c]",
":src[src/libgit2/notes.c]",
":src[src/libgit2/object.c]",
":src[src/libgit2/object_api.c]",
":src[src/libgit2/odb.c]",
":src[src/libgit2/odb_loose.c]",
":src[src/libgit2/odb_mempack.c]",
":src[src/libgit2/odb_pack.c]",
":src[src/libgit2/offmap.c]",
":src[src/libgit2/oid.c]",
":src[src/libgit2/oidarray.c]",
":src[src/libgit2/oidmap.c]",
":src[src/libgit2/pack.c]",
":src[src/libgit2/pack-objects.c]",
":src[src/libgit2/parse.c]",
":src[src/libgit2/patch.c]",
":src[src/libgit2/patch_generate.c]",
":src[src/libgit2/patch_parse.c]",
":src[src/libgit2/path.c]",
":src[src/libgit2/pathspec.c]",
":src[src/libgit2/proxy.c]",
":src[src/libgit2/push.c]",
":src[src/libgit2/reader.c]",
":src[src/libgit2/rebase.c]",
":src[src/libgit2/refdb.c]",
":src[src/libgit2/refdb_fs.c]",
":src[src/libgit2/reflog.c]",
":src[src/libgit2/refs.c]",
":src[src/libgit2/refspec.c]",
":src[src/libgit2/remote.c]",
":src[src/libgit2/repository.c]",
":src[src/libgit2/reset.c]",
":src[src/libgit2/revert.c]",
":src[src/libgit2/revparse.c]",
":src[src/libgit2/revwalk.c]",
":src[src/libgit2/settings.c]",
":src[src/libgit2/signature.c]",
":src[src/libgit2/stash.c]",
":src[src/libgit2/status.c]",
":src[src/libgit2/strarray.c]",
":src[src/libgit2/streams/mbedtls.c]",
":src[src/libgit2/streams/openssl.c]",
":src[src/libgit2/streams/openssl_dynamic.c]",
":src[src/libgit2/streams/openssl_legacy.c]",
":src[src/libgit2/streams/registry.c]",
":src[src/libgit2/streams/schannel.c]",
":src[src/libgit2/streams/socket.c]",
":src[src/libgit2/streams/stransport.c]",
":src[src/libgit2/streams/tls.c]",
":src[src/libgit2/submodule.c]",
":src[src/libgit2/sysdir.c]",
":src[src/libgit2/tag.c]",
":src[src/libgit2/trace.c]",
":src[src/libgit2/trailer.c]",
":src[src/libgit2/transaction.c]",
":src[src/libgit2/transport.c]",
":src[src/libgit2/transports/auth.c]",
":src[src/libgit2/transports/auth_gssapi.c]",
":src[src/libgit2/transports/auth_ntlmclient.c]",
":src[src/libgit2/transports/auth_sspi.c]",
":src[src/libgit2/transports/credential.c]",
":src[src/libgit2/transports/credential_helpers.c]",
":src[src/libgit2/transports/git.c]",
":src[src/libgit2/transports/http.c]",
":src[src/libgit2/transports/httpclient.c]",
":src[src/libgit2/transports/httpparser.c]",
":src[src/libgit2/transports/local.c]",
":src[src/libgit2/transports/smart.c]",
":src[src/libgit2/transports/smart_pkt.c]",
":src[src/libgit2/transports/smart_protocol.c]",
":src[src/libgit2/transports/ssh.c]",
":src[src/libgit2/transports/ssh_libssh2.c]",
":src[src/libgit2/transports/winhttp.c]",
":src[src/libgit2/tree.c]",
":src[src/libgit2/tree-cache.c]",
":src[src/libgit2/worktree.c]",
":src[src/util/alloc.c]",
":src[src/util/allocators/failalloc.c]",
":src[src/util/allocators/stdalloc.c]",
":src[src/util/date.c]",
":src[src/util/errors.c]",
":src[src/util/filebuf.c]",
":src[src/util/fs_path.c]",
":src[src/util/futils.c]",
":src[src/util/hash.c]",
":src[src/util/hash/collisiondetect.c]",
":src[src/util/hash/openssl.c]",
":src[src/util/hash/sha1dc/sha1.c]",
":src[src/util/hash/sha1dc/ubc_check.c]",
":src[src/util/net.c]",
":src[src/util/pool.c]",
":src[src/util/posix.c]",
":src[src/util/pqueue.c]",
":src[src/util/rand.c]",
":src[src/util/regexp.c]",
":src[src/util/runtime.c]",
":src[src/util/sortedcache.c]",
":src[src/util/str.c]",
":src[src/util/strmap.c]",
":src[src/util/thread.c]",
":src[src/util/tsort.c]",
":src[src/util/utf8.c]",
":src[src/util/util.c]",
":src[src/util/varint.c]",
":src[src/util/vector.c]",
":src[src/util/wildmatch.c]",
":src[src/util/zstream.c]",
] + select({
'config//os:windows': [
":src[src/util/win32/dir.c]",
":src[src/util/win32/error.c]",
":src[src/util/win32/map.c]",
":src[src/util/win32/path_w32.c]",
":src[src/util/win32/posix_w32.c]",
":src[src/util/win32/precompiled.c]",
":src[src/util/win32/thread.c]",
":src[src/util/win32/utf-conv.c]",
":src[src/util/win32/w32_buffer.c]",
":src[src/util/win32/w32_leakcheck.c]",
":src[src/util/win32/w32_util.c]",
],
'DEFAULT': [
":src[src/util/unix/map.c]",
":src[src/util/unix/realpath.c]",
],
}),
headers = ["include/git2_features.h"],
include_directories = ["include"],
compiler_flags = select({
'config//os:windows': [],
'DEFAULT': ["-fvisibility=hidden"],
}),
preferred_linkage = "static",
preprocessor_flags = [
"-I$(location :src)/include",
"-I$(location :src)/src/libgit2",
"-I$(location :src)/src/util",
"-I$(location :src)/deps/llhttp",
"-I$(location :src)/deps/xdiff",
"-I$(location :src)/deps/pcre",
"-DGIT_OPENSSL=1",
"-DGIT_SHA256_OPENSSL=1",
"-DGIT_SHA1_COLLISIONDETECT=1",
"-DGIT_HTTPS=1",
"-DGIT_REGEX_BUILTIN=1",
"-DHAVE_STDINT_H=1",
"-DHAVE_MEMMOVE=1",
"-DNO_RECURSE=1",
"-DNEWLINE=10",
"-DPOSIX_MALLOC_THRESHOLD=10",
"-DLINK_SIZE=2",
"-DPARENS_NEST_LIMIT=250",
"-DMATCH_LIMIT=10000000",
"-DMATCH_LIMIT_RECURSION=MATCH_LIMIT",
"-DMAX_NAME_SIZE=32",
"-DMAX_NAME_COUNT=10000",
"-DSHA1DC_NO_STANDARD_INCLUDES=1",
"-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\"",
"-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\"",
] + select({
'config//os:windows': [
"-DSTRSAFE_NO_DEPRECATE",
"-DWIN32",
"-DWIN32_LEAN_AND_MEAN",
"-DNOMINMAX",
"-DGIT_IO_WSAPOLL=1",
"-DGIT_WINHTTP=1",
"-DGIT_USE_STAT_MTIM=1",
],
'config//os:macos': [
"-DGIT_IO_POLL=1",
"-DGIT_IO_SELECT=1",
"-DGIT_SECURE_TRANSPORT=1",
"-DGIT_USE_STAT_MTIMESPEC=1",
],
'DEFAULT': [
"-DGIT_IO_POLL=1",
"-DGIT_IO_SELECT=1",
"-DGIT_USE_STAT_MTIM=1",
],
}),
deps = [
"third-party//bssl:crypto",
"third-party//bssl:ssl",
"third-party//libz:libz",
"third-party//libssh2:libssh2",
],
)

5
buck/third-party/libgit2/PACKAGE vendored Normal file
View file

@ -0,0 +1,5 @@
package(
inherit = True,
visibility = [ 'PUBLIC' ],
)

View file

@ -0,0 +1,14 @@
#ifndef INCLUDE_features_h
#define INCLUDE_features_h
#define GIT_THREADS 1
#define GIT_TRACE 1
#define GIT_HTTPPARSER_BUILTIN 1
#define GIT_ARCH_64 1 // XXX FIXME (aseipp)
#define GIT_SSH 1
#define GIT_SSH_LIBSSH2 1
#define GIT_SSH_MEMORY_CREDENTIALS 1
#endif // INCLUDE_features_h