Skip to content

Commit ad954fc

Browse files
committed
Add an NSIS script for building a win32 installer. Closes #522.
1 parent 57459ec commit ad954fc

File tree

4 files changed

+61
-3
lines changed

4 files changed

+61
-3
lines changed

Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
145145
######################################################################
146146

147147
export CFG_SRC_DIR
148+
export CFG_BUILD_DIR
148149
export CFG_VERSION
149150
export CFG_LLVM_ROOT
150151
export CFG_ENABLE_MINGW_CROSS

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,15 @@ probe_need CFG_PERL perl
200200
probe_need CFG_PYTHON python
201201
probe_need CFG_CURL curl
202202

203-
probe CFG_GIT git
203+
probe CFG_GIT git
204204
probe CFG_CLANG clang++
205205
probe CFG_GCC gcc
206206
probe CFG_LLVM_CONFIG llvm-config
207207
probe CFG_VALGRIND valgrind
208208
probe CFG_MAKEINFO makeinfo
209209
probe CFG_TEXI2PDF texi2pdf
210210
probe CFG_TEX tex
211+
probe CFG_MAKENSIS makensis
211212

212213
if [ -z "$CFG_CLANG" -a -z "$CFG_GCC" ]
213214
then

mk/dist.mk

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
# Distribution
33
######################################################################
44

5+
56
PKG_NAME := rust
67
PKG_VER = $(shell date +"%Y-%m-%d")-snap
78
PKG_DIR = $(PKG_NAME)-$(PKG_VER)
89
PKG_TAR = $(PKG_DIR).tar.gz
910

11+
ifdef CFG_MAKENSIS
12+
PKG_NSI = $(S)src/etc/pkg/rust.nsi
13+
PKG_EXE = $(PKG_DIR)-install.exe
14+
endif
15+
1016
PKG_3RDPARTY := rt/valgrind.h rt/memcheck.h \
1117
rt/isaac/rand.h rt/isaac/standard.h \
1218
rt/uthash/uthash.h rt/uthash/utlist.h \
@@ -29,9 +35,20 @@ PKG_FILES = \
2935
$(ALL_TEST_INPUTS) \
3036
$(GENERATED)
3137

32-
dist: $(PKG_TAR)
38+
dist: $(PKG_TAR) $(PKG_EXE)
39+
40+
nsis-dist: $(PKG_EXE)
41+
42+
lic.txt: $(S)LICENSE.txt
43+
@$(call E, crlf: $@)
44+
@$(Q)perl -pe 's@\n@\r\n@go' <$< >$@
45+
46+
$(PKG_EXE): $(PKG_NSI) $(PKG_FILES) $(DOCS) $(SREQ3) lic.txt
47+
@$(call E, makensis: $@)
48+
$(Q)makensis -NOCD -V1 "-XOutFile $@" "-XLicenseData lic.txt" $<
49+
$(Q)rm -f lic.txt
3350

34-
$(PKG_TAR): $(GENERATED)
51+
$(PKG_TAR): $(PKG_FILES)
3552
@$(call E, making dist dir)
3653
$(Q)rm -Rf dist
3754
$(Q)mkdir -p dist/$(PKG_DIR)

src/etc/pkg/rust.nsi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- shell-script -*-
2+
# (not really, but syntax is similar)
3+
#
4+
# This is a NSIS win32 installer script the Rust toolchain.
5+
#
6+
7+
Name "Rust"
8+
ShowInstDetails "show"
9+
ShowUninstDetails "show"
10+
SetCompressor "lzma"
11+
LicenseForceSelection checkbox
12+
13+
Page license
14+
Page components
15+
Page directory
16+
Page instfiles
17+
UninstPage uninstConfirm
18+
UninstPage instfiles
19+
20+
21+
Section "Compiler"
22+
SetOutPath $INSTDIR
23+
File /oname=rustc.exe stage3\rustc.exe
24+
File /oname=rustllvm.dll stage3\rustllvm.dll
25+
File /oname=rustrt.dll stage3\rustrt.dll
26+
File /oname=std.dll stage3\std.dll
27+
28+
SetOutPath $INSTDIR\lib
29+
File /oname=rustrt.dll stage3\lib\rustrt.dll
30+
File /oname=std.dll stage3\lib\std.dll
31+
File /oname=main.o stage3\lib\main.o
32+
File /oname=glue.o stage3\lib\glue.o
33+
SectionEnd
34+
35+
Section "Documentation"
36+
SetOutPath $INSTDIR\doc
37+
File /nonfatal /oname=rust.html doc\rust.html
38+
File /nonfatal /oname=rust.pdf doc\rust.pdf
39+
SectionEnd

0 commit comments

Comments
 (0)