forked from cryspen/libcrux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc.sh
More file actions
executable file
·97 lines (83 loc) · 2.15 KB
/
c.sh
File metadata and controls
executable file
·97 lines (83 loc) · 2.15 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
set -e
cwd=$(cd "$(dirname "$0")"; pwd -P)
docker=0
build=0
test=0
extract=1
while [ $# -gt 0 ]; do
case "$1" in
--docker) docker=1 ;;
--no-extract) extract=0 ;;
--build) build=1;;
--test) test=1;;
*) echo "Unknown argument"; exit 2 ;;
esac
shift
done
# Extract
if (( docker == 1 && extract == 1 )); then
echo "Extracting with docker ..."
sudo docker pull ghcr.io/cryspen/libcrux-c:latest
sudo docker run -v "$PWD":/home/user/libcrux \
--rm ghcr.io/cryspen/libcrux-c:latest bash \
-c "$cwd/libcrux-ml-kem/extracts/extract-all.sh && \
cd $cwd/libcrux-ml-dsa && ./boring.sh"
elif (( extract == 1 )); then
echo "Extracting locally ..."
echo " ML-KEM ..."
"$cwd"/libcrux-ml-kem/extracts/extract-all.sh
echo " ML-DSA ..."
(cd "$cwd"/libcrux-ml-dsa && ./boring.sh)
fi
if (( build == 0 && test == 0 )); then
echo "Run build and tests with --build and --test"
fi
# Build & test
# ML-KEM
ml_kem=(
libcrux-ml-kem/extracts/c/generated
libcrux-ml-kem/extracts/c_header_only/generated
libcrux-ml-kem/extracts/cpp_header_only/generated
)
build_mlkem() {
cd "$cwd/$1"
LIBCRUX_BENCHMARKS=1 CC=clang-19 CXX=clang++-19 cmake -B build -G "Ninja Multi-Config"
cmake --build build
cd "$cwd"
}
test_mlkem() {
cd "$cwd/$1"
./build/Debug/ml_kem_test
cd "$cwd"
}
if (( build == 1 )); then
for path in "${ml_kem[@]}"; do
echo "--------------------------------"
echo "Building: $path"
build_mlkem "$path"
done
fi
if (( test == 1 )); then
for path in "${ml_kem[@]}"; do
echo "--------------------------------"
echo "Testing: $path"
test_mlkem "$path"
done
fi
# ML-DSA
if (( build == 1 )); then
echo "--------------------------------"
echo "Building: ML-DSA"
cd "$cwd"/libcrux-ml-dsa/cg
CC=clang-18 CXX=clang++-18 cmake -B build -G "Ninja Multi-Config"
cmake --build build
cd "$cwd"
fi
if (( test == 1 )); then
echo "--------------------------------"
echo "Testing: ML-DSA"
cd $cwd/libcrux-ml-dsa/cg
./build/Debug/ml_dsa_test
cd "$cwd"
fi