]> Cypherpunks repositories - gostls13.git/commitdiff
misc/windows packager development intermediate check-in
authorJoe Poirier <jdpoirier@gmail.com>
Thu, 17 Nov 2011 23:54:06 +0000 (17:54 -0600)
committerJoe Poirier <jdpoirier@gmail.com>
Thu, 17 Nov 2011 23:54:06 +0000 (17:54 -0600)
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

misc/windows/LICENSE [new file with mode: 0644]
misc/windows/godocserver.bat [new file with mode: 0644]
misc/windows/goenv.bat [new file with mode: 0644]
misc/windows/installer.wxs
misc/windows/package.bash

diff --git a/misc/windows/LICENSE b/misc/windows/LICENSE
new file mode 100644 (file)
index 0000000..b2b0be6
Binary files /dev/null and b/misc/windows/LICENSE differ
diff --git a/misc/windows/godocserver.bat b/misc/windows/godocserver.bat
new file mode 100644 (file)
index 0000000..70b35de
--- /dev/null
@@ -0,0 +1,14 @@
+@echo off\r
+setlocal\r
+for /f "delims=" %%i in ('cd') do set cwd=%%i\r
+\r
+if exist bin\godoc.exe goto ok\r
+echo Unable to find the godoc executable\r
+echo This batch file must run from the root Go folder\r
+pause\r
+exit\r
+\r
+:ok\r
+start bin\godoc -http=localhost:6060 -goroot="%cwd%"\r
+start http://localhost:6060\r
+endlocal\r
diff --git a/misc/windows/goenv.bat b/misc/windows/goenv.bat
new file mode 100644 (file)
index 0000000..e6ae164
--- /dev/null
@@ -0,0 +1,29 @@
+@echo off\r
+setlocal\r
+for /f %%i in ("%0") do set cwd=%%~dpi\r
+cd /d %cwd%\r
+\r
+:: sanity checks\r
+if exist "%cwd%"\bin\6g.exe (\r
+set GOARCH=amd64\r
+goto ok\r
+)\r
+\r
+if exist "%cwd%"\bin\8g.exe (\r
+set GOARCH=386\r
+goto ok\r
+)\r
+\r
+echo Unable to find the Go compiler\r
+echo This batch file must run from the root Go folder\r
+pause\r
+exit\r
+\r
+:ok\r
+set GOROOT=%cwd%\r
+set GOBIN=%GOROOT%\bin\r
+set PATH=%GOBIN%;%PATH%\r
+\r
+@CMD /F:ON\r
+endlocal\r
+\r
index f35c4596ae1070382fdb8ba74af792debeaac7e3..e15bfcfc1bdbf7127754651c31dccd9d7a033792 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>\r
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">\r
 <!--\r
 # Copyright 2010 The Go Authors.  All rights reserved.\r
 # Use of this source code is governed by a BSD-style\r
 # license that can be found in the LICENSE file.\r
 -->\r
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">\r
 \r
-  <Product  Id="FF5B30B2-08C2-11E1-85A2-6ACA4824019B"\r
-            Name="The Go Programming Language $(var.Arch) $(var.Version)"\r
-            Language="1033"\r
-            Version="0.0.0.0"\r
-            Manufacturer="http://golang.org"\r
-            UpgradeCode="1C3114EA-08C3-11E1-9095-7FCA4824019B" >\r
-            <!-- Version="$(var.Version)" TODO: Version requires X.X.X.X format -->\r
-            \r
-    <Package    Id='*' Keywords='Installer' \r
-                Description="The Go Programming Language Installer"\r
-                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." \r
-                InstallerVersion="300"\r
-                Compressed="yes"\r
-                Languages="1033" />\r
+<?if $(var.Arch) = 386 ?>\r
+  <?define SYSFOLDER=SystemFolder ?>\r
+  <?define Win64=no ?>\r
+<?else?>\r
+  <?define SYSFOLDER=System64Folder ?>\r
+  <?define Win64=yes ?>\r
+<?endif?>\r
+\r
+<Product\r
+    Id="FF5B30B2-08C2-11E1-85A2-6ACA4824019B"\r
+    Name="The Go Programming Language $(var.Arch) $(var.Version)"\r
+    Language="1033"\r
+    Version="0.0.0.0"\r
+    Manufacturer="http://golang.org"\r
+    UpgradeCode="1C3114EA-08C3-11E1-9095-7FCA4824019B" >\r
+    <!-- Version="$(var.Version)" TODO: Version requires X.X.X.X format -->\r
+\r
+<Package\r
+    Id='*' Keywords='Installer'\r
+    Description="The Go Programming Language Installer"\r
+    Comments="The Go programming language is an open source project to make programmers more productive."\r
+    InstallerVersion="300"\r
+    Compressed="yes"\r
+    Manufacturer="http://golang.org"\r
+    InstallScope="perMachine"\r
+    Languages="1033" />\r
+     <!--    Platform="x86 or x64" -->\r
+<!--\r
+<Upgrade Id="">\r
+    <UpgradeVersion\r
+        IncludeMaximum="yes"\r
+        IncludeMinimum="yes"\r
+        Language="1033"\r
+        Maximum=""\r
+        Minimum=""\r
+        Property="" />\r
+</Upgrade>\r
+-->\r
+<Media Id='1' Cabinet="go.cab" EmbedCab="yes" CompressionLevel="high" />\r
+<Condition Message="Windows 2000 or greater required."> VersionNT >= 500</Condition>\r
+<SetDirectory Id="INSTALLDIRROOT" Value="C:\"/>\r
+\r
+<CustomAction\r
+    Id="SetApplicationRootDirectory"\r
+    Property="ARPINSTALLLOCATION"\r
+    Value="[INSTALLDIR]" />\r
 \r
-    <Media Id='1' Cabinet="go.cab" EmbedCab="yes" />\r
-    <Condition Message="Windows 2000 or greater required."> VersionNT >= 500</Condition>\r
-    \r
-    <SetDirectory Id="SYS_ROOT" Value="C:\"/>\r
-    <Property Id="EnableEV" Value="1" />\r
-        \r
-        <!-- Define the directory structure and environment variables -->\r
-        <Directory Id="TARGETDIR" Name="SourceDir">\r
-            <Directory Id="SYS_ROOT">\r
-                <Directory Id="APPLICATIONROOTDIRECTORY" Name="Go"/>\r
+<!-- Define the directory structure and environment variables -->\r
+<Directory Id="TARGETDIR" Name="SourceDir">\r
+  <Directory Id="INSTALLDIRROOT">\r
+    <Directory Id="INSTALLDIR" Name="Go"/>\r
+  </Directory>\r
+  <Directory Id="ProgramMenuFolder">\r
+    <Directory Id="GoProgramShortcutsDir" Name="Go Programming"/>\r
+  </Directory>\r
+  <Directory Id="DesktopFolder" Name="Desktop"/>\r
+</Directory>\r
 \r
-                <Component  Id="GoEnvVars"\r
-                            Guid="067EE394-08EF-11E1-ACBC-43FF4824019B">\r
-                    <CreateFolder />\r
-                    <Environment    Id="GoRootPath"\r
-                                    Action="set" \r
-                                    Part="all"\r
-                                    Name="GOROOT"\r
-                                    Permanent="no"\r
-                                    System="yes"\r
-                                    Value="C:\Go" />\r
+<!-- Programs Menu & Desktop Shortcuts -->\r
+<DirectoryRef Id="GoProgramShortcutsDir">\r
+  <Component Id="Component_GoShortCuts" Guid="f5fbfb5e-6c5c-423b-9298-21b0e3c98f4b">\r
+    <Shortcut\r
+        Id="GoEnvStartMenuShortcut"\r
+        Name="GoEnv"\r
+        Description="Sets the Go environment and spawns a shell window"\r
+        Target="[INSTALLDIR]goenv.bat" />\r
+    <Shortcut\r
+        Id="GoEnvDesktopShortcut"\r
+        Directory="DesktopFolder"\r
+        Name="GoEnv"\r
+        Description="Sets the Go environment and spawns a shell window"\r
+        Target="[INSTALLDIR]goenv.bat" />\r
+    <Shortcut\r
+        Id="GoDocServerStartMenuShortcut"\r
+        Name="GoDocServer"\r
+        Description="Starts the godoc server on localhost:6060"\r
+        Target="[INSTALLDIR]godocserver.bat" />\r
+    <Shortcut\r
+        Id="GoDocServerDesktopShortcut"\r
+        Directory="DesktopFolder"\r
+        Name="GoDocServer"\r
+        Description="Starts the godoc server on localhost:6060"\r
+        Target="[INSTALLDIR]godocserver.bat" />\r
+    <Shortcut\r
+        Id="UninstallShortcut"\r
+        Name="Uninstall Go"\r
+        Description="Uninstalls Go and all of its components"\r
+        Target="[$(var.SYSFOLDER)]msiexec.exe"\r
+        Arguments="/x [ProductCode]" />\r
+    <RemoveFolder\r
+        Id="GoProgramShortcutsDir"\r
+        On="uninstall" />\r
+    <RegistryValue\r
+        Root="HKCU"\r
+        Key="Software\Microsoft\TheGoProgrammingLanguage"\r
+        Name="installed"\r
+        Type="integer"\r
+        Value="1"\r
+        KeyPath="yes" />\r
+  </Component>\r
+</DirectoryRef>\r
 \r
-                    <Environment    Id="GoBinPath"\r
-                                    Action="set" \r
-                                    Part="all"\r
-                                    Name="GOBIN"\r
-                                    Permanent="no"\r
-                                    System="yes"\r
-                                    Value="C:\Go\bin" />\r
+<!-- Components -->\r
+<DirectoryRef Id="INSTALLDIR">\r
+  <Component Id="Component_GoDocServerBAT" Guid="c40ea60a-4290-4a91-864d-e1d8eb5cf693">\r
+    <File\r
+        Id="FILE_GoDocServerBat"\r
+        Source="godocserver.bat"\r
+        KeyPath="yes" />\r
+  </Component>\r
+  <Component Id="Component_GoEnvBAT" Guid="ee4587d3-fba3-47f9-b45e-ec9ca9c8a9c3">\r
+    <File\r
+        Id="FILE_GoEnvBat"\r
+        Source="goenv.bat"\r
+        KeyPath="yes" />\r
+  </Component>\r
+</DirectoryRef>\r
 \r
-                    <Environment    Id="Environment"\r
-                                    Action="set" \r
-                                    Part="last"\r
-                                    Name="PATH"\r
-                                    Permanent="no"\r
-                                    System="yes"\r
-                                    Value="C:\Go\bin" />                         \r
-                </Component>\r
+<!-- Install the files -->\r
+<Feature\r
+    Id="GoTools"\r
+    Title="Go"\r
+    Level="1">\r
 \r
-            </Directory>\r
-        </Directory>\r
+      <ComponentGroupRef Id="AppFiles" />\r
+      <ComponentRef Id="Component_GoDocServerBAT" />\r
+      <ComponentRef Id="Component_GoEnvBAT" />\r
+      <ComponentRef Id="Component_GoShortCuts" />\r
+</Feature>\r
 \r
-        <!-- Install the files -->\r
-        <Feature    Id="GoTools" \r
-                    Title="Go" \r
-                    Level="1">\r
-            <ComponentGroupRef Id="AppFiles" />\r
-            <ComponentRef Id="GoEnvVars" />\r
-        </Feature>   \r
+<!-- Update the environment -->\r
+<InstallExecuteSequence>\r
+  <Custom\r
+    Action="SetApplicationRootDirectory"\r
+    Before="InstallFinalize" />\r
+</InstallExecuteSequence>\r
 \r
-        <!-- Update the environment -->\r
-        <InstallExecuteSequence>\r
-            <WriteEnvironmentStrings>EnableEV=1</WriteEnvironmentStrings>\r
-        </InstallExecuteSequence>\r
+<!-- Include the user interface -->\r
+<WixVariable Id="WixUILicenseRtf" Value="LICENSE" />\r
+<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />\r
+<UIRef Id="WixUI_InstallDir" />\r
 \r
-  </Product>\r
-</Wix>
\ No newline at end of file
+</Product>\r
+</Wix>\r
index 8232a3cc5fa3c9d01819fb398a4a4d1ede039aee..873db7019c7183f61d576470c515aad5230f2846 100755 (executable)
@@ -42,11 +42,11 @@ echo "%%%%% Starting zip packaging %%%%%" 1>&2
 7za a -tzip -mx=9 gowin$GOARCH"_"$ver.zip "go/" >/dev/null
 
 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
 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