From ad954fceccc24945fc026522df5af6d01fa7b83d Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Sat, 23 Jul 2011 12:26:47 -0700 Subject: [PATCH] Add an NSIS script for building a win32 installer. Closes #522. --- Makefile.in | 1 + configure | 3 ++- mk/dist.mk | 21 +++++++++++++++++++-- src/etc/pkg/rust.nsi | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/etc/pkg/rust.nsi 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) -$(PKG_TAR): $(GENERATED) +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): $(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