From 8cfa9079da3992691c6cd2c8ad4026337de9211c Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Sun, 16 Jun 2019 23:41:07 -0700 Subject: [PATCH 01/24] iOS changes --- mobile/geth.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mobile/geth.go b/mobile/geth.go index 41c23fdac1..a8b341840c 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -132,11 +132,15 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { // Create the empty networking stack nodeConf := &node.Config{ - Name: clientIdentifier, - Version: params.VersionWithMeta, - DataDir: datadir, - KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores! - IPCPath: "geth.ipc", + Name: clientIdentifier, + Version: params.VersionWithMeta, + DataDir: datadir, + KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores! + HTTPHost: "localhost", + HTTPPort: 8545, + HTTPVirtualHosts: []string{"localhost"}, + HTTPModules: []string{"db", "eth", "net", "web3", "personal"}, + HTTPCors: []string{"*"}, P2P: p2p.Config{ NoDiscovery: true, DiscoveryV5: false, From da88d4c5c6c3e121e6eafdbf344129060d544f36 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Thu, 15 Aug 2019 14:36:59 -0700 Subject: [PATCH 02/24] Compile on bls on ios --- Makefile | 13 ++++++++++++- build/ci.go | 2 +- vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml | 2 +- vendor/github.com/celo-org/bls-zexe/go/bls_ios.go | 8 ++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 vendor/github.com/celo-org/bls-zexe/go/bls_ios.go diff --git a/Makefile b/Makefile index abab15c2e0..675bbbc8d4 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ GO ?= latest CARGO_exists := $(shell command -v cargo 2> /dev/null) RUSTUP_exists := $(shell command -v rustup 2> /dev/null) +CARGO_LIPO_exists := $(shell command -v cargo lipo 2> /dev/null) LSB_exists := $(shell command -v lsb_release 2> /dev/null) OS := @@ -84,6 +85,16 @@ else cd vendor/github.com/celo-org/bls-zexe/bls && cargo build --release --target=x86_64-linux-android --lib endif +bls-zexe-ios: +ifeq ("$(RUSTUP_exists)","") + $(error "No rustup in PATH, consult https://github.com/celo-org/celo-monorepo/blob/master/SETUP.md") +else ifeq ("$(CARGO_LIPO_exists)","") + $(error "No cargo lipo in PATH, run cargo install cargo-CARGO_LIPO_exists") +else + rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-darwin i686-apple-darwin + cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,x86_64-apple-ios,armv7-apple-ios,armv7s-apple-ios +endif + vendor/github.com/celo-org/bls-zexe/bls/target/release/libbls_zexe.a: ifeq ("$(CARGO_exists)","") $(error "No cargo in PATH, consult https://github.com/celo-org/celo-monorepo/blob/master/SETUP.md") @@ -104,7 +115,7 @@ android: bls-zexe-android @echo "Done building." @echo "Import \"$(GOBIN)/geth.aar\" to use the library." -ios: +ios: bls-zexe-ios build/env.sh go run build/ci.go xcode --local @echo "Done building." @echo "Import \"$(GOBIN)/Geth.framework\" to use the library." diff --git a/build/ci.go b/build/ci.go index f440d2d7ee..c6bf6f4c2b 100644 --- a/build/ci.go +++ b/build/ci.go @@ -942,7 +942,7 @@ func doXCodeFramework(cmdline []string) { // Build the iOS XCode framework build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile", "golang.org/x/mobile/cmd/gobind")) - bind := gomobileTool("bind", "-ldflags", "-s -w", "--target", "ios", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile") + bind := gomobileTool("bind", "-ldflags", "-s -w", "--target=ios/arm,ios/arm64,ios/amd64", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile") if *local { // If we're building locally, use the build folder and stop afterwards diff --git a/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml b/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml index 081cbafd75..ec5dc847c8 100644 --- a/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml +++ b/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml @@ -46,4 +46,4 @@ name = "pop_csv" path = "examples/pop_csv.rs" [lib] -crate-type = ["lib", "staticlib"] +crate-type = ["staticlib", "cdylib"] diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go b/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go new file mode 100644 index 0000000000..957b32a4df --- /dev/null +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go @@ -0,0 +1,8 @@ +// +build ios + +package bls + +/* +#cgo LDFLAGS: -L../bls/target/universal/release -lbls_zexe -ldl -lm -framework Security -framework Foundation +*/ +import "C" From 5d0de5235327ab766eaec6e2ff7bd5cac2c81258 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Thu, 15 Aug 2019 15:54:18 -0700 Subject: [PATCH 03/24] Fix build --- Makefile | 5 +++-- vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go | 2 +- vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 675bbbc8d4..aedb7f5347 100644 --- a/Makefile +++ b/Makefile @@ -91,8 +91,8 @@ ifeq ("$(RUSTUP_exists)","") else ifeq ("$(CARGO_LIPO_exists)","") $(error "No cargo lipo in PATH, run cargo install cargo-CARGO_LIPO_exists") else - rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-darwin i686-apple-darwin - cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,x86_64-apple-ios,armv7-apple-ios,armv7s-apple-ios + rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios + cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,x86_64-apple-ios,i386-apple-ios endif vendor/github.com/celo-org/bls-zexe/bls/target/release/libbls_zexe.a: @@ -121,6 +121,7 @@ ios: bls-zexe-ios @echo "Import \"$(GOBIN)/Geth.framework\" to use the library." test: all + build/env.sh go run build/ci.go test lint: ## Run linters. diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go index e8170be43a..06a44642df 100644 --- a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go @@ -3,6 +3,6 @@ package bls /* -#cgo LDFLAGS: -L../bls/target/i686-apple-darwin/release -L../bls/target/release -lbls_zexe -ldl -lm +#cgo LDFLAGS: -L../bls/target/universal/release -L../bls/target/release -lbls_zexe -ldl -lm */ import "C" diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go index 4589b2cb30..da562d17a7 100644 --- a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go @@ -3,6 +3,6 @@ package bls /* -#cgo LDFLAGS: -L../bls/target/x86_64-apple-darwin/release -L../bls/target/release -lbls_zexe -ldl -lm +#cgo LDFLAGS: -L../bls/target/universal/release -L../bls/target/release -lbls_zexe -ldl -lm */ import "C" From 738b8aad95f3353ff41340e1eedc20919f4b99a3 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Thu, 15 Aug 2019 17:15:35 -0700 Subject: [PATCH 04/24] Fix npm publishing --- CeloBlockchain.podspec | 12 ++++++++++++ package.json | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 CeloBlockchain.podspec diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec new file mode 100644 index 0000000000..7080ca8e42 --- /dev/null +++ b/CeloBlockchain.podspec @@ -0,0 +1,12 @@ +Pod::Spec.new do |s| + s.name = 'Celo Blockchain' + s.version = '0.0.1' + s.license = { :type => 'BSD' } + s.homepage = 'http://celo.org' + s.authors = { 'Connor McEwen' => 'c@celo.org' } + s.summary = 'The Celo blockchain built for ios' + s.source = { :git => 'https://github.com/celo-org/celo-blockchain.git', :tag => s.version.to_s } + s.vendored_frameworks = 'build/bin/Geth.framework' + s.vendored_libraries = 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' + s.static_framework = true +end diff --git a/package.json b/package.json index d0a31e4eab..1965183a1e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "0.0.1", "description": "Celo client for mobile", "files": [ - "build/bin/geth.aar" + "build/bin/geth.aar", + "build/bin/Geth.framework/**", + "CeloBlockchain.podspec", + "vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a" ] } From f16308b08774ecac46330aeb5573cd268eb14554 Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Fri, 16 Aug 2019 11:50:07 -0700 Subject: [PATCH 05/24] Fix podspec --- CeloBlockchain.podspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec index 7080ca8e42..d774e28603 100644 --- a/CeloBlockchain.podspec +++ b/CeloBlockchain.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = 'Celo Blockchain' + s.name = 'CeloBlockchain' s.version = '0.0.1' s.license = { :type => 'BSD' } s.homepage = 'http://celo.org' @@ -8,5 +8,6 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/celo-org/celo-blockchain.git', :tag => s.version.to_s } s.vendored_frameworks = 'build/bin/Geth.framework' s.vendored_libraries = 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' + s.libraries = 'bls_zexe' s.static_framework = true end From 2d1d8cab5055829abd8324f57cff9d1f74ee456d Mon Sep 17 00:00:00 2001 From: Connor McEwen Date: Mon, 2 Sep 2019 12:27:34 -0500 Subject: [PATCH 06/24] Postinstall --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1965183a1e..f5cb404231 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,14 @@ { "name": "@celo/client", - "version": "0.0.1", + "version": "0.0.107", "description": "Celo client for mobile", "files": [ "build/bin/geth.aar", - "build/bin/Geth.framework/**", + "build/bin/Geth.framework.zip", "CeloBlockchain.podspec", "vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a" - ] + ], + "scripts": { + "postinstall": "unzip build/bin/Geth.framework.zip -d build/bin" + } } From fa533cb55cbce688b0bd747414c07b5a970cd9fc Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 9 Oct 2019 12:01:51 +0200 Subject: [PATCH 07/24] Fix cargo-lipo check --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 35a7960b12..1e66d27b10 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ GO ?= latest CARGO_exists := $(shell command -v cargo 2> /dev/null) RUSTUP_exists := $(shell command -v rustup 2> /dev/null) -CARGO_LIPO_exists := $(shell command -v cargo lipo 2> /dev/null) +CARGO_LIPO_exists := $(shell command -v cargo-lipo 2> /dev/null) LSB_exists := $(shell command -v lsb_release 2> /dev/null) OS := @@ -92,7 +92,7 @@ bls-zexe-ios: ifeq ("$(RUSTUP_exists)","") $(error "No rustup in PATH, consult https://github.com/celo-org/celo-monorepo/blob/master/SETUP.md") else ifeq ("$(CARGO_LIPO_exists)","") - $(error "No cargo lipo in PATH, run cargo install cargo-CARGO_LIPO_exists") + $(error "No cargo lipo in PATH, run cargo install cargo-lipo") else rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,x86_64-apple-ios,i386-apple-ios From 902f33499b6c055809ea7cef8e5ff32230c5df0f Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 9 Oct 2019 12:03:33 +0200 Subject: [PATCH 08/24] Patch gomobile to disable bitcode for now since the rust ouput is not yet compatible with apple's bitcode --- build/ci.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/ci.go b/build/ci.go index c6bf6f4c2b..000bc9fa46 100644 --- a/build/ci.go +++ b/build/ci.go @@ -942,6 +942,8 @@ func doXCodeFramework(cmdline []string) { // Build the iOS XCode framework build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile", "golang.org/x/mobile/cmd/gobind")) + // Patch gomobile to disable bitcode for now (rust generated bls lib output is not compatible) + build.MustRunCommand("sed", "-i", "", `/^[[:space:]]*cflags += \" -fembed-bitcode\"$/s/^/\/\//`, filepath.Join(build.GOPATH(), "src/golang.org/x/mobile/cmd/gomobile/env.go")) bind := gomobileTool("bind", "-ldflags", "-s -w", "--target=ios/arm,ios/arm64,ios/amd64", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile") if *local { From 22e0e43891f13863ad26b7879fe313ac2475d2aa Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 9 Oct 2019 12:04:49 +0200 Subject: [PATCH 09/24] Generate all archs for ios (armv7, arm64, i386, x86_64) --- build/ci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci.go b/build/ci.go index 000bc9fa46..7c82477e23 100644 --- a/build/ci.go +++ b/build/ci.go @@ -944,7 +944,7 @@ func doXCodeFramework(cmdline []string) { build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile", "golang.org/x/mobile/cmd/gobind")) // Patch gomobile to disable bitcode for now (rust generated bls lib output is not compatible) build.MustRunCommand("sed", "-i", "", `/^[[:space:]]*cflags += \" -fembed-bitcode\"$/s/^/\/\//`, filepath.Join(build.GOPATH(), "src/golang.org/x/mobile/cmd/gomobile/env.go")) - bind := gomobileTool("bind", "-ldflags", "-s -w", "--target=ios/arm,ios/arm64,ios/amd64", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile") + bind := gomobileTool("bind", "-ldflags", "-s -w", "--target", "ios", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile") if *local { // If we're building locally, use the build folder and stop afterwards From 4a466e0a590b70d2fe3539806b6d8a54e29c7cec Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 11 Oct 2019 14:28:29 +0200 Subject: [PATCH 10/24] Expose ipc path config --- mobile/geth.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mobile/geth.go b/mobile/geth.go index 826b9c6acd..6026d746a9 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -98,6 +98,12 @@ type NodeConfig struct { // scrypt KDF at the expense of security. // See https://geth.ethereum.org/doc/Mobile_Account-management for reference UseLightweightKDF bool + + // IPCPath is the requested location to place the IPC endpoint. If the path is + // a simple file name, it is placed inside the data directory (or on the root + // pipe path on Windows), whereas if it's a resolvable path name (absolute or + // relative), then that specific path is enforced. An empty path disables IPC. + IPCPath string } // defaultNodeConfig contains the default node configuration values to use if all @@ -145,11 +151,7 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { DataDir: datadir, KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores! UseLightweightKDF: config.UseLightweightKDF, - HTTPHost: "localhost", - HTTPPort: 8545, - HTTPVirtualHosts: []string{"localhost"}, - HTTPModules: []string{"db", "eth", "net", "web3", "personal"}, - HTTPCors: []string{"*"}, + IPCPath: config.IPCPath, P2P: p2p.Config{ NoDiscovery: true, DiscoveryV5: false, From 73653b2d998c40979b1bff62c7dcade7a32cf423 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 11 Oct 2019 14:41:28 +0200 Subject: [PATCH 11/24] Don't build bls for armv7s since it's not used in the final framework --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7e99bc91c8..5162e7320b 100644 --- a/Makefile +++ b/Makefile @@ -93,8 +93,8 @@ ifeq ("$(RUSTUP_exists)","") else ifeq ("$(CARGO_LIPO_exists)","") $(error "No cargo lipo in PATH, run cargo install cargo-lipo") else - rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios - cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,x86_64-apple-ios,i386-apple-ios + rustup target add aarch64-apple-ios armv7-apple-ios x86_64-apple-ios i386-apple-ios + cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,armv7-apple-ios,x86_64-apple-ios,i386-apple-ios endif vendor/github.com/celo-org/bls-zexe/bls/target/release/libbls_zexe.a: From 084b2de5e09ca6f7a11c629d181a4b229d574495 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 11 Oct 2019 14:42:10 +0200 Subject: [PATCH 12/24] Restore original package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5cb404231..8a81cf14a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@celo/client", - "version": "0.0.107", + "version": "0.0.1", "description": "Celo client for mobile", "files": [ "build/bin/geth.aar", From 2a69428fe62e6055971da9198b672f12c56dc952 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 11 Oct 2019 15:14:15 +0200 Subject: [PATCH 13/24] Zip iOS framework --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 5162e7320b..6afb1aac4c 100644 --- a/Makefile +++ b/Makefile @@ -119,6 +119,7 @@ android: bls-zexe-android ios: bls-zexe-ios build/env.sh go run build/ci.go xcode --local + pushd "$(GOBIN)"; rm -rf Geth.framework.zip; zip -r9y Geth.framework.zip Geth.framework; popd @echo "Done building." @echo "Import \"$(GOBIN)/Geth.framework\" to use the library." From 33ecf244e67dd2f8157ae35d0f40a992c68879fe Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 11 Oct 2019 15:18:34 +0200 Subject: [PATCH 14/24] Fix postinstall failing when geth framework has already been unzipped --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a81cf14a0..0eca98ed65 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,6 @@ "vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a" ], "scripts": { - "postinstall": "unzip build/bin/Geth.framework.zip -d build/bin" + "postinstall": "rm -rf build/bin/Geth.framework && unzip build/bin/Geth.framework.zip -d build/bin" } } From bb1ed1f5a3cd91e97f46c0315af9226fecfb0baf Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 14 Oct 2019 10:58:35 +0200 Subject: [PATCH 15/24] Make iOS podspec compatible with use_frameworks! --- CeloBlockchain.podspec | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec index d774e28603..39c50e9484 100644 --- a/CeloBlockchain.podspec +++ b/CeloBlockchain.podspec @@ -1,13 +1,17 @@ +require 'json' + +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + Pod::Spec.new do |s| - s.name = 'CeloBlockchain' - s.version = '0.0.1' + s.name = 'CeloBlockchain' + s.version = package['version'] s.license = { :type => 'BSD' } - s.homepage = 'http://celo.org' + s.homepage = 'https://celo.org' s.authors = { 'Connor McEwen' => 'c@celo.org' } s.summary = 'The Celo blockchain built for ios' - s.source = { :git => 'https://github.com/celo-org/celo-blockchain.git', :tag => s.version.to_s } - s.vendored_frameworks = 'build/bin/Geth.framework' - s.vendored_libraries = 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' - s.libraries = 'bls_zexe' - s.static_framework = true + s.source = { :git => 'https://github.com/celo-org/celo-blockchain.git', :tag => s.version.to_s } + s.source_files = 'build/bin/Geth.framework/**/*.h', 'Empty.m' + s.vendored_libraries = 'libGeth.a', 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' + s.prepare_command = 'touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a' + s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' } end From 42caff5a79f68932f414ec2f7660639c4f7ac65f Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 14 Oct 2019 11:02:56 +0200 Subject: [PATCH 16/24] Remove empty line --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 6afb1aac4c..6c6d3cc8c4 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,6 @@ ios: bls-zexe-ios @echo "Import \"$(GOBIN)/Geth.framework\" to use the library." test: all - build/env.sh go run build/ci.go test lint: ## Run linters. From 449801526d94c3aeef940cbdcea05cfa62c35822 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 14 Oct 2019 13:22:52 +0200 Subject: [PATCH 17/24] Restore crate-type This config works for both iOS and Android --- vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml b/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml index ec5dc847c8..081cbafd75 100644 --- a/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml +++ b/vendor/github.com/celo-org/bls-zexe/bls/Cargo.toml @@ -46,4 +46,4 @@ name = "pop_csv" path = "examples/pop_csv.rs" [lib] -crate-type = ["staticlib", "cdylib"] +crate-type = ["lib", "staticlib"] From 2dba9f4bb210d3ffc29d605f7c98a0a6a231d508 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 14 Oct 2019 13:27:15 +0200 Subject: [PATCH 18/24] Ignore ndk_bundle dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d215838836..d96b8ed5e2 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ target /build/bin/* !/build/bin/geth.aar /geth*.zip +ndk_bundle # travis profile.tmp From 4227e14bd42cfb717a1976840dba811e9c64df3e Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 14 Oct 2019 17:01:14 +0200 Subject: [PATCH 19/24] Restore bls darwin linking flags --- vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go | 2 +- vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go index 06a44642df..e8170be43a 100644 --- a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin.go @@ -3,6 +3,6 @@ package bls /* -#cgo LDFLAGS: -L../bls/target/universal/release -L../bls/target/release -lbls_zexe -ldl -lm +#cgo LDFLAGS: -L../bls/target/i686-apple-darwin/release -L../bls/target/release -lbls_zexe -ldl -lm */ import "C" diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go index da562d17a7..4589b2cb30 100644 --- a/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_darwin64.go @@ -3,6 +3,6 @@ package bls /* -#cgo LDFLAGS: -L../bls/target/universal/release -L../bls/target/release -lbls_zexe -ldl -lm +#cgo LDFLAGS: -L../bls/target/x86_64-apple-darwin/release -L../bls/target/release -lbls_zexe -ldl -lm */ import "C" From b804fd14580796795d21c8ba09c87dc5596df237 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 16 Oct 2019 11:10:27 +0200 Subject: [PATCH 20/24] Remove space --- vendor/github.com/celo-org/bls-zexe/go/bls_ios.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go b/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go index 957b32a4df..0e477047c4 100644 --- a/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go +++ b/vendor/github.com/celo-org/bls-zexe/go/bls_ios.go @@ -3,6 +3,6 @@ package bls /* -#cgo LDFLAGS: -L../bls/target/universal/release -lbls_zexe -ldl -lm -framework Security -framework Foundation +#cgo LDFLAGS: -L../bls/target/universal/release -lbls_zexe -ldl -lm -framework Security -framework Foundation */ import "C" From eb12e5a93a8ea0d57a570d58e7dcb610c7e9490a Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 16 Oct 2019 11:11:20 +0200 Subject: [PATCH 21/24] Remove more space --- CeloBlockchain.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec index 39c50e9484..009bd29d6e 100644 --- a/CeloBlockchain.podspec +++ b/CeloBlockchain.podspec @@ -5,7 +5,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) Pod::Spec.new do |s| s.name = 'CeloBlockchain' s.version = package['version'] - s.license = { :type => 'BSD' } + s.license = { :type => 'BSD' } s.homepage = 'https://celo.org' s.authors = { 'Connor McEwen' => 'c@celo.org' } s.summary = 'The Celo blockchain built for ios' From e81436dd88b0724769c3162e13e3956bf13d822c Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 16 Oct 2019 11:45:29 +0200 Subject: [PATCH 22/24] Installing cargo-lipo for the user when necessary --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6c6d3cc8c4..2f8fe77418 100644 --- a/Makefile +++ b/Makefile @@ -90,9 +90,10 @@ endif bls-zexe-ios: ifeq ("$(RUSTUP_exists)","") $(error "No rustup in PATH, consult https://github.com/celo-org/celo-monorepo/blob/master/SETUP.md") -else ifeq ("$(CARGO_LIPO_exists)","") - $(error "No cargo lipo in PATH, run cargo install cargo-lipo") -else +else +ifeq ("$(CARGO_LIPO_exists)","") + cargo install cargo-lipo +endif rustup target add aarch64-apple-ios armv7-apple-ios x86_64-apple-ios i386-apple-ios cd vendor/github.com/celo-org/bls-zexe/bls && cargo lipo --release --targets=aarch64-apple-ios,armv7-apple-ios,x86_64-apple-ios,i386-apple-ios endif From d2127b7ccca5c2bd040e78be7ec0e3fa5fa40114 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Wed, 16 Oct 2019 12:15:16 +0200 Subject: [PATCH 23/24] Update package info --- CeloBlockchain.podspec | 8 ++++---- package.json | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec index 009bd29d6e..4551a55150 100644 --- a/CeloBlockchain.podspec +++ b/CeloBlockchain.podspec @@ -5,11 +5,11 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) Pod::Spec.new do |s| s.name = 'CeloBlockchain' s.version = package['version'] - s.license = { :type => 'BSD' } - s.homepage = 'https://celo.org' + s.license = package['license'] + s.homepage = package['homepage'] s.authors = { 'Connor McEwen' => 'c@celo.org' } - s.summary = 'The Celo blockchain built for ios' - s.source = { :git => 'https://github.com/celo-org/celo-blockchain.git', :tag => s.version.to_s } + s.summary = package['description'] + s.source = { :git => package['repository']['url'], :tag => s.version } s.source_files = 'build/bin/Geth.framework/**/*.h', 'Empty.m' s.vendored_libraries = 'libGeth.a', 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' s.prepare_command = 'touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a' diff --git a/package.json b/package.json index 0eca98ed65..3aabd143c0 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,12 @@ "name": "@celo/client", "version": "0.0.1", "description": "Celo client for mobile", + "homepage": "https://celo.org", + "repository": { + "type": "git", + "url": "https://github.com/celo-org/celo-blockchain.git" + }, + "license": "LGPL-3.0", "files": [ "build/bin/geth.aar", "build/bin/Geth.framework.zip", From d52fd6b950b22dd10b01026280714a37c9563ee9 Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Fri, 18 Oct 2019 09:24:31 +0200 Subject: [PATCH 24/24] Move podspec prepare command to package postinstall This is to fix problems when yarn/npm is run after pod install and clears what has been done by the podspec prepare command. --- CeloBlockchain.podspec | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CeloBlockchain.podspec b/CeloBlockchain.podspec index 4551a55150..9f9660d9c6 100644 --- a/CeloBlockchain.podspec +++ b/CeloBlockchain.podspec @@ -12,6 +12,5 @@ Pod::Spec.new do |s| s.source = { :git => package['repository']['url'], :tag => s.version } s.source_files = 'build/bin/Geth.framework/**/*.h', 'Empty.m' s.vendored_libraries = 'libGeth.a', 'vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a' - s.prepare_command = 'touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a' s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-ObjC' } end diff --git a/package.json b/package.json index 3aabd143c0..e458bd2b46 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,6 @@ "vendor/github.com/celo-org/bls-zexe/bls/target/universal/release/libbls_zexe.a" ], "scripts": { - "postinstall": "rm -rf build/bin/Geth.framework && unzip build/bin/Geth.framework.zip -d build/bin" + "postinstall": "rm -rf build/bin/Geth.framework && unzip build/bin/Geth.framework.zip -d build/bin && touch Empty.m && ln -sf build/bin/Geth.framework/Versions/A/Geth libGeth.a" } }