-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild-common.sh
executable file
·29 lines (26 loc) · 1.28 KB
/
build-common.sh
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
#!/bin/bash
set -e
set -x
# Build the Milagro crypto library. Milagro uses a python script as its
# build system, found under "amcl/c/config64.py".
#
# Compilation steps in Milagro are hard-coded to use "gcc". That is why
# we patch it locally to allow compilation for different toolchains.
# In addition, there is an interactive configuration step that we want to
# need to automated.
(rm -rf $BUILDFOLDER && \
mkdir -p $BUILDFOLDER && \
cd $BUILDFOLDER && \
cp $SCRIPTPATH/external/amcl/c/* . && \
# WARNING: if this config64.py changes, double check the replacements still work
echo "495a972a8833b6e3313ca50aafb2bfb70dfeed1f83c0d633042e3eb21df0ff32 config64.py" | sha256sum -c - && \
sed -i "s/os.system(\"gcc/os.system(\"$CC $CFLAGS /g" config64.py && \
sed -i "s/os.system(\"ar/os.system(\"$AR/g" config64.py && \
# Note: this should be in sync with the CURVE choices that we want to support.
# Select BN254 = 25 and 27 = BLS12383.
# (These curves can be used by changing the CURVE file; more details can be found in the README).
# Each choice needs to be separated by endline, and last one should be 0.
echo -e "25\n27\n0" | python3 config64.py)
$CC $CFLAGS -D AMCL_CURVE_${CURVE} -c core/group-sign.c \
-I$BUILDFOLDER \
-o $BUILDFOLDER/group-sign.o