forked from yixuanzi/lightning_circuit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-libsnark
executable file
·44 lines (34 loc) · 1.22 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
41
42
43
44
#!/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
sudo apt-get install libgmp-dev
sudo apt-get install libprocps-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libboost-program-options1.60.0
set -e
LIBSNARK_SRC=${LIBSNARK_SRC:-https://github.com/lightning-li/libsnark-6b7e494c2407eb8e91ad78635788decb2d736596.git}
CURVE=${CURVE:-BN128}
LIBSNARK_FLAGS="$LIBSNARK_FLAGS NO_SUPERCOP=1 NO_GTEST=1 NO_DOCS=1 CURVE=$CURVE"
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 libsnark ] && git clone $LIBSNARK_SRC libsnark
cd libsnark
git pull
if [ "$CURVE" == "BN128" ]; then
# TODO: submit -fPIC patch to ate-pairing
INC_DIR=-fPIC ./prepare-depends.sh
fi
make clean
make lib $LIBSNARK_FLAGS
make install PREFIX=$DEPINST $LIBSNARK_FLAGS