Skip to content

Commit

Permalink
Improve some aspects of the NSIS installer (JuliaLang#31959)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9d6fffe)
  • Loading branch information
musm committed Aug 7, 2019
1 parent 7cfd2b4 commit cdd3f02
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 21 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ ifeq ($(OS), WINNT)
cd $(BUILDROOT)/julia-$(JULIA_COMMIT) && find * | sed -e 's/\//\\/g' -e 's/$$/\r/g' > etc/uninstall.log

# build nsis package
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DMUI_ICON="$(call cygpath_w,$(JULIAHOME)/contrib/windows/julia.ico)" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi) | iconv -f latin1
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DJULIAHOME="$(call cygpath_w,$(JULIAHOME))" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi) | iconv -f latin1

# compress nsis installer and combine with 7zip self-extracting header
cd $(BUILDROOT) && $(JULIAHOME)/dist-extras/7z a -mx9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
cd $(BUILDROOT) && $(JULIAHOME)/dist-extras/7z a -mx=9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
cd $(BUILDROOT) && cat $(JULIAHOME)/contrib/windows/7zS.sfx $(JULIAHOME)/contrib/windows/7zSFX-config.txt "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" > "$(JULIA_BINARYDIST_FILENAME).exe"
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"
-rm -f $(BUILDROOT)/julia-install-$(JULIA_COMMIT)-$(ARCH).7z
Expand Down Expand Up @@ -580,11 +580,11 @@ else
$(error no win-extras target for ARCH=$(ARCH))
endif
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) http://downloads.sourceforge.net/sevenzip/7z1805-extra.7z && \
$(JLDOWNLOAD) https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/unsis/nsis-2.46.5-Unicode-setup.exe && \
$(JLDOWNLOAD) https://sourceforge.net/projects/nsis/files/NSIS%203/3.04/nsis-3.04-setup.exe && \
$(JLCHECKSUM) nsis-3.04-setup.exe && \
chmod a+x 7z.exe && \
chmod a+x 7z.dll && \
$(call spawn,./7z.exe) x -y -onsis nsis-2.46.5-Unicode-setup.exe && \
$(call spawn,./7z.exe) x -y -onsis nsis-3.04-setup.exe && \
chmod a+x ./nsis/makensis.exe

# various statistics about the build that may interest the user
Expand Down
67 changes: 51 additions & 16 deletions contrib/windows/build-installer.nsi
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
Unicode true

!include "MUI2.nsh"
!include "nsDialogs.nsh"
!include "winmessages.nsh"

Name "The Julia Language"
OutFile "julia-installer.exe"
SetCompress off
CRCCheck on
CRCCheck off
SetDataBlockOptimize on
ShowInstDetails show
ShowInstDetails nevershow
RequestExecutionLevel user
BrandingText "Julia ${Version}"
BrandingText " "

!define /date YEAR "%Y"

Name "Julia"
VIProductVersion "10.20.0.0" # arbitrary value since it doesn't mater, but is required; format must be X.X.X.X
VIAddVersionKey "ProductName" "Julia"
VIAddVersionKey "CompanyName " "Julia Language"
VIAddVersionKey "ProductVersion" "${Version}"
VIAddVersionKey "FileDescription" "Julia Language Installer"
VIAddVersionKey "Comments" "https://julialang.org/"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2009-${YEAR} Julia Language"
VIAddVersionKey "FileVersion" ""

Caption "Julia Installer" # title bar

!define MUI_ICON "${JULIAHOME}\contrib\windows\julia.ico"
!define MUI_UNICON "${JULIAHOME}\contrib\windows\julia.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "${JULIAHOME}\contrib\windows\julia-banner.bmp"

# Uninstall settings
!define UninstLog "uninstall.log"
Expand Down Expand Up @@ -38,25 +57,43 @@ InstallDir "$LOCALAPPDATA\Julia-${Version}"
!define JuliaStartMenuFolder "Julia ${Version}"

# Page settings
# Note that we repurpose the checkboxes on the FinishPage
# in order to keep it simple.
!define MUI_DIRECTORYPAGE_TEXT_TOP "Julia may be installed in any accessible directory, including a home folder or portable device. Please run as Administrator to install for system-wide use."
# Note that we repurpose the checkboxes on the FinishPage in order to keep it simple.
!define MUI_DIRECTORYPAGE_TEXT_TOP "Julia may be installed in any accessible directory.$\r$\n$\r$\nPlease run installer as Administrator to install Julia system-wide."
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Start Menu folder and shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION AddToStartMenu

!define MUI_WELCOMEPAGE_TITLE "Welcome to Julia ${Version}"
!define MUI_WELCOMEPAGE_TEXT "Setup will guide you through installation.$\r$\n$\r$\nClick Next to continue."
!define MUI_FINISHPAGE_TITLE "Julia installation complete"
!define MUI_FINISHPAGE_TEXT "Julia has been successfully installed.$\r$\n$\r$\nClick Finish to close the installer."

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Open Julia install folder"
!define MUI_FINISHPAGE_RUN_TEXT "Open the Julia install folder"
!define MUI_FINISHPAGE_RUN_FUNCTION ShowInstallFolder

# Pages to show
!define MUI_UNCONFIRMPAGE_TEXT_TOP "Julia will be uninstalled from the following folder."
!define MUI_UNCONFIRMPAGE_TEXT_LOCATION "Uninstalling from"

# Pages to show
!define MUI_PAGE_HEADER_TEXT "Choose Installation Directory"
!define MUI_PAGE_HEADER_SUBTEXT ""
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Section
!insertmacro MUI_HEADER_TEXT "Installing" ""
SectionEnd

!define MUI_PAGE_CUSTOMFUNCTION_SHOW desktopCheckbox
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE createDesktopLink
!insertmacro MUI_PAGE_FINISH

!define MUI_PAGE_HEADER_TEXT "Uninstall Julia"
!define MUI_PAGE_HEADER_SUBTEXT ""
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

# Add/Remove Programs entry
Expand All @@ -65,14 +102,14 @@ InstallDir "$LOCALAPPDATA\Julia-${Version}"
Section "Dummy Section" SecDummy
SetOutPath $INSTDIR
File /a /r "julia-${Commit}\*"
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateShortcut "$INSTDIR\julia.lnk" "$INSTDIR\bin\julia.exe"

# ARP entries
WriteRegStr HKCU "${ARP}" \
"DisplayName" "Julia Language ${Version}"
"DisplayName" "Julia ${Version}"
WriteRegStr HKCU "${ARP}" \
"Publisher" "The Julia Project"
"Publisher" "Julia Language"
WriteRegStr HKCU "${ARP}" \
"DisplayIcon" "$INSTDIR\bin\julia.exe"
WriteRegStr HKCU "${ARP}" \
Expand Down Expand Up @@ -145,13 +182,11 @@ SectionEnd
# Helper function to create Start Menu folder and shortcuts
Function AddToStartMenu
CreateDirectory "$SMPROGRAMS\${JuliaStartMenuFolder}"
CreateShortcut "$SMPROGRAMS\${JuliaStartMenuFolder}\julia-${Version}.lnk" "$INSTDIR\julia.lnk" "" "" "" "" "" "The Julia Language"
CreateShortcut "$SMPROGRAMS\${JuliaStartMenuFolder}\Uninstall-Julia-${Version}.lnk" "$instdir\Uninstall.exe"
CreateShortcut "$SMPROGRAMS\${JuliaStartMenuFolder}\julia-${Version}.lnk" "$INSTDIR\julia.lnk" "" "" "" "" "" "Julia"
CreateShortcut "$SMPROGRAMS\${JuliaStartMenuFolder}\Uninstall-Julia-${Version}.lnk" "$instdir\uninstall.exe"
FunctionEnd

# Opens the installation folder
Function ShowInstallFolder
ExecShell "open" $INSTDIR
FunctionEnd


Binary file added contrib/windows/julia-banner.bmp
Binary file not shown.
1 change: 1 addition & 0 deletions deps/checksums/nsis-3.04-setup.exe/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3c93427c56714478bb5a7a4bbaab934f
1 change: 1 addition & 0 deletions deps/checksums/nsis-3.04-setup.exe/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
55142f5eeada65f18f6de950ead5342d78e1a4a01b7620d02dae2fbd3f0d963db482f5a63939131e81a78b458c5306f600578ab96891b0661cb0b74be1f7636d

0 comments on commit cdd3f02

Please sign in to comment.