about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--LICENSE.txt11
-rw-r--r--Makefile.in2
-rwxr-xr-xconfigure2
-rw-r--r--mk/dist.mk32
-rw-r--r--src/etc/pkg/modpath.iss219
-rw-r--r--src/etc/pkg/rust-logo.icobin0 -> 94339 bytes
-rw-r--r--src/etc/pkg/rust.iss50
7 files changed, 300 insertions, 16 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
index 826bcd17c12..102d019dbe3 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -186,6 +186,17 @@ included:
     USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
     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
   is found in the src/rt/libuv directory, within this
diff --git a/Makefile.in b/Makefile.in
index 149f4122231..4ee65d87e82 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -114,7 +114,7 @@ LIBRUSTC_GLOB :=$(call CFG_LIB_GLOB,rustc)
 
 # version-string calculation
 CFG_GIT_DIR := $(CFG_SRC_DIR).git
-CFG_RELEASE = 0.2pre
+CFG_RELEASE = 0.1.1
 CFG_VERSION = $(CFG_RELEASE)
 
 ifneq ($(wildcard $(CFG_GIT)),)
diff --git a/configure b/configure
index b769b529b8a..9d4a5410961 100755
--- a/configure
+++ b/configure
@@ -289,7 +289,7 @@ probe CFG_GCC              gcc
 probe CFG_LLVM_CONFIG      llvm-config
 probe CFG_VALGRIND         valgrind
 probe CFG_PERF             perf
-probe CFG_MAKENSIS         makensis
+probe CFG_ISCC             iscc
 probe CFG_NATURALDOCS      NaturalDocs naturaldocs
 probe CFG_LLNEXTGEN        LLnextgen
 probe CFG_PANDOC           pandoc
diff --git a/mk/dist.mk b/mk/dist.mk
index 82ba2a82a68..339e3efebd0 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -6,8 +6,9 @@ PKG_NAME := rust
 PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
 PKG_TAR = $(PKG_DIR).tar.gz
 
-ifdef CFG_MAKENSIS
-PKG_NSI = $(S)src/etc/pkg/rust.nsi
+ifdef CFG_ISCC
+PKG_ISS = $(wildcard $(S)src/etc/pkg/*.iss)
+PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
 PKG_EXE = $(PKG_DIR)-install.exe
 endif
 
@@ -38,18 +39,23 @@ PKG_FILES := \
 
 UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
 
-lic.txt: $(S)LICENSE.txt
-	@$(call E, crlf: $@)
-	@$(Q)perl -pe 's@\r\n|\n@\r\n@go' <$< >$@
+ifdef CFG_ISCC
+LICENSE.txt: $(S)LICENSE.txt
+	cp $< $@
 
-ifdef CFG_MAKENSIS
-$(PKG_EXE): $(PKG_NSI) $(PKG_FILES) all rustc-stage3 lic.txt
-	@$(call E, makensis: $@)
-	$(Q)"$(CFG_MAKENSIS)" -NOCD -V1 "-XOutFile $@" \
-                        "-XLicenseData lic.txt" $<
-	$(Q)rm -f lic.txt
+%.iss: $(S)src/etc/pkg/%.iss
+	cp $< $@
+
+%.ico: $(S)src/etc/pkg/%.ico
+	cp $< $@
+
+$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
+            $(PKG_FILES) all rustc-stage3
+	@$(call E, ISCC: $@)
+	$(Q)"$(CFG_ISCC)" $<
 endif
 
+
 $(PKG_TAR): $(PKG_FILES)
 	@$(call E, making dist dir)
 	$(Q)rm -Rf dist
@@ -68,7 +74,7 @@ $(PKG_TAR): $(PKG_FILES)
 	$(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
 	$(Q)rm -Rf dist
 
-.PHONY: dist nsis-dist distcheck
+.PHONY: dist distcheck
 
 ifdef CFG_WINDOWSY
 
@@ -84,8 +90,6 @@ else
 
 dist: $(PKG_TAR)
 
-nsis-dist: $(PKG_EXE)
-
 distcheck: $(PKG_TAR)
 	$(Q)rm -Rf dist
 	$(Q)mkdir -p dist
diff --git a/src/etc/pkg/modpath.iss b/src/etc/pkg/modpath.iss
new file mode 100644
index 00000000000..c0b4475ad05
--- /dev/null
+++ b/src/etc/pkg/modpath.iss
@@ -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;
diff --git a/src/etc/pkg/rust-logo.ico b/src/etc/pkg/rust-logo.ico
new file mode 100644
index 00000000000..4749b398c2d
--- /dev/null
+++ b/src/etc/pkg/rust-logo.ico
Binary files differdiff --git a/src/etc/pkg/rust.iss b/src/etc/pkg/rust.iss
new file mode 100644
index 00000000000..d7bd716c8ba
--- /dev/null
+++ b/src/etc/pkg/rust.iss
@@ -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"
\ No newline at end of file