-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·44 lines (38 loc) · 1.12 KB
/
build.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Remove older build
rm -rf core
# Clone fork repository and setup build contents
git clone https://github.com/bryk-io/miracl-core.git temp
for i in {1..43}
do
echo "$i" >> temp/go/build.txt
done
echo "0" >> temp/go/build.txt
## Build library and adjust custom path used
cd temp/go || exit
UPSTREAM_VERSION=$(git log --pretty=format:'%H' -n1)
python3 config64.py < build.txt
find . -type f -name '*.go' -exec sed -i '' "s|miracl/core|go.bryk.io/miracl/core|g" {} +
find . -type f -name '*.go' -exec sed -i '' "s|https://github.com/go.bryk.io/miracl/core|https://github.com/miracl/core|g" {} +
cp -Rv ./core ../../.
## Copy test files
cp Test* ../../.
cp Bench* ../../.
## Final clean-up
cd ../..
printf "package core\nconst Version=\"%s\"" "${UPSTREAM_VERSION}" > core/info.go
printf "1234\n1234\n1234\n1234\n" > pins.txt
rm -rf temp
gofmt -s -w .
goimports -w .
## Run tests and remove files
go run ./TestECC.go
go run ./TestBLS.go
go run ./TestHPKE.go
go run ./TestNHS.go
go run ./TestEDDSA.go
go run ./TestMPIN.go < pins.txt
rm Test* pins.txt
## Run benchmarks and remove files
go run ./BenchtestALL.go
rm BenchtestALL.go