]> Cypherpunks repositories - gostls13.git/commitdiff
misc/windows: Go for Windows installer in MSI format
authorJoe Poirier <jdpoirier@gmail.com>
Wed, 9 Nov 2011 23:20:34 +0000 (17:20 -0600)
committerJoe Poirier <jdpoirier@gmail.com>
Wed, 9 Nov 2011 23:20:34 +0000 (17:20 -0600)
Requesting suggestions for the comment and description strings in installer.wxs.
Fixes #2394.

R=rsc, alex.brainman, tjyang2001
CC=golang-dev
https://golang.org/cl/5339046

misc/windows/README
misc/windows/installer.iss [deleted file]
misc/windows/installer.wxs [new file with mode: 0644]
misc/windows/package.bash

index 45cd0df8b94a33441bb38a62b1e1cb44aa32e988..c345d4570fa795f87526cf31234a4fc0b5e8d339 100644 (file)
@@ -1,13 +1,14 @@
-package.bash packages the Go toolchain for Window's in 
-zip and installer (exe) format. 
+package.bash packages the Go toolchain for Windows in 
+zip and installer (msi) format. 
 
 Dependencies
 ============
-- Inno Setup: http://www.jrsoftware.org/isinfo.php
+- WiX Installer XML (WiX) toolset: http://wix.sourceforge.net/
 - 7Zip command-line: http://www.7-zip.org/download.html
 - MinGW/Msys tools
 
 Unzip and place 7za.exe in msys' bin directory.
+Add the WiX bin directory to PATH.
 
 Packaging
 =========
diff --git a/misc/windows/installer.iss b/misc/windows/installer.iss
deleted file mode 100644 (file)
index 977a2cd..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-;; Copyright 2010 The Go Authors.  All rights reserved.
-;; Use of this source code is governed by a BSD-style
-;; license that can be found in the LICENSE file.
-
-[Setup]
-;; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
-AppId={{1AE268D9-FAE4-4EF8-AAE9-3B1B27D604F0}
-AppName={#AppName}
-AppVersion={#AppVersion}
-AppPublisher=golang-nuts@googlegroups.com
-AppPublisherURL=http://www.golang.org
-DefaultDirName={sd}\Go
-DisableDirPage=yes
-DefaultGroupName={#AppName}
-AllowNoIcons=yes
-OutputBaseFilename={#AppNameLower}win{#AppVersion}_installer
-Compression=lzma2/max
-SolidCompression=yes
-ChangesEnvironment=true
-OutputDir=.
-
-[Languages]
-Name: "english"; MessagesFile: "compiler:Default.isl"
-Name: "basque"; MessagesFile: "compiler:Languages\Basque.isl"
-Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
-Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
-Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
-Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
-Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
-Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
-Name: "french"; MessagesFile: "compiler:Languages\French.isl"
-Name: "german"; MessagesFile: "compiler:Languages\German.isl"
-Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
-Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
-Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
-Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
-Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
-Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
-Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
-Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
-Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
-Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
-Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
-
-[Files]
-Source: ".\go\*"; DestDir: "{sd}\Go"; Flags: ignoreversion recursesubdirs createallsubdirs
-
-[Registry]
-;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "GOARCH"; ValueData: "386"; Flags: uninsdeletevalue
-;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "GOOS"; ValueData: "windows"; Flags: uninsdeletevalue
-Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "GOBIN"; ValueData: "{sd}/Go/bin"; Flags: uninsdeletevalue
-Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "GOROOT"; ValueData: "{sd}/Go"; Flags: uninsdeletevalue
-Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path";  ValueData: "{olddata};{sd}/Go/bin"; Check: PathCheck('{sd}/Go/bin')
-
-;[Tasks]
-;Name: AddToPath; Description: "&Adding Go's bin directory to your environment's search path. This allows the tools to be run from a shell without having to include the installation path as part of the command.";
-
-[Icons]
-;Name: "{group}\{cm:UninstallProgram,Go}"; Filename: {uninstallexe}
-Name: "{group}\Uninstall Go"; Filename: "{uninstallexe}"
-
-[Code]
-function PathCheck(Param: string): Boolean;
-var
-    OrigPath: String;
-    Index: Integer;
-begin
-    // check for an empty path
-    if not RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath)
-    then begin
-        Result := True;
-        exit;
-    end;
-
-    // Pos returns 0 if not found
-    Index := Pos(';' + Param + ';', ';' + OrigPath + ';');
-
-    if (IsUninstaller() = True) AND (Index > 0) then begin
-        Delete(OrigPath, Index, Length(Param));
-
-        // remove orphaned semicolon if necessary
-        if (Length(OrigPath) >= Index) AND (Copy(OrigPath, Index, 1) = ';') then begin
-            Delete(OrigPath, Index, 1);
-        end;
-
-        RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath);
-    end;
-
-    // during installation, the check in the Registry
-    // section wants a Boolean value
-    Result := Index = 0;
-end;
-
-function InitializeUninstall(): Boolean;
-begin
-    PathCheck(ExpandConstant('{sd}/Go/bin'));
-    Result := True;
-end;
diff --git a/misc/windows/installer.wxs b/misc/windows/installer.wxs
new file mode 100644 (file)
index 0000000..f35c459
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>\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
+\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
+\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
+\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
+\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
+\r
+            </Directory>\r
+        </Directory>\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
+\r
+        <!-- Update the environment -->\r
+        <InstallExecuteSequence>\r
+            <WriteEnvironmentStrings>EnableEV=1</WriteEnvironmentStrings>\r
+        </InstallExecuteSequence>\r
+\r
+  </Product>\r
+</Wix>
\ No newline at end of file
index 99670e85426bd9fd4f1e0970f8f8f34df21ce8d2..8232a3cc5fa3c9d01819fb398a4a4d1ede039aee 100755 (executable)
@@ -1,19 +1,22 @@
 #!/usr/bin/env bash
-# Copyright 2010 The Go Authors.  All rights reserved.
+# Copyright 2011 The Go Authors.  All rights reserved.
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.
 set -e
 
-ISCC="C:/Program Files/Inno Setup 5/ISCC.exe"
+PROGS="
+       candle
+       light
+       heat
+"
 
-echo "%%%%% Checking for Inno Setup %%%%%" 1>&2
-if ! test -f "$ISCC"; then
-       ISCC="C:/Program Files (x86)/Inno Setup 5/ISCC.exe"
-       if ! test -f "$ISCC"; then
-               echo "No Inno Setup installation found" 1>&2
+echo "%%%%% Checking for WiX executables %%%%%" 1>&2
+for i in $PROGS; do
+       if ! which -a $1 >/dev/null; then
+               echo "Cannot find '$i' on search path." 1>$2
                exit 1
        fi
-fi
+done
 
 echo "%%%%% Checking the packager's path %%%%%" 1>&2
 if ! test -f ../../src/env.bash; then
@@ -38,7 +41,12 @@ cp -a ../../bin go/bin
 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
+
 echo "%%%%% Starting installer packaging %%%%%" 1>&2
-"$ISCC" //dAppName=Go //dAppVersion=$GOARCH"_"$ver //dAppNameLower=go installer.iss  >/dev/null
+candle -nologo -dVersion=$ver -dArch=$GOARCH -dSourceDir=go installer.wxs AppFiles.wxs
+light -nologo installer.wixobj AppFiles.wixobj -o gowin$GOARCH"_"$ver.msi
 
+rm -f *.wixobj AppFiles.wxs *.wixpdb