Skip to content

Commit cd9ac8e

Browse files
committed
Adds libgit2 1.9.1
1 parent 1601689 commit cd9ac8e

File tree

12 files changed

+260
-1
lines changed

12 files changed

+260
-1
lines changed

modules/libgit2/1.9.1/MODULE.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module(
2+
name = "libgit2",
3+
version = "1.9.1",
4+
bazel_compatibility = [">=7.2.1"],
5+
compatibility_level = 1,
6+
)
7+
8+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
9+
bazel_dep(name = "platforms", version = "0.0.11")
10+
bazel_dep(name = "rules_cc", version = "0.1.1")
11+
bazel_dep(name = "zlib", version = "1.3")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
alias(
2+
name = "libgit2",
3+
actual = "//src/libgit2:git2",
4+
visibility = ["//visibility:public"],
5+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module(
2+
name = "libgit2",
3+
version = "1.9.1",
4+
bazel_compatibility = [">=7.2.1"],
5+
compatibility_level = 1,
6+
)
7+
8+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
9+
bazel_dep(name = "platforms", version = "0.0.11")
10+
bazel_dep(name = "rules_cc", version = "0.1.1")
11+
bazel_dep(name = "zlib", version = "1.3")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "llhttp",
5+
srcs = glob(["*.c"]),
6+
hdrs = ["llhttp.h"],
7+
strip_include_prefix = "/deps/llhttp",
8+
visibility = ["//:__subpackages__"],
9+
)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
2+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3+
4+
_CONFIG_H = """
5+
#define HAVE_MEMMOVE
6+
7+
#define NEWLINE 10
8+
#define POSIX_MALLOC_THRESHOLD 10
9+
#define LINK_SIZE 2
10+
#define PARENS_NEST_LIMIT 250
11+
#define MATCH_LIMIT 10000000
12+
#define MATCH_LIMIT_RECURSION MATCH_LIMIT
13+
14+
#define MAX_NAME_SIZE 32
15+
#define MAX_NAME_COUNT 10000
16+
"""
17+
18+
write_file(
19+
name = "pcre_config_h",
20+
out = "config.h",
21+
content = [_CONFIG_H],
22+
newline = "unix",
23+
)
24+
25+
cc_library(
26+
name = "pcre_config",
27+
hdrs = [":pcre_config_h"],
28+
strip_include_prefix = "/deps/pcre",
29+
)
30+
31+
cc_library(
32+
name = "pcre_hdrs",
33+
hdrs = ["pcre.h"],
34+
strip_include_prefix = "/deps/pcre",
35+
visibility = ["//:__subpackages__"],
36+
)
37+
38+
cc_library(
39+
name = "pcre",
40+
srcs = glob(["*.c"]) + [
41+
"pcre_internal.h",
42+
"pcreposix.h",
43+
"ucp.h",
44+
],
45+
implementation_deps = [":pcre_config"],
46+
local_defines = ["HAVE_CONFIG_H"],
47+
visibility = ["//:__subpackages__"],
48+
deps = [":pcre_hdrs"],
49+
)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "xdiff_hdrs",
5+
hdrs = glob(["*.h"]),
6+
strip_include_prefix = "/deps/xdiff",
7+
visibility = ["//:__subpackages__"],
8+
deps = ["//src/util:util_hdrs"],
9+
)
10+
11+
cc_library(
12+
name = "xdiff",
13+
srcs = glob(["*.c"]),
14+
visibility = ["//:__subpackages__"],
15+
deps = [":xdiff_hdrs"],
16+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "git2",
5+
hdrs = [
6+
"git2.h",
7+
] + glob([
8+
"git2/**/*.h",
9+
]),
10+
strip_include_prefix = "/include",
11+
visibility = ["//:__subpackages__"],
12+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "libgit2_hdrs",
5+
hdrs = glob(["**/*.h"]),
6+
strip_include_prefix = "/src/libgit2",
7+
deps = [
8+
"//deps/xdiff:xdiff_hdrs",
9+
"//include:git2",
10+
"//src/util:util_hdrs",
11+
],
12+
)
13+
14+
cc_library(
15+
name = "git2",
16+
srcs = glob([
17+
"**/*.c",
18+
"**/*.h",
19+
]),
20+
implementation_deps = [
21+
":libgit2_hdrs",
22+
"//deps/llhttp",
23+
"//deps/xdiff",
24+
"//src/util",
25+
],
26+
conlyopts = select({
27+
"@platforms//os:windows": [],
28+
"//conditions:default": [
29+
"-Wno-error",
30+
],
31+
}),
32+
visibility = ["//:__subpackages__"],
33+
deps = ["//include:git2"],
34+
)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
2+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3+
4+
_GIT2_FEATURES_H = """
5+
#define GIT_REGEX_BUILTIN
6+
#define GIT_SHA1_COLLISIONDETECT
7+
#define GIT_SHA256_BUILTIN
8+
#define GIT_HTTPPARSER_BUILTIN
9+
#define GIT_THREADS
10+
"""
11+
12+
write_file(
13+
name = "git2_features_h",
14+
out = "git2_features.h",
15+
content = [_GIT2_FEATURES_H] +
16+
select({
17+
"@platforms//os:windows": ["#define GIT_IO_WSAPOLL 1"],
18+
"//conditions:default": ["#define GIT_IO_POLL"],
19+
}),
20+
newline = "unix",
21+
)
22+
23+
cc_library(
24+
name = "git2_features",
25+
hdrs = [":git2_features_h"],
26+
strip_include_prefix = "/src/util",
27+
)
28+
29+
cc_library(
30+
name = "util_hdrs",
31+
hdrs = glob(["**/*.h"]),
32+
strip_include_prefix = "/src/util",
33+
visibility = ["//:__subpackages__"],
34+
deps = [
35+
":git2_features",
36+
"//deps/pcre:pcre_hdrs",
37+
"//include:git2",
38+
"@zlib",
39+
],
40+
)
41+
42+
GIT2_UTIL_WINDOWS_SRCS = glob([
43+
"win32/*",
44+
]) + ["hash/win32.c"]
45+
46+
GIT2_UTIL_UNIX_SRCS = glob(["unix/*"])
47+
48+
GIT2_UTIL_SRCS = glob(
49+
include = ["**/*.c"],
50+
exclude = [
51+
"hash/common_crypto.c",
52+
"hash/openssl.c",
53+
] + GIT2_UTIL_WINDOWS_SRCS + GIT2_UTIL_UNIX_SRCS,
54+
)
55+
56+
cc_library(
57+
name = "util",
58+
srcs = GIT2_UTIL_SRCS + select({
59+
"@platforms//os:windows": GIT2_UTIL_WINDOWS_SRCS,
60+
"//conditions:default": GIT2_UTIL_UNIX_SRCS,
61+
}),
62+
implementation_deps = [
63+
"//deps/pcre",
64+
"//deps/xdiff",
65+
],
66+
linkopts = select({
67+
"@platforms//os:windows": [
68+
"secur32.lib",
69+
"ws2_32.lib",
70+
"advapi32.lib",
71+
],
72+
"//conditions:default": [],
73+
}),
74+
visibility = ["//:__subpackages__"],
75+
deps = [":util_hdrs"],
76+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
matrix:
2+
platform:
3+
- debian10
4+
- debian11
5+
- ubuntu2004
6+
- ubuntu2204
7+
- macos
8+
- macos_arm64
9+
- windows
10+
bazel:
11+
- 7.x
12+
- 8.x
13+
tasks:
14+
verify_targets:
15+
name: Verify build targets
16+
platform: ${{ platform }}
17+
bazel: ${{ bazel }}
18+
build_targets:
19+
- '@libgit2//...'

0 commit comments

Comments
 (0)