mirror of
https://github.com/golang/go
synced 2024-11-22 01:34:41 -07:00
misc/windows packager development intermediate check-in
The installer now: allows a user to select an alternative install directory, it now adds a Go folder to the Programs Menu, and it places two shortcuts on the user's desktop. The Program Menu folder contains shortcuts to the uninstaller and two batch files, go.bat and godoc.bat. The desktop shortcuts also point to go.bat and godoc.bat. go.bat sets the Go environment, including Path, and spawns a Window's shell. godoc.bat starts the godoc server at localhost:6060 then spawns a browser window pointing to the document server. Setting the environment temporarily and spawning a shell, via go.bat, should be safer than messing with the system's environment and it makes the user experience a bit more streamlined. The packager does work in its current state but it still needs some polishing. And yes, the plan is to add a dialogue to allow the user to decline the desktop shortcuts. R=rsc, alex.brainman, tjyang2001 CC=golang-dev https://golang.org/cl/5399042
This commit is contained in:
parent
ac17fd4cd2
commit
984b4e381d
BIN
misc/windows/LICENSE
Normal file
BIN
misc/windows/LICENSE
Normal file
Binary file not shown.
14
misc/windows/godocserver.bat
Normal file
14
misc/windows/godocserver.bat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
for /f "delims=" %%i in ('cd') do set cwd=%%i
|
||||||
|
|
||||||
|
if exist bin\godoc.exe goto ok
|
||||||
|
echo Unable to find the godoc executable
|
||||||
|
echo This batch file must run from the root Go folder
|
||||||
|
pause
|
||||||
|
exit
|
||||||
|
|
||||||
|
:ok
|
||||||
|
start bin\godoc -http=localhost:6060 -goroot="%cwd%"
|
||||||
|
start http://localhost:6060
|
||||||
|
endlocal
|
29
misc/windows/goenv.bat
Normal file
29
misc/windows/goenv.bat
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
for /f %%i in ("%0") do set cwd=%%~dpi
|
||||||
|
cd /d %cwd%
|
||||||
|
|
||||||
|
:: sanity checks
|
||||||
|
if exist "%cwd%"\bin\6g.exe (
|
||||||
|
set GOARCH=amd64
|
||||||
|
goto ok
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%cwd%"\bin\8g.exe (
|
||||||
|
set GOARCH=386
|
||||||
|
goto ok
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Unable to find the Go compiler
|
||||||
|
echo This batch file must run from the root Go folder
|
||||||
|
pause
|
||||||
|
exit
|
||||||
|
|
||||||
|
:ok
|
||||||
|
set GOROOT=%cwd%
|
||||||
|
set GOBIN=%GOROOT%\bin
|
||||||
|
set PATH=%GOBIN%;%PATH%
|
||||||
|
|
||||||
|
@CMD /F:ON
|
||||||
|
endlocal
|
||||||
|
|
@ -1,12 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
<!--
|
<!--
|
||||||
# Copyright 2010 The Go Authors. All rights reserved.
|
# Copyright 2010 The Go Authors. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style
|
# Use of this source code is governed by a BSD-style
|
||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
-->
|
-->
|
||||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
|
||||||
|
|
||||||
<Product Id="FF5B30B2-08C2-11E1-85A2-6ACA4824019B"
|
<?if $(var.Arch) = 386 ?>
|
||||||
|
<?define SYSFOLDER=SystemFolder ?>
|
||||||
|
<?define Win64=no ?>
|
||||||
|
<?else?>
|
||||||
|
<?define SYSFOLDER=System64Folder ?>
|
||||||
|
<?define Win64=yes ?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
<Product
|
||||||
|
Id="FF5B30B2-08C2-11E1-85A2-6ACA4824019B"
|
||||||
Name="The Go Programming Language $(var.Arch) $(var.Version)"
|
Name="The Go Programming Language $(var.Arch) $(var.Version)"
|
||||||
Language="1033"
|
Language="1033"
|
||||||
Version="0.0.0.0"
|
Version="0.0.0.0"
|
||||||
@ -14,67 +23,130 @@
|
|||||||
UpgradeCode="1C3114EA-08C3-11E1-9095-7FCA4824019B" >
|
UpgradeCode="1C3114EA-08C3-11E1-9095-7FCA4824019B" >
|
||||||
<!-- Version="$(var.Version)" TODO: Version requires X.X.X.X format -->
|
<!-- Version="$(var.Version)" TODO: Version requires X.X.X.X format -->
|
||||||
|
|
||||||
<Package Id='*' Keywords='Installer'
|
<Package
|
||||||
|
Id='*' Keywords='Installer'
|
||||||
Description="The Go Programming Language Installer"
|
Description="The Go Programming Language Installer"
|
||||||
Comments="The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language."
|
Comments="The Go programming language is an open source project to make programmers more productive."
|
||||||
InstallerVersion="300"
|
InstallerVersion="300"
|
||||||
Compressed="yes"
|
Compressed="yes"
|
||||||
|
Manufacturer="http://golang.org"
|
||||||
|
InstallScope="perMachine"
|
||||||
Languages="1033" />
|
Languages="1033" />
|
||||||
|
<!-- Platform="x86 or x64" -->
|
||||||
|
<!--
|
||||||
|
<Upgrade Id="">
|
||||||
|
<UpgradeVersion
|
||||||
|
IncludeMaximum="yes"
|
||||||
|
IncludeMinimum="yes"
|
||||||
|
Language="1033"
|
||||||
|
Maximum=""
|
||||||
|
Minimum=""
|
||||||
|
Property="" />
|
||||||
|
</Upgrade>
|
||||||
|
-->
|
||||||
|
<Media Id='1' Cabinet="go.cab" EmbedCab="yes" CompressionLevel="high" />
|
||||||
|
<Condition Message="Windows 2000 or greater required."> VersionNT >= 500</Condition>
|
||||||
|
<SetDirectory Id="INSTALLDIRROOT" Value="C:\"/>
|
||||||
|
|
||||||
<Media Id='1' Cabinet="go.cab" EmbedCab="yes" />
|
<CustomAction
|
||||||
<Condition Message="Windows 2000 or greater required."> VersionNT >= 500</Condition>
|
Id="SetApplicationRootDirectory"
|
||||||
|
Property="ARPINSTALLLOCATION"
|
||||||
|
Value="[INSTALLDIR]" />
|
||||||
|
|
||||||
<SetDirectory Id="SYS_ROOT" Value="C:\"/>
|
<!-- Define the directory structure and environment variables -->
|
||||||
<Property Id="EnableEV" Value="1" />
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="INSTALLDIRROOT">
|
||||||
|
<Directory Id="INSTALLDIR" Name="Go"/>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="ProgramMenuFolder">
|
||||||
|
<Directory Id="GoProgramShortcutsDir" Name="Go Programming"/>
|
||||||
|
</Directory>
|
||||||
|
<Directory Id="DesktopFolder" Name="Desktop"/>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
<!-- Define the directory structure and environment variables -->
|
<!-- Programs Menu & Desktop Shortcuts -->
|
||||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
<DirectoryRef Id="GoProgramShortcutsDir">
|
||||||
<Directory Id="SYS_ROOT">
|
<Component Id="Component_GoShortCuts" Guid="f5fbfb5e-6c5c-423b-9298-21b0e3c98f4b">
|
||||||
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Go"/>
|
<Shortcut
|
||||||
|
Id="GoEnvStartMenuShortcut"
|
||||||
<Component Id="GoEnvVars"
|
Name="GoEnv"
|
||||||
Guid="067EE394-08EF-11E1-ACBC-43FF4824019B">
|
Description="Sets the Go environment and spawns a shell window"
|
||||||
<CreateFolder />
|
Target="[INSTALLDIR]goenv.bat" />
|
||||||
<Environment Id="GoRootPath"
|
<Shortcut
|
||||||
Action="set"
|
Id="GoEnvDesktopShortcut"
|
||||||
Part="all"
|
Directory="DesktopFolder"
|
||||||
Name="GOROOT"
|
Name="GoEnv"
|
||||||
Permanent="no"
|
Description="Sets the Go environment and spawns a shell window"
|
||||||
System="yes"
|
Target="[INSTALLDIR]goenv.bat" />
|
||||||
Value="C:\Go" />
|
<Shortcut
|
||||||
|
Id="GoDocServerStartMenuShortcut"
|
||||||
<Environment Id="GoBinPath"
|
Name="GoDocServer"
|
||||||
Action="set"
|
Description="Starts the godoc server on localhost:6060"
|
||||||
Part="all"
|
Target="[INSTALLDIR]godocserver.bat" />
|
||||||
Name="GOBIN"
|
<Shortcut
|
||||||
Permanent="no"
|
Id="GoDocServerDesktopShortcut"
|
||||||
System="yes"
|
Directory="DesktopFolder"
|
||||||
Value="C:\Go\bin" />
|
Name="GoDocServer"
|
||||||
|
Description="Starts the godoc server on localhost:6060"
|
||||||
<Environment Id="Environment"
|
Target="[INSTALLDIR]godocserver.bat" />
|
||||||
Action="set"
|
<Shortcut
|
||||||
Part="last"
|
Id="UninstallShortcut"
|
||||||
Name="PATH"
|
Name="Uninstall Go"
|
||||||
Permanent="no"
|
Description="Uninstalls Go and all of its components"
|
||||||
System="yes"
|
Target="[$(var.SYSFOLDER)]msiexec.exe"
|
||||||
Value="C:\Go\bin" />
|
Arguments="/x [ProductCode]" />
|
||||||
|
<RemoveFolder
|
||||||
|
Id="GoProgramShortcutsDir"
|
||||||
|
On="uninstall" />
|
||||||
|
<RegistryValue
|
||||||
|
Root="HKCU"
|
||||||
|
Key="Software\Microsoft\TheGoProgrammingLanguage"
|
||||||
|
Name="installed"
|
||||||
|
Type="integer"
|
||||||
|
Value="1"
|
||||||
|
KeyPath="yes" />
|
||||||
</Component>
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
</Directory>
|
<!-- Components -->
|
||||||
</Directory>
|
<DirectoryRef Id="INSTALLDIR">
|
||||||
|
<Component Id="Component_GoDocServerBAT" Guid="c40ea60a-4290-4a91-864d-e1d8eb5cf693">
|
||||||
|
<File
|
||||||
|
Id="FILE_GoDocServerBat"
|
||||||
|
Source="godocserver.bat"
|
||||||
|
KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
<Component Id="Component_GoEnvBAT" Guid="ee4587d3-fba3-47f9-b45e-ec9ca9c8a9c3">
|
||||||
|
<File
|
||||||
|
Id="FILE_GoEnvBat"
|
||||||
|
Source="goenv.bat"
|
||||||
|
KeyPath="yes" />
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
<!-- Install the files -->
|
<!-- Install the files -->
|
||||||
<Feature Id="GoTools"
|
<Feature
|
||||||
|
Id="GoTools"
|
||||||
Title="Go"
|
Title="Go"
|
||||||
Level="1">
|
Level="1">
|
||||||
|
|
||||||
<ComponentGroupRef Id="AppFiles" />
|
<ComponentGroupRef Id="AppFiles" />
|
||||||
<ComponentRef Id="GoEnvVars" />
|
<ComponentRef Id="Component_GoDocServerBAT" />
|
||||||
</Feature>
|
<ComponentRef Id="Component_GoEnvBAT" />
|
||||||
|
<ComponentRef Id="Component_GoShortCuts" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
<!-- Update the environment -->
|
<!-- Update the environment -->
|
||||||
<InstallExecuteSequence>
|
<InstallExecuteSequence>
|
||||||
<WriteEnvironmentStrings>EnableEV=1</WriteEnvironmentStrings>
|
<Custom
|
||||||
</InstallExecuteSequence>
|
Action="SetApplicationRootDirectory"
|
||||||
|
Before="InstallFinalize" />
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
</Product>
|
<!-- Include the user interface -->
|
||||||
|
<WixVariable Id="WixUILicenseRtf" Value="LICENSE" />
|
||||||
|
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
|
||||||
|
<UIRef Id="WixUI_InstallDir" />
|
||||||
|
|
||||||
|
</Product>
|
||||||
</Wix>
|
</Wix>
|
@ -42,11 +42,11 @@ echo "%%%%% Starting zip packaging %%%%%" 1>&2
|
|||||||
7za a -tzip -mx=9 gowin$GOARCH"_"$ver.zip "go/" >/dev/null
|
7za a -tzip -mx=9 gowin$GOARCH"_"$ver.zip "go/" >/dev/null
|
||||||
|
|
||||||
echo "%%%%% Starting Go directory file harvesting %%%%%" 1>&2
|
echo "%%%%% Starting Go directory file harvesting %%%%%" 1>&2
|
||||||
heat dir go -nologo -cg AppFiles -gg -g1 -srd -sfrag -template fragment -dr APPLICATIONROOTDIRECTORY -var var.SourceDir -out AppFiles.wxs
|
heat dir go -nologo -cg AppFiles -gg -g1 -srd -sfrag -template fragment -dr INSTALLDIR -var var.SourceDir -out AppFiles.wxs
|
||||||
|
|
||||||
echo "%%%%% Starting installer packaging %%%%%" 1>&2
|
echo "%%%%% Starting installer packaging %%%%%" 1>&2
|
||||||
candle -nologo -dVersion=$ver -dArch=$GOARCH -dSourceDir=go installer.wxs AppFiles.wxs
|
candle -nologo -dVersion=$ver -dArch=$GOARCH -dSourceDir=go installer.wxs AppFiles.wxs
|
||||||
light -nologo installer.wixobj AppFiles.wixobj -o gowin$GOARCH"_"$ver.msi
|
light -nologo -ext WixUIExtension -ext WixUtilExtension installer.wixobj AppFiles.wixobj -o gowin$GOARCH"_"$ver.msi
|
||||||
|
|
||||||
rm -f *.wixobj AppFiles.wxs *.wixpdb
|
rm -f *.wixobj AppFiles.wxs *.wixpdb
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user