forked from Chia-Network/bladebit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-bls
executable file
·63 lines (43 loc) · 1.05 KB
/
build-bls
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
#! /usr/bin/env bash
set -e
_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $_dir
n_threads=$(nproc --all)
# Assume 64-bit (only 64-bit is supported)
os=
arch=
case $(uname -m) in
x86_64) arch=x86 ;;
arm64) arch=arm ;;
aarch64) arch=arm ;;
*)
echo "Unsupported architecture '$(uname -m)'"
exit 1
;;
esac
case "$OSTYPE" in
"linux-gnu"*) os=linux ;;
"darwin"*) os=macos ;;
*)
echo "Unsupported OS '$OSTYPE'"
exit 1
;;
esac
# Build
pushd modules/bls-signatures
mkdir -p build
cd build
cmake ../
cmake --build . -- -j$n_threads
popd
# Copy headers & library
rm -rf lib/include/bls
rm -rf lib/include/relic
mkdir -p lib/include/bls
mkdir -p lib/include/relic
cp -r modules/bls-signatures/build/_deps/relic-src/include/* lib/include/relic
cp -r modules/bls-signatures/build/_deps/relic-build/include/* lib/include/relic
cp -r modules/bls-signatures/src/*.hpp lib/include/bls/
tgt_dir=lib/$os/$arch
mkdir -p $tgt_dir
cp modules/bls-signatures/build/libbls.a $tgt_dir/