diff --git a/VERSION b/VERSION
deleted file mode 100644
index bfa363e76e..0000000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.8.4
diff --git a/build/ci.go b/build/ci.go
new file mode 100644
index 0000000000..2998cfe18e
--- /dev/null
+++ b/build/ci.go
@@ -0,0 +1,326 @@
+// Copyright 2016 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+// +build none
+
+/*
+The ci command is called from Continuous Integration scripts.
+
+Usage: go run build/ci.go
+
+Available commands are:
+
+ install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
+ test [ -coverage ] [ packages... ] -- runs the tests
+ lint -- runs certain pre-selected linters
+ importkeys -- imports signing keys from env
+ xgo [ -alltools ] [ options ] -- cross builds according to options
+
+For all commands, -n prevents execution of external programs (dry run mode).
+
+*/
+package main
+
+import (
+ "flag"
+ "fmt"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "strings"
+
+ "github.com/ethereum/go-ethereum/internal/build"
+)
+
+var (
+ // Files that end up in the geth-alltools*.zip archive.
+ allToolsArchiveFiles = []string{
+ "COPYING",
+ executablePath("abigen"),
+ executablePath("bootnode"),
+ executablePath("evm"),
+ executablePath("geth"),
+ executablePath("puppeth"),
+ executablePath("rlpdump"),
+ executablePath("swarm"),
+ executablePath("wnode"),
+ }
+)
+
+var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
+
+func executablePath(name string) string {
+ if runtime.GOOS == "windows" {
+ name += ".exe"
+ }
+ return filepath.Join(GOBIN, name)
+}
+
+func main() {
+ log.SetFlags(log.Lshortfile)
+
+ if _, err := os.Stat(filepath.Join("build", "ci.go")); os.IsNotExist(err) {
+ log.Fatal("this script must be run from the root of the repository")
+ }
+ if len(os.Args) < 2 {
+ log.Fatal("need subcommand as first argument")
+ }
+ switch os.Args[1] {
+ case "install":
+ doInstall(os.Args[2:])
+ case "test":
+ doTest(os.Args[2:])
+ case "lint":
+ doLint(os.Args[2:])
+ case "xgo":
+ doXgo(os.Args[2:])
+ default:
+ log.Fatal("unknown command ", os.Args[1])
+ }
+}
+
+// Compiling
+
+func doInstall(cmdline []string) {
+ var (
+ arch = flag.String("arch", "", "Architecture to cross build for")
+ cc = flag.String("cc", "", "C compiler to cross build with")
+ )
+ flag.CommandLine.Parse(cmdline)
+ env := build.Env()
+
+ // Check Go version. People regularly open issues about compilation
+ // failure with outdated Go. This should save them the trouble.
+ if !strings.Contains(runtime.Version(), "devel") {
+ // Figure out the minor version number since we can't textually compare (1.10 < 1.9)
+ var minor int
+ fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
+
+ if minor < 9 {
+ log.Println("You have Go version", runtime.Version())
+ log.Println("XDC requires at least Go version 1.9 and cannot")
+ log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
+ os.Exit(1)
+ }
+ }
+ // Compile packages given as arguments, or everything if there are no arguments.
+ packages := []string{"./..."}
+ if flag.NArg() > 0 {
+ packages = flag.Args()
+ }
+ packages = build.ExpandPackagesNoVendor(packages)
+
+ if *arch == "" || *arch == runtime.GOARCH {
+ goinstall := goTool("install", buildFlags(env)...)
+ goinstall.Args = append(goinstall.Args, "-v")
+ goinstall.Args = append(goinstall.Args, packages...)
+ build.MustRun(goinstall)
+ return
+ }
+ // If we are cross compiling to ARMv5 ARMv6 or ARMv7, clean any previous builds
+ if *arch == "arm" {
+ os.RemoveAll(filepath.Join(runtime.GOROOT(), "pkg", runtime.GOOS+"_arm"))
+ for _, path := range filepath.SplitList(build.GOPATH()) {
+ os.RemoveAll(filepath.Join(path, "pkg", runtime.GOOS+"_arm"))
+ }
+ }
+ // Seems we are cross compiling, work around forbidden GOBIN
+ goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
+ goinstall.Args = append(goinstall.Args, "-v")
+ goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
+ goinstall.Args = append(goinstall.Args, packages...)
+ build.MustRun(goinstall)
+
+ if cmds, err := ioutil.ReadDir("cmd"); err == nil {
+ for _, cmd := range cmds {
+ pkgs, err := parser.ParseDir(token.NewFileSet(), filepath.Join(".", "cmd", cmd.Name()), nil, parser.PackageClauseOnly)
+ if err != nil {
+ log.Fatal(err)
+ }
+ for name := range pkgs {
+ if name == "main" {
+ gobuild := goToolArch(*arch, *cc, "build", buildFlags(env)...)
+ gobuild.Args = append(gobuild.Args, "-v")
+ gobuild.Args = append(gobuild.Args, []string{"-o", executablePath(cmd.Name())}...)
+ gobuild.Args = append(gobuild.Args, "."+string(filepath.Separator)+filepath.Join("cmd", cmd.Name()))
+ build.MustRun(gobuild)
+ break
+ }
+ }
+ }
+ }
+}
+
+func buildFlags(env build.Environment) (flags []string) {
+ var ld []string
+ if env.Commit != "" {
+ ld = append(ld, "-X", "main.gitCommit="+env.Commit)
+ }
+ if runtime.GOOS == "darwin" {
+ ld = append(ld, "-s")
+ }
+
+ if len(ld) > 0 {
+ flags = append(flags, "-ldflags", strings.Join(ld, " "))
+ }
+ return flags
+}
+
+func goTool(subcmd string, args ...string) *exec.Cmd {
+ return goToolArch(runtime.GOARCH, os.Getenv("CC"), subcmd, args...)
+}
+
+func goToolArch(arch string, cc string, subcmd string, args ...string) *exec.Cmd {
+ cmd := build.GoTool(subcmd, args...)
+ cmd.Env = []string{"GOPATH=" + build.GOPATH()}
+ if arch == "" || arch == runtime.GOARCH {
+ cmd.Env = append(cmd.Env, "GOBIN="+GOBIN)
+ } else {
+ cmd.Env = append(cmd.Env, "CGO_ENABLED=1")
+ cmd.Env = append(cmd.Env, "GOARCH="+arch)
+ }
+ if cc != "" {
+ cmd.Env = append(cmd.Env, "CC="+cc)
+ }
+ for _, e := range os.Environ() {
+ if strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "GOBIN=") {
+ continue
+ }
+ cmd.Env = append(cmd.Env, e)
+ }
+ return cmd
+}
+
+// Running The Tests
+//
+// "tests" also includes static analysis tools such as vet.
+
+func doTest(cmdline []string) {
+ var (
+ coverage = flag.Bool("coverage", false, "Whether to record code coverage")
+ )
+ flag.CommandLine.Parse(cmdline)
+ env := build.Env()
+
+ packages := []string{"./..."}
+ if len(flag.CommandLine.Args()) > 0 {
+ packages = flag.CommandLine.Args()
+ }
+ packages = build.ExpandPackagesNoVendor(packages)
+
+ // Run analysis tools before the tests.
+ build.MustRun(goTool("vet", packages...))
+
+ // Run the actual tests.
+ gotest := goTool("test", buildFlags(env)...)
+ // Test a single package at a time. CI builders are slow
+ // and some tests run into timeouts under load.
+ gotest.Args = append(gotest.Args, "-p", "1")
+ if *coverage {
+ gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
+ }
+
+ gotest.Args = append(gotest.Args, packages...)
+ build.MustRun(gotest)
+}
+
+// runs gometalinter on requested packages
+func doLint(cmdline []string) {
+ flag.CommandLine.Parse(cmdline)
+
+ packages := []string{"./..."}
+ if len(flag.CommandLine.Args()) > 0 {
+ packages = flag.CommandLine.Args()
+ }
+ // Get metalinter and install all supported linters
+ build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v2"))
+ build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), "--install")
+
+ // Run fast linters batched together
+ configs := []string{
+ "--vendor",
+ "--disable-all",
+ "--enable=vet",
+ "--enable=gofmt",
+ "--enable=misspell",
+ "--enable=goconst",
+ "--min-occurrences=6", // for goconst
+ }
+ build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
+
+ // Run slow linters one by one
+ for _, linter := range []string{"unconvert", "gosimple"} {
+ configs = []string{"--vendor", "--deadline=10m", "--disable-all", "--enable=" + linter}
+ build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
+ }
+}
+
+// Cross compilation
+
+func doXgo(cmdline []string) {
+ var (
+ alltools = flag.Bool("alltools", false, `Flag whether we're building all known tools, or only on in particular`)
+ )
+ flag.CommandLine.Parse(cmdline)
+ env := build.Env()
+
+ // Make sure xgo is available for cross compilation
+ gogetxgo := goTool("get", "github.com/karalabe/xgo")
+ build.MustRun(gogetxgo)
+
+ // If all tools building is requested, build everything the builder wants
+ args := append(buildFlags(env), flag.Args()...)
+
+ if *alltools {
+ args = append(args, []string{"--dest", GOBIN}...)
+ for _, res := range allToolsArchiveFiles {
+ if strings.HasPrefix(res, GOBIN) {
+ // Binary tool found, cross build it explicitly
+ args = append(args, "./"+filepath.Join("cmd", filepath.Base(res)))
+ xgo := xgoTool(args)
+ build.MustRun(xgo)
+ args = args[:len(args)-1]
+ }
+ }
+ return
+ }
+ // Otherwise xxecute the explicit cross compilation
+ path := args[len(args)-1]
+ args = append(args[:len(args)-1], []string{"--dest", GOBIN, path}...)
+
+ xgo := xgoTool(args)
+ build.MustRun(xgo)
+}
+
+func xgoTool(args []string) *exec.Cmd {
+ cmd := exec.Command(filepath.Join(GOBIN, "xgo"), args...)
+ cmd.Env = []string{
+ "GOPATH=" + build.GOPATH(),
+ "GOBIN=" + GOBIN,
+ }
+ for _, e := range os.Environ() {
+ if strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "GOBIN=") {
+ continue
+ }
+ cmd.Env = append(cmd.Env, e)
+ }
+ return cmd
+}
diff --git a/build/deb.changelog b/build/deb.changelog
deleted file mode 100644
index 83f804a833..0000000000
--- a/build/deb.changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.Name}} ({{.VersionString}}) {{.Distro}}; urgency=low
-
- * git build of {{.Env.Commit}}
-
- -- {{.Author}} {{.Time}}
diff --git a/build/deb.control b/build/deb.control
deleted file mode 100644
index 33c1a779f4..0000000000
--- a/build/deb.control
+++ /dev/null
@@ -1,25 +0,0 @@
-Source: {{.Name}}
-Section: science
-Priority: extra
-Maintainer: {{.Author}}
-Build-Depends: debhelper (>= 8.0.0), golang-1.10
-Standards-Version: 3.9.5
-Homepage: https://ethereum.org
-Vcs-Git: git://github.com/ethereum/go-ethereum.git
-Vcs-Browser: https://github.com/ethereum/go-ethereum
-
-Package: {{.Name}}
-Architecture: any
-Depends: ${misc:Depends}, {{.ExeList}}
-Description: Meta-package to install geth and other tools
- Meta-package to install geth and other tools
-
-{{range .Executables}}
-Package: {{$.ExeName .}}
-Conflicts: {{$.ExeConflicts .}}
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Built-Using: ${misc:Built-Using}
-Description: {{.Description}}
- {{.Description}}
-{{end}}
diff --git a/build/deb.copyright b/build/deb.copyright
deleted file mode 100644
index 513be45b19..0000000000
--- a/build/deb.copyright
+++ /dev/null
@@ -1,14 +0,0 @@
-Copyright 2016 The go-ethereum Authors
-
-go-ethereum is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-go-ethereum is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with go-ethereum. If not, see .
diff --git a/build/deb.docs b/build/deb.docs
deleted file mode 100644
index 62deb04972..0000000000
--- a/build/deb.docs
+++ /dev/null
@@ -1 +0,0 @@
-AUTHORS
diff --git a/build/deb.install b/build/deb.install
deleted file mode 100644
index 7dc76e1f56..0000000000
--- a/build/deb.install
+++ /dev/null
@@ -1 +0,0 @@
-build/bin/{{.Name}} usr/bin
diff --git a/build/deb.rules b/build/deb.rules
deleted file mode 100644
index 7f286569ea..0000000000
--- a/build/deb.rules
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-override_dh_auto_build:
- build/env.sh /usr/lib/go-1.10/bin/go run build/ci.go install -git-commit={{.Env.Commit}} -git-branch={{.Env.Branch}} -git-tag={{.Env.Tag}} -buildnum={{.Env.Buildnum}} -pull-request={{.Env.IsPullRequest}}
-
-override_dh_auto_test:
-
-%:
- dh $@
diff --git a/build/mvn.pom b/build/mvn.pom
deleted file mode 100644
index 7670246ba9..0000000000
--- a/build/mvn.pom
+++ /dev/null
@@ -1,57 +0,0 @@
-
- 4.0.0
-
- org.ethereum
- geth
- {{.Version}}
- aar
-
- Android Ethereum Client
- Android port of the go-ethereum libraries and node
- https://github.com/ethereum/go-ethereum
- 2015
-
-
-
- GNU Lesser General Public License, Version 3.0
- https://www.gnu.org/licenses/lgpl-3.0.en.html
- repo
-
-
-
-
- Ethereum
- https://ethereum.org
-
-
-
-
- karalabe
- Péter Szilágyi
- peterke@gmail.com
- https://github.com/karalabe
-
- https://www.gravatar.com/avatar/2ecbf0f5b4b79eebf8c193e5d324357f?s=256
-
-
-
-
- {{range .Contributors}}
-
- {{.Name}}
- {{.Email}}
- {{end}}
-
-
-
- GitHub Issues
- https://github.com/ethereum/go-ethereum/issues/
-
-
-
- https://github.com/ethereum/go-ethereum
-
-
diff --git a/build/mvn.settings b/build/mvn.settings
deleted file mode 100644
index 406b409b9b..0000000000
--- a/build/mvn.settings
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- ossrh
- ${env.ANDROID_SONATYPE_USERNAME}
- ${env.ANDROID_SONATYPE_PASSWORD}
-
-
-
-
- ossrh
-
- true
-
-
- gpg
-
-
-
-
-
diff --git a/build/nsis.envvarupdate.nsh b/build/nsis.envvarupdate.nsh
deleted file mode 100644
index 9c3ecbe337..0000000000
--- a/build/nsis.envvarupdate.nsh
+++ /dev/null
@@ -1,327 +0,0 @@
-/**
- * EnvVarUpdate.nsh
- * : Environmental Variables: append, prepend, and remove entries
- *
- * WARNING: If you use StrFunc.nsh header then include it before this file
- * with all required definitions. This is to avoid conflicts
- *
- * Usage:
- * ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
- *
- * Credits:
- * Version 1.0
- * * Cal Turney (turnec2)
- * * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
- * function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
- * WriteEnvStr, and un.DeleteEnvStr
- * * Diego Pedroso (deguix) for StrTok
- * * Kevin English (kenglish_hi) for StrContains
- * * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
- * (dandaman32) for StrReplace
- *
- * Version 1.1 (compatibility with StrFunc.nsh)
- * * techtonik
- *
- * http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
- *
- */
-
-
-!ifndef ENVVARUPDATE_FUNCTION
-!define ENVVARUPDATE_FUNCTION
-!verbose push
-!verbose 3
-!include "LogicLib.nsh"
-!include "WinMessages.NSH"
-!include "StrFunc.nsh"
-
-; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
-!macro _IncludeStrFunction StrFuncName
- !ifndef ${StrFuncName}_INCLUDED
- ${${StrFuncName}}
- !endif
- !ifndef Un${StrFuncName}_INCLUDED
- ${Un${StrFuncName}}
- !endif
- !define un.${StrFuncName} "${Un${StrFuncName}}"
-!macroend
-
-!insertmacro _IncludeStrFunction StrTok
-!insertmacro _IncludeStrFunction StrStr
-!insertmacro _IncludeStrFunction StrRep
-
-; ---------------------------------- Macro Definitions ----------------------------------------
-!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
- Push "${EnvVarName}"
- Push "${Action}"
- Push "${RegLoc}"
- Push "${PathString}"
- Call EnvVarUpdate
- Pop "${ResultVar}"
-!macroend
-!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
-
-!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
- Push "${EnvVarName}"
- Push "${Action}"
- Push "${RegLoc}"
- Push "${PathString}"
- Call un.EnvVarUpdate
- Pop "${ResultVar}"
-!macroend
-!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
-; ---------------------------------- Macro Definitions end-------------------------------------
-
-;----------------------------------- EnvVarUpdate start----------------------------------------
-!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-!define hkcu_current_user 'HKCU "Environment"'
-
-!macro EnvVarUpdate UN
-
-Function ${UN}EnvVarUpdate
-
- Push $0
- Exch 4
- Exch $1
- Exch 3
- Exch $2
- Exch 2
- Exch $3
- Exch
- Exch $4
- Push $5
- Push $6
- Push $7
- Push $8
- Push $9
- Push $R0
-
- /* After this point:
- -------------------------
- $0 = ResultVar (returned)
- $1 = EnvVarName (input)
- $2 = Action (input)
- $3 = RegLoc (input)
- $4 = PathString (input)
- $5 = Orig EnvVar (read from registry)
- $6 = Len of $0 (temp)
- $7 = tempstr1 (temp)
- $8 = Entry counter (temp)
- $9 = tempstr2 (temp)
- $R0 = tempChar (temp) */
-
- ; Step 1: Read contents of EnvVarName from RegLoc
- ;
- ; Check for empty EnvVarName
- ${If} $1 == ""
- SetErrors
- DetailPrint "ERROR: EnvVarName is blank"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Check for valid Action
- ${If} $2 != "A"
- ${AndIf} $2 != "P"
- ${AndIf} $2 != "R"
- SetErrors
- DetailPrint "ERROR: Invalid Action - must be A, P, or R"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ${If} $3 == HKLM
- ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
- ${ElseIf} $3 == HKCU
- ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
- ${Else}
- SetErrors
- DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Check for empty PathString
- ${If} $4 == ""
- SetErrors
- DetailPrint "ERROR: PathString is blank"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Make sure we've got some work to do
- ${If} $5 == ""
- ${AndIf} $2 == "R"
- SetErrors
- DetailPrint "$1 is empty - Nothing to remove"
- Goto EnvVarUpdate_Restore_Vars
- ${EndIf}
-
- ; Step 2: Scrub EnvVar
- ;
- StrCpy $0 $5 ; Copy the contents to $0
- ; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
- ; after the last one are not removed here but instead in Step 3)
- ${If} $0 != "" ; If EnvVar is not empty ...
- ${Do}
- ${${UN}StrStr} $7 $0 " ;"
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 " ;" ";" ; Remove ';'
- ${Loop}
- ${Do}
- ${${UN}StrStr} $7 $0 "; "
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 "; " ";" ; Remove ';'
- ${Loop}
- ${Do}
- ${${UN}StrStr} $7 $0 ";;"
- ${If} $7 == ""
- ${ExitDo}
- ${EndIf}
- ${${UN}StrRep} $0 $0 ";;" ";"
- ${Loop}
-
- ; Remove a leading or trailing semicolon from EnvVar
- StrCpy $7 $0 1 0
- ${If} $7 == ";"
- StrCpy $0 $0 "" 1 ; Change ';' to ''
- ${EndIf}
- StrLen $6 $0
- IntOp $6 $6 - 1
- StrCpy $7 $0 1 $6
- ${If} $7 == ";"
- StrCpy $0 $0 $6 ; Change ';' to ''
- ${EndIf}
- ; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
- ${EndIf}
-
- /* Step 3. Remove all instances of the target path/string (even if "A" or "P")
- $6 = bool flag (1 = found and removed PathString)
- $7 = a string (e.g. path) delimited by semicolon(s)
- $8 = entry counter starting at 0
- $9 = copy of $0
- $R0 = tempChar */
-
- ${If} $5 != "" ; If EnvVar is not empty ...
- StrCpy $9 $0
- StrCpy $0 ""
- StrCpy $8 0
- StrCpy $6 0
-
- ${Do}
- ${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
-
- ${If} $7 == "" ; If we've run out of entries,
- ${ExitDo} ; were done
- ${EndIf} ;
-
- ; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
- ${Do}
- StrCpy $R0 $7 1
- ${If} $R0 != " "
- ${ExitDo}
- ${EndIf}
- StrCpy $7 $7 "" 1 ; Remove leading space
- ${Loop}
- ${Do}
- StrCpy $R0 $7 1 -1
- ${If} $R0 != " "
- ${ExitDo}
- ${EndIf}
- StrCpy $7 $7 -1 ; Remove trailing space
- ${Loop}
- ${If} $7 == $4 ; If string matches, remove it by not appending it
- StrCpy $6 1 ; Set 'found' flag
- ${ElseIf} $7 != $4 ; If string does NOT match
- ${AndIf} $0 == "" ; and the 1st string being added to $0,
- StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
- ${ElseIf} $7 != $4 ; If string does NOT match
- ${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
- StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
- ${EndIf} ;
-
- IntOp $8 $8 + 1 ; Bump counter
- ${Loop} ; Check for duplicates until we run out of paths
- ${EndIf}
-
- ; Step 4: Perform the requested Action
- ;
- ${If} $2 != "R" ; If Append or Prepend
- ${If} $6 == 1 ; And if we found the target
- DetailPrint "Target is already present in $1. It will be removed and"
- ${EndIf}
- ${If} $0 == "" ; If EnvVar is (now) empty
- StrCpy $0 $4 ; just copy PathString to EnvVar
- ${If} $6 == 0 ; If found flag is either 0
- ${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
- DetailPrint "$1 was empty and has been updated with the target"
- ${EndIf}
- ${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
- StrCpy $0 $0;$4 ; append PathString
- ${If} $6 == 1
- DetailPrint "appended to $1"
- ${Else}
- DetailPrint "Target was appended to $1"
- ${EndIf}
- ${Else} ; If Prepend (and EnvVar is not empty),
- StrCpy $0 $4;$0 ; prepend PathString
- ${If} $6 == 1
- DetailPrint "prepended to $1"
- ${Else}
- DetailPrint "Target was prepended to $1"
- ${EndIf}
- ${EndIf}
- ${Else} ; If Action = Remove
- ${If} $6 == 1 ; and we found the target
- DetailPrint "Target was found and removed from $1"
- ${Else}
- DetailPrint "Target was NOT found in $1 (nothing to remove)"
- ${EndIf}
- ${If} $0 == ""
- DetailPrint "$1 is now empty"
- ${EndIf}
- ${EndIf}
-
- ; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
- ;
- ClearErrors
- ${If} $3 == HKLM
- WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
- ${ElseIf} $3 == HKCU
- WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
- ${EndIf}
-
- IfErrors 0 +4
- MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
- DetailPrint "Could not write updated $1 to $3"
- Goto EnvVarUpdate_Restore_Vars
-
- ; "Export" our change
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
- EnvVarUpdate_Restore_Vars:
- ;
- ; Restore the user's variables and return ResultVar
- Pop $R0
- Pop $9
- Pop $8
- Pop $7
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Push $0 ; Push my $0 (ResultVar)
- Exch
- Pop $0 ; Restore his $0
-
-FunctionEnd
-
-!macroend ; EnvVarUpdate UN
-!insertmacro EnvVarUpdate ""
-!insertmacro EnvVarUpdate "un."
-;----------------------------------- EnvVarUpdate end----------------------------------------
-
-!verbose pop
-!endif
\ No newline at end of file
diff --git a/build/nsis.geth.nsi b/build/nsis.geth.nsi
deleted file mode 100644
index 1034f30235..0000000000
--- a/build/nsis.geth.nsi
+++ /dev/null
@@ -1,70 +0,0 @@
-# Builds a Windows installer with NSIS.
-# It expects the following command line arguments:
-# - OUTPUTFILE, filename of the installer (without extension)
-# - MAJORVERSION, major build version
-# - MINORVERSION, minor build version
-# - BUILDVERSION, build id version
-#
-# The created installer executes the following steps:
-# 1. install geth for all users
-# 2. install optional development tools such as abigen
-# 3. create an uninstaller
-# 4. configures the Windows firewall for geth
-# 5. create geth, attach and uninstall start menu entries
-# 6. configures the registry that allows Windows to manage the package through its platform tools
-# 7. adds the environment system wide variable ETHEREUM_SOCKET
-# 8. adds the install directory to %PATH%
-#
-# Requirements:
-# - NSIS, http://nsis.sourceforge.net/Main_Page
-# - NSIS Large Strings build, http://nsis.sourceforge.net/Special_Builds
-# - SFP, http://nsis.sourceforge.net/NSIS_Simple_Firewall_Plugin (put dll in NSIS\Plugins\x86-ansi)
-#
-# After intalling NSIS extra the NSIS Large Strings build zip and replace the makensis.exe and the
-# files found in Stub.
-#
-# based on: http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
-#
-# TODO:
-# - sign installer
-CRCCheck on
-
-!define GROUPNAME "Ethereum"
-!define APPNAME "Geth"
-!define DESCRIPTION "Official Go implementation of the Ethereum protocol"
-!addplugindir .\
-
-# Require admin rights on NT6+ (When UAC is turned on)
-RequestExecutionLevel admin
-
-# Use LZMA compression
-SetCompressor /SOLID lzma
-
-!include LogicLib.nsh
-!include PathUpdate.nsh
-!include EnvVarUpdate.nsh
-
-!macro VerifyUserIsAdmin
-UserInfo::GetAccountType
-pop $0
-${If} $0 != "admin" # Require admin rights on NT4+
- messageBox mb_iconstop "Administrator rights required!"
- setErrorLevel 740 # ERROR_ELEVATION_REQUIRED
- quit
-${EndIf}
-!macroend
-
-function .onInit
- # make vars are global for all users since geth is installed global
- setShellVarContext all
- !insertmacro VerifyUserIsAdmin
-
- ${If} ${ARCH} == "amd64"
- StrCpy $InstDir "$PROGRAMFILES64\${APPNAME}"
- ${Else}
- StrCpy $InstDir "$PROGRAMFILES32\${APPNAME}"
- ${Endif}
-functionEnd
-
-!include install.nsh
-!include uninstall.nsh
diff --git a/build/nsis.install.nsh b/build/nsis.install.nsh
deleted file mode 100644
index 57ef5a37c6..0000000000
--- a/build/nsis.install.nsh
+++ /dev/null
@@ -1,103 +0,0 @@
-Name "geth ${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}" # VERSION variables set through command line arguments
-InstallDir "$InstDir"
-OutFile "${OUTPUTFILE}" # set through command line arguments
-
-# Links for "Add/Remove Programs"
-!define HELPURL "https://github.com/ethereum/go-ethereum/issues"
-!define UPDATEURL "https://github.com/ethereum/go-ethereum/releases"
-!define ABOUTURL "https://github.com/ethereum/go-ethereum#ethereum-go"
-!define /date NOW "%Y%m%d"
-
-PageEx license
- LicenseData {{.License}}
-PageExEnd
-
-# Install geth binary
-Section "Geth" GETH_IDX
- SetOutPath $INSTDIR
- file {{.Geth}}
-
- # Create start menu launcher
- createDirectory "$SMPROGRAMS\${APPNAME}"
- createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\geth.exe" "--fast" "--cache=512"
- createShortCut "$SMPROGRAMS\${APPNAME}\Attach.lnk" "$INSTDIR\geth.exe" "attach" "" ""
- createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" ""
-
- # Firewall - remove rules (if exists)
- SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:30303)"
-
- # Firewall - add rules
- SimpleFC::AdvAddRule "Geth incoming peers (TCP:30303)" "" 6 1 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" 30303 "" "" ""
- SimpleFC::AdvAddRule "Geth outgoing peers (TCP:30303)" "" 6 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
- SimpleFC::AdvAddRule "Geth UDP discovery (UDP:30303)" "" 17 2 1 2147483647 1 "$INSTDIR\geth.exe" "" "" "Ethereum" "" 30303 "" ""
-
- # Set default IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
- ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
- ${EnvVarUpdate} $0 "ETHEREUM_SOCKET" "A" "HKLM" "\\.\pipe\geth.ipc"
-
- # Add instdir to PATH
- Push "$INSTDIR"
- Call AddToPath
-SectionEnd
-
-# Install optional develop tools.
-Section /o "Development tools" DEV_TOOLS_IDX
- SetOutPath $INSTDIR
- {{range .DevTools}}file {{.}}
- {{end}}
-SectionEnd
-
-# Return on top of stack the total size (as DWORD) of the selected/installed sections.
-Var GetInstalledSize.total
-Function GetInstalledSize
- StrCpy $GetInstalledSize.total 0
-
- ${if} ${SectionIsSelected} ${GETH_IDX}
- SectionGetSize ${GETH_IDX} $0
- IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
- ${endif}
-
- ${if} ${SectionIsSelected} ${DEV_TOOLS_IDX}
- SectionGetSize ${DEV_TOOLS_IDX} $0
- IntOp $GetInstalledSize.total $GetInstalledSize.total + $0
- ${endif}
-
- IntFmt $GetInstalledSize.total "0x%08X" $GetInstalledSize.total
- Push $GetInstalledSize.total
-FunctionEnd
-
-# Write registry, Windows uses these values in various tools such as add/remove program.
-# PowerShell: Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, InstallLocation, InstallDate | Format-Table –AutoSize
-function .onInstSuccess
- # Save information in registry in HKEY_LOCAL_MACHINE branch, Windows add/remove functionality depends on this
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayName" "${GROUPNAME} - ${APPNAME} - ${DESCRIPTION}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallLocation" "$INSTDIR"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "InstallDate" "${NOW}"
- # Wait for Alex
- #WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\logo.ico$\""
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "Publisher" "${GROUPNAME}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "HelpLink" "${HELPURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLUpdateInfo" "${UPDATEURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "URLInfoAbout" "${ABOUTURL}"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "DisplayVersion" "${MAJORVERSION}.${MINORVERSION}.${BUILDVERSION}"
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMajor" ${MAJORVERSION}
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "VersionMinor" ${MINORVERSION}
- # There is no option for modifying or repairing the install
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoModify" 1
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "NoRepair" 1
-
- Call GetInstalledSize
- Pop $0
- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}" "EstimatedSize" "$0"
-
- # Create uninstaller
- writeUninstaller "$INSTDIR\uninstall.exe"
-functionEnd
-
-Page components
-Page directory
-Page instfiles
diff --git a/build/nsis.pathupdate.nsh b/build/nsis.pathupdate.nsh
deleted file mode 100644
index f54b7e3e13..0000000000
--- a/build/nsis.pathupdate.nsh
+++ /dev/null
@@ -1,153 +0,0 @@
-!include "WinMessages.nsh"
-
-; see https://support.microsoft.com/en-us/kb/104011
-!define Environ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-; HKEY_LOCAL_MACHINE = 0x80000002
-
-; AddToPath - Appends dir to PATH
-; (does not work on Win9x/ME)
-;
-; Usage:
-; Push "dir"
-; Call AddToPath
-Function AddToPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
-
- ; NSIS ReadRegStr returns empty string on string overflow
- ; Native calls are used here to check actual length of PATH
- ; $4 = RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", &$3)
- System::Call "advapi32::RegOpenKey(i 0x80000002, t'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', *i.r3) i.r4"
- IntCmp $4 0 0 done done
-
- ; $4 = RegQueryValueEx($3, "PATH", (DWORD*)0, (DWORD*)0, &$1, ($2=NSIS_MAX_STRLEN, &$2))
- ; RegCloseKey($3)
- System::Call "advapi32::RegQueryValueEx(i $3, t'PATH', i 0, i 0, t.r1, *i ${NSIS_MAX_STRLEN} r2) i.r4"
- System::Call "advapi32::RegCloseKey(i $3)"
-
- IntCmp $4 234 0 +4 +4 ; $4 == ERROR_MORE_DATA
- DetailPrint "AddToPath: original length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, original length $2 > ${NSIS_MAX_STRLEN}"
- Goto done
-
- IntCmp $4 0 +5 ; $4 != NO_ERROR
- IntCmp $4 2 +3 ; $4 != ERROR_FILE_NOT_FOUND
- DetailPrint "AddToPath: unexpected error code $4"
- Goto done
- StrCpy $1 ""
-
- ; Check if already in PATH
- Push "$1;"
- Push "$0;"
- Call StrStr
- Pop $2
- StrCmp $2 "" 0 done
- Push "$1;"
- Push "$0\;"
- Call StrStr
- Pop $2
- StrCmp $2 "" 0 done
-
- ; Prevent NSIS string overflow
- StrLen $2 $0
- StrLen $3 $1
- IntOp $2 $2 + $3
- IntOp $2 $2 + 2 ; $2 = strlen(dir) + strlen(PATH) + sizeof(";")
- IntCmp $2 ${NSIS_MAX_STRLEN} +4 +4 0
- DetailPrint "AddToPath: new length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, new length $2 > ${NSIS_MAX_STRLEN}."
- Goto done
-
- ; Append dir to PATH
- DetailPrint "Add to PATH: $0"
- StrCpy $2 $1 1 -1
- StrCmp $2 ";" 0 +2
- StrCpy $1 $1 -1 ; remove trailing ';'
- StrCmp $1 "" +2 ; no leading ';'
- StrCpy $0 "$1;$0"
-
- WriteRegExpandStr ${Environ} "PATH" $0
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
-done:
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-
-; RemoveFromPath - Removes dir from PATH
-;
-; Usage:
-; Push "dir"
-; Call RemoveFromPath
-Function un.RemoveFromPath
- Exch $0
- Push $1
- Push $2
- Push $3
- Push $4
- Push $5
- Push $6
-
- ; NSIS ReadRegStr returns empty string on string overflow
- ; Native calls are used here to check actual length of PATH
- ; $4 = RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment", &$3)
- System::Call "advapi32::RegOpenKey(i 0x80000002, t'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', *i.r3) i.r4"
- IntCmp $4 0 0 done done
-
- ; $4 = RegQueryValueEx($3, "PATH", (DWORD*)0, (DWORD*)0, &$1, ($2=NSIS_MAX_STRLEN, &$2))
- ; RegCloseKey($3)
- System::Call "advapi32::RegQueryValueEx(i $3, t'PATH', i 0, i 0, t.r1, *i ${NSIS_MAX_STRLEN} r2) i.r4"
- System::Call "advapi32::RegCloseKey(i $3)"
-
- IntCmp $4 234 0 +4 +4 ; $4 == ERROR_MORE_DATA
- DetailPrint "RemoveFromPath: original length $2 > ${NSIS_MAX_STRLEN}"
- MessageBox MB_OK "PATH not updated, original length $2 > ${NSIS_MAX_STRLEN}"
- Goto done
-
- IntCmp $4 0 +5 ; $4 != NO_ERROR
- IntCmp $4 2 +3 ; $4 != ERROR_FILE_NOT_FOUND
- DetailPrint "RemoveFromPath: unexpected error code $4"
- Goto done
- StrCpy $1 ""
-
- ; length < ${NSIS_MAX_STRLEN} -> ReadRegStr can be used
- ReadRegStr $1 ${Environ} "PATH"
- StrCpy $5 $1 1 -1
- StrCmp $5 ";" +2
- StrCpy $1 "$1;" ; ensure trailing ';'
- Push $1
- Push "$0;"
- Call un.StrStr
- Pop $2 ; pos of our dir
- StrCmp $2 "" done
-
- DetailPrint "Remove from PATH: $0"
- StrLen $3 "$0;"
- StrLen $4 $2
- StrCpy $5 $1 -$4 ; $5 is now the part before the path to remove
- StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
- StrCpy $3 "$5$6"
- StrCpy $5 $3 1 -1
- StrCmp $5 ";" 0 +2
- StrCpy $3 $3 -1 ; remove trailing ';'
- WriteRegExpandStr ${Environ} "PATH" $3
- SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
-
-done:
- Pop $6
- Pop $5
- Pop $4
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
-
-
diff --git a/build/nsis.simplefc.dll b/build/nsis.simplefc.dll
deleted file mode 100644
index 73b7d9634d..0000000000
Binary files a/build/nsis.simplefc.dll and /dev/null differ
diff --git a/build/nsis.simplefc.source.zip b/build/nsis.simplefc.source.zip
deleted file mode 100644
index d7476022ad..0000000000
Binary files a/build/nsis.simplefc.source.zip and /dev/null differ
diff --git a/build/nsis.uninstall.nsh b/build/nsis.uninstall.nsh
deleted file mode 100644
index 6358faa74e..0000000000
--- a/build/nsis.uninstall.nsh
+++ /dev/null
@@ -1,33 +0,0 @@
-Section "Uninstall"
- # uninstall for all users
- setShellVarContext all
-
- # Delete (optionally) installed files
- {{range $}}Delete $INSTDIR\{{.}}
- {{end}}
- Delete $INSTDIR\uninstall.exe
-
- # Delete install directory
- rmDir $INSTDIR
-
- # Delete start menu launcher
- Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
- Delete "$SMPROGRAMS\${APPNAME}\Attach.lnk"
- Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
- rmDir "$SMPROGRAMS\${APPNAME}"
-
- # Firewall - remove rules if exists
- SimpleFC::AdvRemoveRule "Geth incoming peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth outgoing peers (TCP:30303)"
- SimpleFC::AdvRemoveRule "Geth UDP discovery (UDP:30303)"
-
- # Remove IPC endpoint (https://github.com/ethereum/EIPs/issues/147)
- ${un.EnvVarUpdate} $0 "ETHEREUM_SOCKET" "R" "HKLM" "\\.\pipe\geth.ipc"
-
- # Remove install directory from PATH
- Push "$INSTDIR"
- Call un.RemoveFromPath
-
- # Cleanup registry (deletes all sub keys)
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GROUPNAME} ${APPNAME}"
-SectionEnd
diff --git a/build/pod.podspec b/build/pod.podspec
deleted file mode 100644
index 2c14c280c7..0000000000
--- a/build/pod.podspec
+++ /dev/null
@@ -1,22 +0,0 @@
-Pod::Spec.new do |spec|
- spec.name = 'Geth'
- spec.version = '{{.Version}}'
- spec.license = { :type => 'GNU Lesser General Public License, Version 3.0' }
- spec.homepage = 'https://github.com/ethereum/go-ethereum'
- spec.authors = { {{range .Contributors}}
- '{{.Name}}' => '{{.Email}}',{{end}}
- }
- spec.summary = 'iOS Ethereum Client'
- spec.source = { :git => 'https://github.com/ethereum/go-ethereum.git', :commit => '{{.Commit}}' }
-
- spec.platform = :ios
- spec.ios.deployment_target = '9.0'
- spec.ios.vendored_frameworks = 'Frameworks/Geth.framework'
-
- spec.prepare_command = <<-CMD
- curl https://gethstore.blob.core.windows.net/builds/{{.Archive}}.tar.gz | tar -xvz
- mkdir Frameworks
- mv {{.Archive}}/Geth.framework Frameworks
- rm -rf {{.Archive}}
- CMD
-end
diff --git a/build/update-license.go b/build/update-license.go
deleted file mode 100644
index 22e4033428..0000000000
--- a/build/update-license.go
+++ /dev/null
@@ -1,395 +0,0 @@
-// +build none
-
-/*
-This command generates GPL license headers on top of all source files.
-You can run it once per month, before cutting a release or just
-whenever you feel like it.
-
- go run update-license.go
-
-All authors (people who have contributed code) are listed in the
-AUTHORS file. The author names are mapped and deduplicated using the
-.mailmap file. You can use .mailmap to set the canonical name and
-address for each author. See git-shortlog(1) for an explanation of the
-.mailmap format.
-
-Please review the resulting diff to check whether the correct
-copyright assignments are performed.
-*/
-
-package main
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io/ioutil"
- "log"
- "os"
- "os/exec"
- "path/filepath"
- "regexp"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "sync"
- "text/template"
- "time"
-)
-
-var (
- // only files with these extensions will be considered
- extensions = []string{".go", ".js", ".qml"}
-
- // paths with any of these prefixes will be skipped
- skipPrefixes = []string{
- // boring stuff
- "vendor/", "tests/testdata/", "build/",
- // don't relicense vendored sources
- "cmd/internal/browser",
- "consensus/ethash/xor.go",
- "crypto/bn256/",
- "crypto/ecies/",
- "crypto/secp256k1/curve.go",
- "crypto/sha3/",
- "internal/jsre/deps",
- "log/",
- "common/bitutil/bitutil",
- // don't license generated files
- "contracts/chequebook/contract/code.go",
- }
-
- // paths with this prefix are licensed as GPL. all other files are LGPL.
- gplPrefixes = []string{"cmd/"}
-
- // this regexp must match the entire license comment at the
- // beginning of each file.
- licenseCommentRE = regexp.MustCompile(`^//\s*(Copyright|This file is part of).*?\n(?://.*?\n)*\n*`)
-
- // this text appears at the start of AUTHORS
- authorsFileHeader = "# This is the official list of go-ethereum authors for copyright purposes.\n\n"
-)
-
-// this template generates the license comment.
-// its input is an info structure.
-var licenseT = template.Must(template.New("").Parse(`
-// Copyright {{.Year}} The go-ethereum Authors
-// This file is part of {{.Whole false}}.
-//
-// {{.Whole true}} is free software: you can redistribute it and/or modify
-// it under the terms of the GNU {{.License}} as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// {{.Whole true}} is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU {{.License}} for more details.
-//
-// You should have received a copy of the GNU {{.License}}
-// along with {{.Whole false}}. If not, see .
-
-`[1:]))
-
-type info struct {
- file string
- Year int64
-}
-
-func (i info) License() string {
- if i.gpl() {
- return "General Public License"
- }
- return "Lesser General Public License"
-}
-
-func (i info) ShortLicense() string {
- if i.gpl() {
- return "GPL"
- }
- return "LGPL"
-}
-
-func (i info) Whole(startOfSentence bool) string {
- if i.gpl() {
- return "go-ethereum"
- }
- if startOfSentence {
- return "The go-ethereum library"
- }
- return "the go-ethereum library"
-}
-
-func (i info) gpl() bool {
- for _, p := range gplPrefixes {
- if strings.HasPrefix(i.file, p) {
- return true
- }
- }
- return false
-}
-
-func main() {
- var (
- files = getFiles()
- filec = make(chan string)
- infoc = make(chan *info, 20)
- wg sync.WaitGroup
- )
-
- writeAuthors(files)
-
- go func() {
- for _, f := range files {
- filec <- f
- }
- close(filec)
- }()
- for i := runtime.NumCPU(); i >= 0; i-- {
- // getting file info is slow and needs to be parallel.
- // it traverses git history for each file.
- wg.Add(1)
- go getInfo(filec, infoc, &wg)
- }
- go func() {
- wg.Wait()
- close(infoc)
- }()
- writeLicenses(infoc)
-}
-
-func skipFile(path string) bool {
- if strings.Contains(path, "/testdata/") {
- return true
- }
- for _, p := range skipPrefixes {
- if strings.HasPrefix(path, p) {
- return true
- }
- }
- return false
-}
-
-func getFiles() []string {
- cmd := exec.Command("git", "ls-tree", "-r", "--name-only", "HEAD")
- var files []string
- err := doLines(cmd, func(line string) {
- if skipFile(line) {
- return
- }
- ext := filepath.Ext(line)
- for _, wantExt := range extensions {
- if ext == wantExt {
- goto keep
- }
- }
- return
- keep:
- files = append(files, line)
- })
- if err != nil {
- log.Fatal("error getting files:", err)
- }
- return files
-}
-
-var authorRegexp = regexp.MustCompile(`\s*[0-9]+\s*(.*)`)
-
-func gitAuthors(files []string) []string {
- cmds := []string{"shortlog", "-s", "-n", "-e", "HEAD", "--"}
- cmds = append(cmds, files...)
- cmd := exec.Command("git", cmds...)
- var authors []string
- err := doLines(cmd, func(line string) {
- m := authorRegexp.FindStringSubmatch(line)
- if len(m) > 1 {
- authors = append(authors, m[1])
- }
- })
- if err != nil {
- log.Fatalln("error getting authors:", err)
- }
- return authors
-}
-
-func readAuthors() []string {
- content, err := ioutil.ReadFile("AUTHORS")
- if err != nil && !os.IsNotExist(err) {
- log.Fatalln("error reading AUTHORS:", err)
- }
- var authors []string
- for _, a := range bytes.Split(content, []byte("\n")) {
- if len(a) > 0 && a[0] != '#' {
- authors = append(authors, string(a))
- }
- }
- // Retranslate existing authors through .mailmap.
- // This should catch email address changes.
- authors = mailmapLookup(authors)
- return authors
-}
-
-func mailmapLookup(authors []string) []string {
- if len(authors) == 0 {
- return nil
- }
- cmds := []string{"check-mailmap", "--"}
- cmds = append(cmds, authors...)
- cmd := exec.Command("git", cmds...)
- var translated []string
- err := doLines(cmd, func(line string) {
- translated = append(translated, line)
- })
- if err != nil {
- log.Fatalln("error translating authors:", err)
- }
- return translated
-}
-
-func writeAuthors(files []string) {
- merge := make(map[string]bool)
- // Add authors that Git reports as contributorxs.
- // This is the primary source of author information.
- for _, a := range gitAuthors(files) {
- merge[a] = true
- }
- // Add existing authors from the file. This should ensure that we
- // never lose authors, even if Git stops listing them. We can also
- // add authors manually this way.
- for _, a := range readAuthors() {
- merge[a] = true
- }
- // Write sorted list of authors back to the file.
- var result []string
- for a := range merge {
- result = append(result, a)
- }
- sort.Strings(result)
- content := new(bytes.Buffer)
- content.WriteString(authorsFileHeader)
- for _, a := range result {
- content.WriteString(a)
- content.WriteString("\n")
- }
- fmt.Println("writing AUTHORS")
- if err := ioutil.WriteFile("AUTHORS", content.Bytes(), 0644); err != nil {
- log.Fatalln(err)
- }
-}
-
-func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) {
- for file := range files {
- stat, err := os.Lstat(file)
- if err != nil {
- fmt.Printf("ERROR %s: %v\n", file, err)
- continue
- }
- if !stat.Mode().IsRegular() {
- continue
- }
- if isGenerated(file) {
- continue
- }
- info, err := fileInfo(file)
- if err != nil {
- fmt.Printf("ERROR %s: %v\n", file, err)
- continue
- }
- out <- info
- }
- wg.Done()
-}
-
-func isGenerated(file string) bool {
- fd, err := os.Open(file)
- if err != nil {
- return false
- }
- defer fd.Close()
- buf := make([]byte, 2048)
- n, _ := fd.Read(buf)
- buf = buf[:n]
- for _, l := range bytes.Split(buf, []byte("\n")) {
- if bytes.HasPrefix(l, []byte("// Code generated")) {
- return true
- }
- }
- return false
-}
-
-// fileInfo finds the lowest year in which the given file was committed.
-func fileInfo(file string) (*info, error) {
- info := &info{file: file, Year: int64(time.Now().Year())}
- cmd := exec.Command("git", "log", "--follow", "--find-renames=80", "--find-copies=80", "--pretty=format:%ai", "--", file)
- err := doLines(cmd, func(line string) {
- y, err := strconv.ParseInt(line[:4], 10, 64)
- if err != nil {
- fmt.Printf("cannot parse year: %q", line[:4])
- }
- if y < info.Year {
- info.Year = y
- }
- })
- return info, err
-}
-
-func writeLicenses(infos <-chan *info) {
- for i := range infos {
- writeLicense(i)
- }
-}
-
-func writeLicense(info *info) {
- fi, err := os.Stat(info.file)
- if os.IsNotExist(err) {
- fmt.Println("skipping (does not exist)", info.file)
- return
- }
- if err != nil {
- log.Fatalf("error stat'ing %s: %v\n", info.file, err)
- }
- content, err := ioutil.ReadFile(info.file)
- if err != nil {
- log.Fatalf("error reading %s: %v\n", info.file, err)
- }
- // Construct new file content.
- buf := new(bytes.Buffer)
- licenseT.Execute(buf, info)
- if m := licenseCommentRE.FindIndex(content); m != nil && m[0] == 0 {
- buf.Write(content[:m[0]])
- buf.Write(content[m[1]:])
- } else {
- buf.Write(content)
- }
- // Write it to the file.
- if bytes.Equal(content, buf.Bytes()) {
- fmt.Println("skipping (no changes)", info.file)
- return
- }
- fmt.Println("writing", info.ShortLicense(), info.file)
- if err := ioutil.WriteFile(info.file, buf.Bytes(), fi.Mode()); err != nil {
- log.Fatalf("error writing %s: %v", info.file, err)
- }
-}
-
-func doLines(cmd *exec.Cmd, f func(string)) error {
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- return err
- }
- if err := cmd.Start(); err != nil {
- return err
- }
- s := bufio.NewScanner(stdout)
- for s.Scan() {
- f(s.Text())
- }
- if s.Err() != nil {
- return s.Err()
- }
- if err := cmd.Wait(); err != nil {
- return fmt.Errorf("%v (for %s)", err, strings.Join(cmd.Args, " "))
- }
- return nil
-}