mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Add Inno Setup installer script rather than NSIS
This commit is contained in:
parent
7da3733c73
commit
fe57a7e582
11
LICENSE.txt
11
LICENSE.txt
@ -186,6 +186,17 @@ included:
|
|||||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
OF SUCH DAMAGE.
|
OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
* The auxiliary file src/etc/pkg/modpath.iss contains a
|
||||||
|
library routine compiled, by Inno Setup, into the Windows
|
||||||
|
installer binary. This file is licensed under the LGPL,
|
||||||
|
but, in our legal interpretation, this does not affect the
|
||||||
|
aggregate "collected work" license of the Rust
|
||||||
|
distribution (MIT) nor any other components of it. We
|
||||||
|
believe that the terms governing distribution of the
|
||||||
|
binary Windows installer built from modpath.iss are
|
||||||
|
therefore LGPL, but not the terms governing distribution
|
||||||
|
of any of the files installed by such an installer (such
|
||||||
|
as the Rust compiler or runtime libraries themselves).
|
||||||
|
|
||||||
* The libuv asynchronous I/O library. Code for this package
|
* The libuv asynchronous I/O library. Code for this package
|
||||||
is found in the src/rt/libuv directory, within this
|
is found in the src/rt/libuv directory, within this
|
||||||
|
@ -114,7 +114,7 @@ LIBRUSTC_GLOB :=$(call CFG_LIB_GLOB,rustc)
|
|||||||
|
|
||||||
# version-string calculation
|
# version-string calculation
|
||||||
CFG_GIT_DIR := $(CFG_SRC_DIR).git
|
CFG_GIT_DIR := $(CFG_SRC_DIR).git
|
||||||
CFG_RELEASE = 0.2pre
|
CFG_RELEASE = 0.1.1
|
||||||
CFG_VERSION = $(CFG_RELEASE)
|
CFG_VERSION = $(CFG_RELEASE)
|
||||||
|
|
||||||
ifneq ($(wildcard $(CFG_GIT)),)
|
ifneq ($(wildcard $(CFG_GIT)),)
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -289,7 +289,7 @@ probe CFG_GCC gcc
|
|||||||
probe CFG_LLVM_CONFIG llvm-config
|
probe CFG_LLVM_CONFIG llvm-config
|
||||||
probe CFG_VALGRIND valgrind
|
probe CFG_VALGRIND valgrind
|
||||||
probe CFG_PERF perf
|
probe CFG_PERF perf
|
||||||
probe CFG_MAKENSIS makensis
|
probe CFG_ISCC iscc
|
||||||
probe CFG_NATURALDOCS NaturalDocs naturaldocs
|
probe CFG_NATURALDOCS NaturalDocs naturaldocs
|
||||||
probe CFG_LLNEXTGEN LLnextgen
|
probe CFG_LLNEXTGEN LLnextgen
|
||||||
probe CFG_PANDOC pandoc
|
probe CFG_PANDOC pandoc
|
||||||
|
32
mk/dist.mk
32
mk/dist.mk
@ -6,8 +6,9 @@ PKG_NAME := rust
|
|||||||
PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
|
PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
|
||||||
PKG_TAR = $(PKG_DIR).tar.gz
|
PKG_TAR = $(PKG_DIR).tar.gz
|
||||||
|
|
||||||
ifdef CFG_MAKENSIS
|
ifdef CFG_ISCC
|
||||||
PKG_NSI = $(S)src/etc/pkg/rust.nsi
|
PKG_ISS = $(wildcard $(S)src/etc/pkg/*.iss)
|
||||||
|
PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
|
||||||
PKG_EXE = $(PKG_DIR)-install.exe
|
PKG_EXE = $(PKG_DIR)-install.exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -38,18 +39,23 @@ PKG_FILES := \
|
|||||||
|
|
||||||
UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
|
UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
|
||||||
|
|
||||||
lic.txt: $(S)LICENSE.txt
|
ifdef CFG_ISCC
|
||||||
@$(call E, crlf: $@)
|
LICENSE.txt: $(S)LICENSE.txt
|
||||||
@$(Q)perl -pe 's@\r\n|\n@\r\n@go' <$< >$@
|
cp $< $@
|
||||||
|
|
||||||
ifdef CFG_MAKENSIS
|
%.iss: $(S)src/etc/pkg/%.iss
|
||||||
$(PKG_EXE): $(PKG_NSI) $(PKG_FILES) all rustc-stage3 lic.txt
|
cp $< $@
|
||||||
@$(call E, makensis: $@)
|
|
||||||
$(Q)"$(CFG_MAKENSIS)" -NOCD -V1 "-XOutFile $@" \
|
%.ico: $(S)src/etc/pkg/%.ico
|
||||||
"-XLicenseData lic.txt" $<
|
cp $< $@
|
||||||
$(Q)rm -f lic.txt
|
|
||||||
|
$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
|
||||||
|
$(PKG_FILES) all rustc-stage3
|
||||||
|
@$(call E, ISCC: $@)
|
||||||
|
$(Q)"$(CFG_ISCC)" $<
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
$(PKG_TAR): $(PKG_FILES)
|
$(PKG_TAR): $(PKG_FILES)
|
||||||
@$(call E, making dist dir)
|
@$(call E, making dist dir)
|
||||||
$(Q)rm -Rf dist
|
$(Q)rm -Rf dist
|
||||||
@ -68,7 +74,7 @@ $(PKG_TAR): $(PKG_FILES)
|
|||||||
$(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
|
$(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
|
||||||
$(Q)rm -Rf dist
|
$(Q)rm -Rf dist
|
||||||
|
|
||||||
.PHONY: dist nsis-dist distcheck
|
.PHONY: dist distcheck
|
||||||
|
|
||||||
ifdef CFG_WINDOWSY
|
ifdef CFG_WINDOWSY
|
||||||
|
|
||||||
@ -84,8 +90,6 @@ else
|
|||||||
|
|
||||||
dist: $(PKG_TAR)
|
dist: $(PKG_TAR)
|
||||||
|
|
||||||
nsis-dist: $(PKG_EXE)
|
|
||||||
|
|
||||||
distcheck: $(PKG_TAR)
|
distcheck: $(PKG_TAR)
|
||||||
$(Q)rm -Rf dist
|
$(Q)rm -Rf dist
|
||||||
$(Q)mkdir -p dist
|
$(Q)mkdir -p dist
|
||||||
|
219
src/etc/pkg/modpath.iss
Normal file
219
src/etc/pkg/modpath.iss
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Inno Setup Ver: 5.4.2
|
||||||
|
// Script Version: 1.4.1
|
||||||
|
// Author: Jared Breland <jbreland@legroom.net>
|
||||||
|
// Homepage: http://www.legroom.net/software
|
||||||
|
// License: GNU Lesser General Public License (LGPL), version 3
|
||||||
|
// http://www.gnu.org/licenses/lgpl.html
|
||||||
|
//
|
||||||
|
// Script Function:
|
||||||
|
// Allow modification of environmental path directly from Inno Setup installers
|
||||||
|
//
|
||||||
|
// Instructions:
|
||||||
|
// Copy modpath.iss to the same directory as your setup script
|
||||||
|
//
|
||||||
|
// Add this statement to your [Setup] section
|
||||||
|
// ChangesEnvironment=true
|
||||||
|
//
|
||||||
|
// Add this statement to your [Tasks] section
|
||||||
|
// You can change the Description or Flags
|
||||||
|
// You can change the Name, but it must match the ModPathName setting below
|
||||||
|
// Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked
|
||||||
|
//
|
||||||
|
// Add the following to the end of your [Code] section
|
||||||
|
// ModPathName defines the name of the task defined above
|
||||||
|
// ModPathType defines whether the 'user' or 'system' path will be modified;
|
||||||
|
// this will default to user if anything other than system is set
|
||||||
|
// setArrayLength must specify the total number of dirs to be added
|
||||||
|
// Result[0] contains first directory, Result[1] contains second, etc.
|
||||||
|
// const
|
||||||
|
// ModPathName = 'modifypath';
|
||||||
|
// ModPathType = 'user';
|
||||||
|
//
|
||||||
|
// function ModPathDir(): TArrayOfString;
|
||||||
|
// begin
|
||||||
|
// setArrayLength(Result, 1);
|
||||||
|
// Result[0] := ExpandConstant('{app}');
|
||||||
|
// end;
|
||||||
|
// #include "modpath.iss"
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure ModPath();
|
||||||
|
var
|
||||||
|
oldpath: String;
|
||||||
|
newpath: String;
|
||||||
|
updatepath: Boolean;
|
||||||
|
pathArr: TArrayOfString;
|
||||||
|
aExecFile: String;
|
||||||
|
aExecArr: TArrayOfString;
|
||||||
|
i, d: Integer;
|
||||||
|
pathdir: TArrayOfString;
|
||||||
|
regroot: Integer;
|
||||||
|
regpath: String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
// Get constants from main script and adjust behavior accordingly
|
||||||
|
// ModPathType MUST be 'system' or 'user'; force 'user' if invalid
|
||||||
|
if ModPathType = 'system' then begin
|
||||||
|
regroot := HKEY_LOCAL_MACHINE;
|
||||||
|
regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
|
||||||
|
end else begin
|
||||||
|
regroot := HKEY_CURRENT_USER;
|
||||||
|
regpath := 'Environment';
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Get array of new directories and act on each individually
|
||||||
|
pathdir := ModPathDir();
|
||||||
|
for d := 0 to GetArrayLength(pathdir)-1 do begin
|
||||||
|
updatepath := true;
|
||||||
|
|
||||||
|
// Modify WinNT path
|
||||||
|
if UsingWinNT() = true then begin
|
||||||
|
|
||||||
|
// Get current path, split into an array
|
||||||
|
RegQueryStringValue(regroot, regpath, 'Path', oldpath);
|
||||||
|
oldpath := oldpath + ';';
|
||||||
|
i := 0;
|
||||||
|
|
||||||
|
while (Pos(';', oldpath) > 0) do begin
|
||||||
|
SetArrayLength(pathArr, i+1);
|
||||||
|
pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
|
||||||
|
oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
|
||||||
|
i := i + 1;
|
||||||
|
|
||||||
|
// Check if current directory matches app dir
|
||||||
|
if pathdir[d] = pathArr[i-1] then begin
|
||||||
|
// if uninstalling, remove dir from path
|
||||||
|
if IsUninstaller() = true then begin
|
||||||
|
continue;
|
||||||
|
// if installing, flag that dir already exists in path
|
||||||
|
end else begin
|
||||||
|
updatepath := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Add current directory to new path
|
||||||
|
if i = 1 then begin
|
||||||
|
newpath := pathArr[i-1];
|
||||||
|
end else begin
|
||||||
|
newpath := newpath + ';' + pathArr[i-1];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Append app dir to path if not already included
|
||||||
|
if (IsUninstaller() = false) AND (updatepath = true) then
|
||||||
|
newpath := newpath + ';' + pathdir[d];
|
||||||
|
|
||||||
|
// Write new path
|
||||||
|
RegWriteStringValue(regroot, regpath, 'Path', newpath);
|
||||||
|
|
||||||
|
// Modify Win9x path
|
||||||
|
end else begin
|
||||||
|
|
||||||
|
// Convert to shortened dirname
|
||||||
|
pathdir[d] := GetShortName(pathdir[d]);
|
||||||
|
|
||||||
|
// If autoexec.bat exists, check if app dir already exists in path
|
||||||
|
aExecFile := 'C:\AUTOEXEC.BAT';
|
||||||
|
if FileExists(aExecFile) then begin
|
||||||
|
LoadStringsFromFile(aExecFile, aExecArr);
|
||||||
|
for i := 0 to GetArrayLength(aExecArr)-1 do begin
|
||||||
|
if IsUninstaller() = false then begin
|
||||||
|
// If app dir already exists while installing, skip add
|
||||||
|
if (Pos(pathdir[d], aExecArr[i]) > 0) then
|
||||||
|
updatepath := false;
|
||||||
|
break;
|
||||||
|
end else begin
|
||||||
|
// If app dir exists and = what we originally set, then delete at uninstall
|
||||||
|
if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
|
||||||
|
aExecArr[i] := '';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
|
||||||
|
if (IsUninstaller() = false) AND (updatepath = true) then begin
|
||||||
|
SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);
|
||||||
|
|
||||||
|
// If uninstalling, write the full autoexec out
|
||||||
|
end else begin
|
||||||
|
SaveStringsToFile(aExecFile, aExecArr, False);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Split a string into an array using passed delimeter
|
||||||
|
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
repeat
|
||||||
|
SetArrayLength(Dest, i+1);
|
||||||
|
if Pos(Separator,Text) > 0 then begin
|
||||||
|
Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1);
|
||||||
|
Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text));
|
||||||
|
i := i + 1;
|
||||||
|
end else begin
|
||||||
|
Dest[i] := Text;
|
||||||
|
Text := '';
|
||||||
|
end;
|
||||||
|
until Length(Text)=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
|
var
|
||||||
|
taskname: String;
|
||||||
|
begin
|
||||||
|
taskname := ModPathName;
|
||||||
|
if CurStep = ssPostInstall then
|
||||||
|
if IsTaskSelected(taskname) then
|
||||||
|
ModPath();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||||
|
var
|
||||||
|
aSelectedTasks: TArrayOfString;
|
||||||
|
i: Integer;
|
||||||
|
taskname: String;
|
||||||
|
regpath: String;
|
||||||
|
regstring: String;
|
||||||
|
appid: String;
|
||||||
|
begin
|
||||||
|
// only run during actual uninstall
|
||||||
|
if CurUninstallStep = usUninstall then begin
|
||||||
|
// get list of selected tasks saved in registry at install time
|
||||||
|
appid := '{#emit SetupSetting("AppId")}';
|
||||||
|
if appid = '' then appid := '{#emit SetupSetting("AppName")}';
|
||||||
|
regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1');
|
||||||
|
RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring);
|
||||||
|
if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring);
|
||||||
|
|
||||||
|
// check each task; if matches modpath taskname, trigger patch removal
|
||||||
|
if regstring <> '' then begin
|
||||||
|
taskname := ModPathName;
|
||||||
|
Explode(aSelectedTasks, regstring, ',');
|
||||||
|
if GetArrayLength(aSelectedTasks) > 0 then begin
|
||||||
|
for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin
|
||||||
|
if comparetext(aSelectedTasks[i], taskname) = 0 then
|
||||||
|
ModPath();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function NeedRestart(): Boolean;
|
||||||
|
var
|
||||||
|
taskname: String;
|
||||||
|
begin
|
||||||
|
taskname := ModPathName;
|
||||||
|
if IsTaskSelected(taskname) and not UsingWinNT() then begin
|
||||||
|
Result := True;
|
||||||
|
end else begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
end;
|
BIN
src/etc/pkg/rust-logo.ico
Normal file
BIN
src/etc/pkg/rust-logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
50
src/etc/pkg/rust.iss
Normal file
50
src/etc/pkg/rust.iss
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#define CFG_VERSION GetEnv("CFG_VERSION")
|
||||||
|
|
||||||
|
[Setup]
|
||||||
|
|
||||||
|
SetupIconFile=rust-logo.ico
|
||||||
|
AppName=Rust
|
||||||
|
AppVersion={#CFG_VERSION}
|
||||||
|
AppCopyright=Copyright (C) 2006-2011 Mozilla Foundation, MIT license
|
||||||
|
AppPublisher=Mozilla Foundation
|
||||||
|
AppPublisherURL=http://www.rust-lang.org
|
||||||
|
VersionInfoVersion={#CFG_VERSION}
|
||||||
|
LicenseFile=LICENSE.txt
|
||||||
|
|
||||||
|
DisableWelcomePage=true
|
||||||
|
DisableProgramGroupPage=true
|
||||||
|
DisableReadyPage=true
|
||||||
|
DisableStartupPrompt=true
|
||||||
|
|
||||||
|
OutputDir=.\
|
||||||
|
SourceDir=.\
|
||||||
|
OutputBaseFilename=rust-{#CFG_VERSION}-install
|
||||||
|
DefaultDirName={pf32}\Rust
|
||||||
|
|
||||||
|
Compression=lzma2/ultra
|
||||||
|
InternalCompressLevel=ultra
|
||||||
|
SolidCompression=true
|
||||||
|
|
||||||
|
ChangesEnvironment=true
|
||||||
|
ChangesAssociations=no
|
||||||
|
AllowUNCPath=false
|
||||||
|
AllowNoIcons=true
|
||||||
|
Uninstallable=yes
|
||||||
|
|
||||||
|
[Tasks]
|
||||||
|
Name: modifypath; Description: &Add {app}\bin to your PATH (recommended)
|
||||||
|
|
||||||
|
[Files]
|
||||||
|
Source: "i686-pc-mingw32/stage3/*.*" ; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
||||||
|
|
||||||
|
[Code]
|
||||||
|
const
|
||||||
|
ModPathName = 'modifypath';
|
||||||
|
ModPathType = 'user';
|
||||||
|
|
||||||
|
function ModPathDir(): TArrayOfString;
|
||||||
|
begin
|
||||||
|
setArrayLength(Result, 1)
|
||||||
|
Result[0] := ExpandConstant('{app}\bin');
|
||||||
|
end;
|
||||||
|
#include "modpath.iss"
|
Loading…
Reference in New Issue
Block a user