-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-libsnark
executable file
·40 lines (31 loc) · 1.08 KB
/
get-libsnark
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
#!/bin/bash
# To pass options options to libsnark Makefile, put them in env var LIBSNARK_FLAGS.
# To clone libsnark from an alternate location, set env var LIBSNARK_SRC. For example:
# LIBSNARK_SRC="$HOME/libsnark.git --branch master" ./get-libsnark
# To use curve ALT_BN128 instead of BN128 (which is x64-only), use:
# CURVE=ALT_BN128 ./get-libsnark
set -e
LIBSNARK_SRC=${LIBSNARK_SRC:-https://github.com/yuquan1210/malicious-libsnark.git}
CURVE=${CURVE:-BN128}
LIBSNARK_FLAGS="$LIBSNARK_FLAGS NO_GTEST=1 NO_DOCS=1 CURVE=$CURVE NO_PROCPS=1"
# if [[ `uname -s` == "Darwin" ]]; then
# LIBSNARK_FLAGS="$LIBSNARK_FLAGS NO_PROCPS=1"
# fi
set -x
DEPSRC=./depsrc
DEPINST=./depinst
mkdir -p $DEPINST
DEPINST=`pwd -P`/$DEPINST # remember absolute path
mkdir -p $DEPSRC
cd $DEPSRC
[ ! -d libsnarkattack ] && git clone $LIBSNARK_SRC libsnarkattack
cd libsnarkattack
git pull
#if [ "$CURVE" == "BN128" ]; then
# # TODO: submit -fPIC patch to ate-pairing
# INC_DIR=-fPIC ./prepare-depends.sh
#fi
./prepare-depends.sh
make clean
make lib $LIBSNARK_FLAGS
make install PREFIX=$DEPINST $LIBSNARK_FLAGS