-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcrc32c
More file actions
executable file
·69 lines (60 loc) · 1.79 KB
/
crc32c
File metadata and controls
executable file
·69 lines (60 loc) · 1.79 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
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import os.path
import subprocess
import tempfile
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("crc32c_rev")
parser.add_argument("prefix")
args = parser.parse_args()
with tempfile.TemporaryDirectory() as tmpdir:
print("cloning crc32c...")
subprocess.check_call(
(
"git",
"clone",
"--quiet",
"https://github.com/google/crc32c",
tmpdir,
),
)
subprocess.check_call(
("git", "-C", tmpdir, "checkout", "--quiet", args.crc32c_rev)
)
print("checking out submodules...")
subprocess.check_call(
(
"git",
"-C",
tmpdir,
"submodule",
"update",
"--quiet",
"--init",
"--recursive",
"--depth=1",
)
)
print("building...")
build_dir = os.path.join(tmpdir, "build")
os.makedirs(build_dir)
subprocess.check_call(
(
"cmake",
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
f"-DCMAKE_INSTALL_PREFIX={args.prefix}",
"-DCRC32C_BUILD_TESTS=no",
"-DCRC32C_BUILD_BENCHMARKS=no",
"-DBUILD_SHARED_LIBS=yes",
f"-DCMAKE_INSTALL_PREFIX:PATH={args.prefix}",
f"-DCMAKE_INSTALL_NAME_DIR:PATH={args.prefix}/lib",
"..",
),
cwd=build_dir,
)
subprocess.check_call(("make", "all", "install"), cwd=build_dir)
return 0
if __name__ == "__main__":
raise SystemExit(main())