Skip to content

Commit c2df9d3

Browse files
fjlobscuren
authored andcommitted
[release/1.3.4] crypto/secp256k1: remove dependency on libgmp
Turns out we actually don't need it, USE_NUM_NONE works because we also set USE_FIELD_INV_BUILTIN. Conflicts: Makefile crypto/secp256k1/secp256.go
1 parent a4f4846 commit c2df9d3

File tree

5 files changed

+49
-60
lines changed

5 files changed

+49
-60
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ env:
2020
global:
2121
- secure: "U2U1AmkU4NJBgKR/uUAebQY87cNL0+1JHjnLOmmXwxYYyj5ralWb1aSuSH3qSXiT93qLBmtaUkuv9fberHVqrbAeVlztVdUsKAq7JMQH+M99iFkC9UiRMqHmtjWJ0ok4COD1sRYixxi21wb/JrMe3M1iL4QJVS61iltjHhVdM64="
2222
sudo: false
23-
addons:
24-
apt:
25-
packages:
26-
- libgmp3-dev
2723
notifications:
2824
webhooks:
2925
urls:

Makefile

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
GOBIN = build/bin
1212

13-
CROSSDEPS = https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2
13+
MODE ?= default
1414
GO ?= latest
1515

1616
geth:
@@ -26,32 +26,51 @@ geth-linux: xgo geth-linux-arm geth-linux-386 geth-linux-amd64
2626
@echo "Linux cross compilation done:"
2727
@ls -l $(GOBIN)/geth-linux-*
2828

29-
geth-linux-arm: xgo
30-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/arm -v $(shell build/flags.sh) ./cmd/geth
31-
@echo "Linux ARM cross compilation done:"
32-
@ls -l $(GOBIN)/geth-linux-* | grep arm
33-
3429
geth-linux-386: xgo
35-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth
30+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth
3631
@echo "Linux 386 cross compilation done:"
3732
@ls -l $(GOBIN)/geth-linux-* | grep 386
3833

3934
geth-linux-amd64: xgo
40-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth
35+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth
4136
@echo "Linux amd64 cross compilation done:"
4237
@ls -l $(GOBIN)/geth-linux-* | grep amd64
4338

44-
geth-darwin: xgo geth-darwin-386 geth-darwin-amd64
39+
geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
40+
@echo "Linux ARM cross compilation done:"
41+
@ls -l $(GOBIN)/geth-linux-* | grep arm
42+
43+
geth-linux-arm-5: xgo
44+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-5 -v $(shell build/flags.sh) ./cmd/geth
45+
@echo "Linux ARMv5 cross compilation done:"
46+
@ls -l $(GOBIN)/geth-linux-* | grep arm-5
47+
48+
geth-linux-arm-6: xgo
49+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-6 -v $(shell build/flags.sh) ./cmd/geth
50+
@echo "Linux ARMv6 cross compilation done:"
51+
@ls -l $(GOBIN)/geth-linux-* | grep arm-6
52+
53+
geth-linux-arm-7: xgo
54+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-7 -v $(shell build/flags.sh) ./cmd/geth
55+
@echo "Linux ARMv7 cross compilation done:"
56+
@ls -l $(GOBIN)/geth-linux-* | grep arm-7
57+
58+
geth-linux-arm64: xgo
59+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm64 -v $(shell build/flags.sh) ./cmd/geth
60+
@echo "Linux ARM64 cross compilation done:"
61+
@ls -l $(GOBIN)/geth-linux-* | grep arm64
62+
63+
geth-darwin: geth-darwin-386 geth-darwin-amd64
4564
@echo "Darwin cross compilation done:"
4665
@ls -l $(GOBIN)/geth-darwin-*
4766

4867
geth-darwin-386: xgo
49-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth
68+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth
5069
@echo "Darwin 386 cross compilation done:"
5170
@ls -l $(GOBIN)/geth-darwin-* | grep 386
5271

5372
geth-darwin-amd64: xgo
54-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth
73+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth
5574
@echo "Darwin amd64 cross compilation done:"
5675
@ls -l $(GOBIN)/geth-darwin-* | grep amd64
5776

@@ -60,28 +79,33 @@ geth-windows: xgo geth-windows-386 geth-windows-amd64
6079
@ls -l $(GOBIN)/geth-windows-*
6180

6281
geth-windows-386: xgo
63-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth
82+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth
6483
@echo "Windows 386 cross compilation done:"
6584
@ls -l $(GOBIN)/geth-windows-* | grep 386
6685

6786
geth-windows-amd64: xgo
68-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth
87+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth
6988
@echo "Windows amd64 cross compilation done:"
7089
@ls -l $(GOBIN)/geth-windows-* | grep amd64
7190

72-
geth-android: xgo geth-android-16 geth-android-21
91+
geth-android: xgo
92+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=android/* -v $(shell build/flags.sh) ./cmd/geth
7393
@echo "Android cross compilation done:"
7494
@ls -l $(GOBIN)/geth-android-*
7595

76-
geth-android-16: xgo
77-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-16/* -v $(shell build/flags.sh) ./cmd/geth
78-
@echo "Android 16 cross compilation done:"
79-
@ls -l $(GOBIN)/geth-android-16-*
96+
geth-ios: geth-ios-arm-7 geth-ios-arm64
97+
@echo "iOS cross compilation done:"
98+
@ls -l $(GOBIN)/geth-ios-*
99+
100+
geth-ios-arm-7: xgo
101+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=ios/arm-7 -v $(shell build/flags.sh) ./cmd/geth
102+
@echo "iOS ARMv7 cross compilation done:"
103+
@ls -l $(GOBIN)/geth-ios-* | grep arm-7
80104

81-
geth-android-21: xgo
82-
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --deps=$(CROSSDEPS) --targets=android-21/* -v $(shell build/flags.sh) ./cmd/geth
83-
@echo "Android 21 cross compilation done:"
84-
@ls -l $(GOBIN)/geth-android-21-*
105+
geth-ios-arm64: xgo
106+
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=ios-7.0/arm64 -v $(shell build/flags.sh) ./cmd/geth
107+
@echo "iOS ARM64 cross compilation done:"
108+
@ls -l $(GOBIN)/geth-ios-* | grep arm64
85109

86110
evm:
87111
build/env.sh $(GOROOT)/bin/go install -v $(shell build/flags.sh) ./cmd/evm

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ For prerequisites and detailed build instructions please read the
3030
[Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum)
3131
on the wiki.
3232

33-
Building geth requires two external dependencies, Go and GMP.
33+
Building geth requires both a Go and a C compiler.
3434
You can install them using your favourite package manager.
3535
Once the dependencies are installed, run
3636

crypto/secp256k1/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

crypto/secp256k1/secp256.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,8 @@ package secp256k1
2020

2121
/*
2222
#cgo CFLAGS: -I./libsecp256k1
23-
#cgo darwin CFLAGS: -I/usr/local/include
24-
#cgo freebsd CFLAGS: -I/usr/local/include
25-
#cgo linux,arm CFLAGS: -I/usr/local/arm/include
26-
#cgo LDFLAGS: -lgmp
27-
#cgo darwin LDFLAGS: -L/usr/local/lib
28-
#cgo freebsd LDFLAGS: -L/usr/local/lib
29-
#cgo linux,arm LDFLAGS: -L/usr/local/arm/lib
30-
#define USE_NUM_GMP
23+
#cgo CFLAGS: -I./libsecp256k1/src/
24+
#define USE_NUM_NONE
3125
#define USE_FIELD_10X26
3226
#define USE_FIELD_INV_BUILTIN
3327
#define USE_SCALAR_8X32

0 commit comments

Comments
 (0)