about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-07-23 12:26:47 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-07-23 12:27:06 -0700
commitad954fceccc24945fc026522df5af6d01fa7b83d (patch)
tree290f8e91aac9a379c96e162dc3d9dac9de8e745d
parent57459ec8ae402be358393455533cdf363866cdca (diff)
downloadrust-ad954fceccc24945fc026522df5af6d01fa7b83d.tar.gz
rust-ad954fceccc24945fc026522df5af6d01fa7b83d.zip
Add an NSIS script for building a win32 installer. Closes #522.
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure3
-rw-r--r--mk/dist.mk21
-rw-r--r--src/etc/pkg/rust.nsi39
4 files changed, 61 insertions, 3 deletions
diff --git a/Makefile.in b/Makefile.in
index df0ac6c9960..3af46edb439 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -145,6 +145,7 @@ COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
 ######################################################################
 
 export CFG_SRC_DIR
+export CFG_BUILD_DIR
 export CFG_VERSION
 export CFG_LLVM_ROOT
 export CFG_ENABLE_MINGW_CROSS
diff --git a/configure b/configure
index 8d25494314f..0d2ce81d499 100755
--- a/configure
+++ b/configure
@@ -200,7 +200,7 @@ probe_need CFG_PERL         perl
 probe_need CFG_PYTHON       python
 probe_need CFG_CURL         curl
 
-probe CFG_GIT          git
+probe CFG_GIT              git
 probe CFG_CLANG            clang++
 probe CFG_GCC              gcc
 probe CFG_LLVM_CONFIG      llvm-config
@@ -208,6 +208,7 @@ probe CFG_VALGRIND         valgrind
 probe CFG_MAKEINFO         makeinfo
 probe CFG_TEXI2PDF         texi2pdf
 probe CFG_TEX              tex
+probe CFG_MAKENSIS         makensis
 
 if [ -z "$CFG_CLANG" -a -z "$CFG_GCC" ]
 then
diff --git a/mk/dist.mk b/mk/dist.mk
index 810d5ce7031..ef6d528d9a2 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -2,11 +2,17 @@
 # Distribution
 ######################################################################
 
+
 PKG_NAME := rust
 PKG_VER  = $(shell date +"%Y-%m-%d")-snap
 PKG_DIR = $(PKG_NAME)-$(PKG_VER)
 PKG_TAR = $(PKG_DIR).tar.gz
 
+ifdef CFG_MAKENSIS
+PKG_NSI = $(S)src/etc/pkg/rust.nsi
+PKG_EXE = $(PKG_DIR)-install.exe
+endif
+
 PKG_3RDPARTY := rt/valgrind.h rt/memcheck.h \
                 rt/isaac/rand.h rt/isaac/standard.h \
                 rt/uthash/uthash.h rt/uthash/utlist.h \
@@ -29,9 +35,20 @@ PKG_FILES = \
     $(ALL_TEST_INPUTS)                         \
     $(GENERATED)
 
-dist: $(PKG_TAR)
+dist: $(PKG_TAR) $(PKG_EXE)
+
+nsis-dist: $(PKG_EXE)
+
+lic.txt: $(S)LICENSE.txt
+	@$(call E, crlf: $@)
+	@$(Q)perl -pe 's@\n@\r\n@go' <$< >$@
+
+$(PKG_EXE): $(PKG_NSI) $(PKG_FILES) $(DOCS) $(SREQ3) lic.txt
+	@$(call E, makensis: $@)
+	$(Q)makensis -NOCD -V1 "-XOutFile $@" "-XLicenseData lic.txt" $<
+	$(Q)rm -f lic.txt
 
-$(PKG_TAR): $(GENERATED)
+$(PKG_TAR): $(PKG_FILES)
 	@$(call E, making dist dir)
 	$(Q)rm -Rf dist
 	$(Q)mkdir -p dist/$(PKG_DIR)
diff --git a/src/etc/pkg/rust.nsi b/src/etc/pkg/rust.nsi
new file mode 100644
index 00000000000..1c9a72bde8c
--- /dev/null
+++ b/src/etc/pkg/rust.nsi
@@ -0,0 +1,39 @@
+# -*- shell-script -*-
+# (not really, but syntax is similar)
+#
+# This is a NSIS win32 installer script the Rust toolchain.
+#
+
+Name "Rust"
+ShowInstDetails "show"
+ShowUninstDetails "show"
+SetCompressor "lzma"
+LicenseForceSelection checkbox
+
+Page license
+Page components
+Page directory
+Page instfiles
+UninstPage uninstConfirm
+UninstPage instfiles
+
+
+Section "Compiler"
+    SetOutPath $INSTDIR
+    File /oname=rustc.exe     stage3\rustc.exe
+    File /oname=rustllvm.dll  stage3\rustllvm.dll
+    File /oname=rustrt.dll    stage3\rustrt.dll
+    File /oname=std.dll       stage3\std.dll
+
+    SetOutPath $INSTDIR\lib
+    File /oname=rustrt.dll   stage3\lib\rustrt.dll
+    File /oname=std.dll      stage3\lib\std.dll
+    File /oname=main.o       stage3\lib\main.o
+    File /oname=glue.o       stage3\lib\glue.o
+SectionEnd
+
+Section "Documentation"
+    SetOutPath $INSTDIR\doc
+    File /nonfatal /oname=rust.html doc\rust.html
+    File /nonfatal /oname=rust.pdf  doc\rust.pdf
+SectionEnd