Skip to content

Commit 0e4deeb

Browse files
committed
Makefile, cmd/geth: assemble ios xcode frameworks
1 parent 2a3322e commit 0e4deeb

4 files changed

Lines changed: 91 additions & 27 deletions

File tree

‎Makefile‎

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
.PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
88
.PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
99
.PHONY: geth-windows geth-windows-386 geth-windows-amd64
10-
.PHONY: geth-android
11-
.PHONY: geth-ios geth-ios-arm-7 geth-ios-arm64
10+
.PHONY: geth-android geth-ios geth-ios-sim
1211

1312
GOBIN = build/bin
14-
15-
MODE ?= default
1613
GO ?= latest
1714

1815
geth:
@@ -29,12 +26,12 @@ geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm
2926
@ls -l $(GOBIN)/geth-linux-*
3027

3128
geth-linux-386: xgo
32-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth
29+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/386 -v $(shell build/flags.sh) ./cmd/geth
3330
@echo "Linux 386 cross compilation done:"
3431
@ls -l $(GOBIN)/geth-linux-* | grep 386
3532

3633
geth-linux-amd64: xgo
37-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth
34+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/amd64 -v $(shell build/flags.sh) ./cmd/geth
3835
@echo "Linux amd64 cross compilation done:"
3936
@ls -l $(GOBIN)/geth-linux-* | grep amd64
4037

@@ -43,22 +40,22 @@ geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-ar
4340
@ls -l $(GOBIN)/geth-linux-* | grep arm
4441

4542
geth-linux-arm-5: xgo
46-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-5 -v $(shell build/flags.sh) ./cmd/geth
43+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-5 -v $(shell build/flags.sh) ./cmd/geth
4744
@echo "Linux ARMv5 cross compilation done:"
4845
@ls -l $(GOBIN)/geth-linux-* | grep arm-5
4946

5047
geth-linux-arm-6: xgo
51-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-6 -v $(shell build/flags.sh) ./cmd/geth
48+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-6 -v $(shell build/flags.sh) ./cmd/geth
5249
@echo "Linux ARMv6 cross compilation done:"
5350
@ls -l $(GOBIN)/geth-linux-* | grep arm-6
5451

5552
geth-linux-arm-7: xgo
56-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm-7 -v $(shell build/flags.sh) ./cmd/geth
53+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/arm-7 -v $(shell build/flags.sh) ./cmd/geth
5754
@echo "Linux ARMv7 cross compilation done:"
5855
@ls -l $(GOBIN)/geth-linux-* | grep arm-7
5956

6057
geth-linux-arm64: xgo
61-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=linux/arm64 -v $(shell build/flags.sh) ./cmd/geth
58+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=linux/arm64 -v $(shell build/flags.sh) ./cmd/geth
6259
@echo "Linux ARM64 cross compilation done:"
6360
@ls -l $(GOBIN)/geth-linux-* | grep arm64
6461

@@ -67,12 +64,12 @@ geth-darwin: geth-darwin-386 geth-darwin-amd64
6764
@ls -l $(GOBIN)/geth-darwin-*
6865

6966
geth-darwin-386: xgo
70-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth
67+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=darwin/386 -v $(shell build/flags.sh) ./cmd/geth
7168
@echo "Darwin 386 cross compilation done:"
7269
@ls -l $(GOBIN)/geth-darwin-* | grep 386
7370

7471
geth-darwin-amd64: xgo
75-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth
72+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=darwin/amd64 -v $(shell build/flags.sh) ./cmd/geth
7673
@echo "Darwin amd64 cross compilation done:"
7774
@ls -l $(GOBIN)/geth-darwin-* | grep amd64
7875

@@ -81,33 +78,29 @@ geth-windows: geth-windows-386 geth-windows-amd64
8178
@ls -l $(GOBIN)/geth-windows-*
8279

8380
geth-windows-386: xgo
84-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth
81+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=windows/386 -v $(shell build/flags.sh) ./cmd/geth
8582
@echo "Windows 386 cross compilation done:"
8683
@ls -l $(GOBIN)/geth-windows-* | grep 386
8784

8885
geth-windows-amd64: xgo
89-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth
86+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=windows/amd64 -v $(shell build/flags.sh) ./cmd/geth
9087
@echo "Windows amd64 cross compilation done:"
9188
@ls -l $(GOBIN)/geth-windows-* | grep amd64
9289

9390
geth-android: xgo
94-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=android/* -v $(shell build/flags.sh) ./cmd/geth
91+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=android/* -v $(shell build/flags.sh) ./cmd/geth
9592
@echo "Android cross compilation done:"
9693
@ls -l $(GOBIN)/geth-android-*
9794

98-
geth-ios: geth-ios-arm-7 geth-ios-arm64
99-
@echo "iOS cross compilation done:"
95+
geth-ios: xgo
96+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=ios-7.0/* -v $(shell build/flags.sh) ./cmd/geth
97+
@echo "iOS framework cross compilation done:"
10098
@ls -l $(GOBIN)/geth-ios-*
10199

102-
geth-ios-arm-7: xgo
103-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=ios/arm-7 -v $(shell build/flags.sh) ./cmd/geth
104-
@echo "iOS ARMv7 cross compilation done:"
105-
@ls -l $(GOBIN)/geth-ios-* | grep arm-7
106-
107-
geth-ios-arm64: xgo
108-
build/env.sh $(GOBIN)/xgo --go=$(GO) --buildmode=$(MODE) --dest=$(GOBIN) --targets=ios-7.0/arm64 -v $(shell build/flags.sh) ./cmd/geth
109-
@echo "iOS ARM64 cross compilation done:"
110-
@ls -l $(GOBIN)/geth-ios-* | grep arm64
100+
geth-ios-sim: xgo
101+
build/env.sh $(GOBIN)/xgo --go=$(GO) --dest=$(GOBIN) --targets=ios-7.0/amd64 -v $(shell build/flags.sh) ./cmd/geth
102+
@echo "iOS framework simulator-only cross compilation done:"
103+
@ls -l $(GOBIN)/geth-ios-*
111104

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

‎cmd/geth/library.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2015 The go-ethereum Authors
2+
// This file is part of go-ethereum.
3+
//
4+
// go-ethereum is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// go-ethereum is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
17+
// Simple wrapper to translate the API exposed methods and types to inthernal
18+
// Go versions of the same types.
19+
20+
#include "_cgo_export.h"
21+
22+
int run(const char* args) {
23+
return doRun((char*)args);
24+
}

‎cmd/geth/library.go‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2015 The go-ethereum Authors
2+
// This file is part of go-ethereum.
3+
//
4+
// go-ethereum is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// go-ethereum is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
17+
// Contains a simple library definition to allow creating a Geth instance from
18+
// straight C code.
19+
20+
package main
21+
22+
// #ifdef __cplusplus
23+
// extern "C" {
24+
// #endif
25+
//
26+
// extern int run(const char*);
27+
//
28+
// #ifdef __cplusplus
29+
// }
30+
// #endif
31+
import "C"
32+
import (
33+
"fmt"
34+
"os"
35+
"strings"
36+
)
37+
38+
//export doRun
39+
func doRun(args *C.char) C.int {
40+
// This is equivalent to geth.main, just modified to handle the function arg passing
41+
if err := app.Run(strings.Split("geth "+C.GoString(args), " ")); err != nil {
42+
fmt.Fprintln(os.Stderr, err)
43+
return -1
44+
}
45+
return 0
46+
}

‎cmd/geth/main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
340340
utils.ExtraDataFlag,
341341
}
342342
app.Before = func(ctx *cli.Context) error {
343+
runtime.GOMAXPROCS(runtime.NumCPU())
344+
343345
utils.SetupLogger(ctx)
344346
utils.SetupNetwork(ctx)
345347
utils.SetupVM(ctx)
@@ -353,7 +355,6 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
353355
}
354356

355357
func main() {
356-
runtime.GOMAXPROCS(runtime.NumCPU())
357358
defer logger.Flush()
358359
if err := app.Run(os.Args); err != nil {
359360
fmt.Fprintln(os.Stderr, err)

0 commit comments

Comments
 (0)