-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlibrdkafka
More file actions
executable file
·58 lines (48 loc) · 1.71 KB
/
librdkafka
File metadata and controls
executable file
·58 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import os
import subprocess
import tempfile
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("librdkafka_rev")
parser.add_argument("prefix")
args = parser.parse_args()
# this script works best without instructions to the compiler / linker
for k in ("CPPFLAGS", "LDFLAGS", "LD_LIBRARY_PATH", "PKG_CONFIG_PATH"):
os.environ.pop(k, None)
with tempfile.TemporaryDirectory() as tmpdir:
print("cloning librdkafka...")
subprocess.check_call(
(
"git",
"clone",
"--quiet",
"https://github.com/edenhill/librdkafka",
tmpdir,
)
)
subprocess.check_call(
("git", "-C", tmpdir, "checkout", "--quiet", args.librdkafka_rev)
)
# https://github.com/confluentinc/confluent-kafka-python/blob/cdc5f3b6b5d32c4b9f97ee4f648ad64857fb8223/tools/bootstrap-librdkafka.sh#L42
print("configuring...")
subprocess.check_call(
(
"./configure",
"--enable-static",
"--install-deps",
f"--prefix={args.prefix}",
),
cwd=tmpdir,
)
print("building...")
subprocess.check_call(("make", "-j", "-C", "src"), cwd=tmpdir)
subprocess.check_call(("make", "-j", "-C", "src-cpp"), cwd=tmpdir)
print("installing...")
subprocess.check_call(("make", "-C", "src", "install"), cwd=tmpdir)
subprocess.check_call(("make", "-C", "src-cpp", "install"), cwd=tmpdir)
return 0
if __name__ == "__main__":
raise SystemExit(main())