mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
build: add windows installer/uninstaller
This commit is contained in:
parent
a6bf8cd9cc
commit
abdee9d455
3 changed files with 46 additions and 34 deletions
71
build/ci.go
71
build/ci.go
|
|
@ -69,6 +69,8 @@ var (
|
||||||
executablePath("evm"),
|
executablePath("evm"),
|
||||||
executablePath("geth"),
|
executablePath("geth"),
|
||||||
executablePath("rlpdump"),
|
executablePath("rlpdump"),
|
||||||
|
executablePath("disasm"),
|
||||||
|
executablePath("bootnode"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// A debian package is created for all executables listed here.
|
// A debian package is created for all executables listed here.
|
||||||
|
|
@ -577,49 +579,60 @@ func doWindowsInstaller(cmdline []string) {
|
||||||
env := build.Env()
|
env := build.Env()
|
||||||
maybeSkipArchive(env)
|
maybeSkipArchive(env)
|
||||||
|
|
||||||
|
defer os.RemoveAll(*workdir)
|
||||||
|
|
||||||
// Configure and run the NSIS installer maker. This assumes that all the needed
|
// Configure and run the NSIS installer maker. This assumes that all the needed
|
||||||
// files have been previously built (don't mix building and packaging to keep
|
// files have been previously built (don't mix building and packaging to keep
|
||||||
// cross compilation complexity to a minimum).
|
// cross compilation complexity to a minimum).
|
||||||
var (
|
var (
|
||||||
base = archiveBasename(*arch, env)
|
base = archiveBasename(*arch, env)
|
||||||
version = strings.Split(build.VERSION(), ".")
|
installerName = "geth-" + base
|
||||||
|
installFilename = "/DOUTPUTFILE=" + installerName
|
||||||
|
|
||||||
|
version = strings.Split(build.VERSION(), ".")
|
||||||
majorVersion = "/DMAJORVERSION=" + version[0]
|
majorVersion = "/DMAJORVERSION=" + version[0]
|
||||||
minorVersion = "/DMINORVERSION=" + version[1]
|
minorVersion = "/DMINORVERSION=" + version[1]
|
||||||
buildId = "/DBUILDVERSION=" + version[2]
|
buildId = "/DBUILDVERSION=" + version[2]
|
||||||
buildArch = "/DARCH=" + *arch
|
buildArch = "/DARCH=" + *arch
|
||||||
)
|
)
|
||||||
bundles := []struct {
|
// Aggregate binaries that are included in the installer
|
||||||
name string
|
var (
|
||||||
content []string
|
devTools []string
|
||||||
}{
|
allTools []string
|
||||||
{"geth-" + base, gethArchiveFiles},
|
gethTool string
|
||||||
{"geth-alltools-" + base, allToolsArchiveFiles},
|
)
|
||||||
|
for _, file := range allToolsArchiveFiles {
|
||||||
|
if file == "COPYING" { // license, copied later
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
allTools = append(allTools, filepath.Base(file))
|
||||||
|
if filepath.Base(file) == "geth.exe" {
|
||||||
|
gethTool = file
|
||||||
|
} else {
|
||||||
|
devTools = append(devTools, file)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, bundle := range bundles {
|
// Render NSIS scripts: Installer NSIS contains two installer sections,
|
||||||
// Run NSIS for this specific bundle
|
// first section contains the geth binary, second section holds the dev tools.
|
||||||
outputFile := "/DOUTPUTFILE=" + bundle.name
|
installer := map[string]interface{}{
|
||||||
|
"License": "COPYING",
|
||||||
|
"Geth": gethTool,
|
||||||
|
"DevTools": devTools,
|
||||||
|
}
|
||||||
|
build.Render("build/nsis.geth.nsi", filepath.Join(*workdir, "geth.nsi"), 0644, nil)
|
||||||
|
build.Render("build/nsis.install.nsh", filepath.Join(*workdir, "install.nsh"), 0644, installer)
|
||||||
|
build.Render("build/nsis.uninstall.nsh", filepath.Join(*workdir, "uninstall.nsh"), 0644, allTools)
|
||||||
|
build.Render("build/nsis.envvarupdate.nsh", filepath.Join(*workdir, "EnvVarUpdate.nsh"), 0644, nil)
|
||||||
|
|
||||||
tools := []string{}
|
build.CopyFile(filepath.Join(*workdir, "SimpleFC.dll"), "build/nsis.simplefc.dll", 0755)
|
||||||
for _, file := range bundle.content {
|
build.CopyFile(filepath.Join(*workdir, "COPYING"), "COPYING", 0755)
|
||||||
name := filepath.Base(file)
|
|
||||||
if name != "geth.exe" && name != "COPYING" {
|
|
||||||
tools = append(tools, name)
|
|
||||||
}
|
|
||||||
build.CopyFile(filepath.Join(*workdir, name), file, 0755)
|
|
||||||
}
|
|
||||||
build.Render("build/nsis.geth.nsi", filepath.Join(*workdir, "geth.nsi"), 0644, nil)
|
|
||||||
build.Render("build/nsis.install.nsh", filepath.Join(*workdir, "install.nsh"), 0644, tools)
|
|
||||||
build.Render("build/nsis.uninstall.nsh", filepath.Join(*workdir, "uninstall.nsh"), 0644, tools)
|
|
||||||
build.Render("build/nsis.envvarupdate.nsh", filepath.Join(*workdir, "EnvVarUpdate.nsh"), 0644, nil)
|
|
||||||
|
|
||||||
build.CopyFile(filepath.Join(*workdir, "SimpleFC.dll"), "build/nsis.simplefc.dll", 0755)
|
makensis := exec.Command("makensis.exe", installFilename, majorVersion, minorVersion, buildId, buildArch, filepath.Join(*workdir, "geth.nsi"))
|
||||||
makensis := exec.Command("makensis.exe", outputFile, majorVersion, minorVersion, buildId, buildArch, filepath.Join(*workdir, "geth.nsi"))
|
build.MustRun(makensis)
|
||||||
build.MustRun(makensis)
|
|
||||||
|
|
||||||
if err := archiveUpload(filepath.Join(*workdir, bundle.name+".exe"), *upload, *signer); err != nil {
|
// Sign and publish installer.
|
||||||
log.Fatal(err)
|
if err := archiveUpload(filepath.Join(*workdir, installerName+".exe"), *upload, *signer); err != nil {
|
||||||
}
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ OutFile "${OUTPUTFILE}.exe" # OUTPUTFILE set through command line arguments
|
||||||
!define /date NOW "%Y%m%d"
|
!define /date NOW "%Y%m%d"
|
||||||
|
|
||||||
PageEx license
|
PageEx license
|
||||||
LicenseData COPYING
|
LicenseData {{.License}}
|
||||||
PageExEnd
|
PageExEnd
|
||||||
|
|
||||||
# Install geth binary
|
# Install geth binary
|
||||||
Section "Geth" GETH_IDX
|
Section "Geth" GETH_IDX
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
file geth.exe
|
file {{.Geth}}
|
||||||
|
|
||||||
# Create start menu launcher
|
# Create start menu launcher
|
||||||
createDirectory "$SMPROGRAMS\${APPNAME}"
|
createDirectory "$SMPROGRAMS\${APPNAME}"
|
||||||
|
|
@ -44,7 +44,7 @@ SectionEnd
|
||||||
# Install optional develop tools.
|
# Install optional develop tools.
|
||||||
Section /o "Development tools" DEV_TOOLS_IDX
|
Section /o "Development tools" DEV_TOOLS_IDX
|
||||||
SetOutPath $INSTDIR
|
SetOutPath $INSTDIR
|
||||||
{{range $}}file {{$}}
|
{{range .DevTools}}file {{.}}
|
||||||
{{end}}
|
{{end}}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ Section "Uninstall"
|
||||||
setShellVarContext all
|
setShellVarContext all
|
||||||
|
|
||||||
# Delete (optionally) installed files
|
# Delete (optionally) installed files
|
||||||
{{range $}}Delete $INSTDIR\{{$}}
|
{{range $}}Delete $INSTDIR\{{.}}
|
||||||
{{end}}
|
{{end}}
|
||||||
Delete $INSTDIR\geth.exe
|
|
||||||
Delete $INSTDIR\uninstall.exe
|
Delete $INSTDIR\uninstall.exe
|
||||||
|
|
||||||
# Delete install directory
|
# Delete install directory
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue