Skip to content

Commit

Permalink
Merge pull request #5378 from ihnorton/nsis
Browse files Browse the repository at this point in the history
Add basic NSIS installer builder for Windows
  • Loading branch information
ihnorton committed Jan 15, 2014
2 parents 202668d + 263e3b0 commit 864ceb1
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 24 deletions.
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ endif
$(INSTALL_F) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
$(INSTALL_F) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.$(SHLIB_EXT) $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
# Copy in all .jl sources as well
cp -R -L $(BUILD)/share/julia $(DESTDIR)$(PREFIX)/share/
ifeq ($(OS), WINNT)
cp $(JULIAHOME)/contrib/windows/*.bat $(DESTDIR)$(PREFIX)
endif
cp -R -L $(BUILD)/share/julia $(DESTDIR)$(PREFIX)/share/
# Copy in beautiful new man page!
$(INSTALL_F) $(BUILD)/share/man/man1/julia.1 $(DESTDIR)$(PREFIX)/share/man/man1/
# Copy etc/julia directory to SYSCONFIGDIR if it is set, otherwise to just $(PREFIX)/etc/
Expand All @@ -222,9 +219,10 @@ else
cp -R $(BUILD)/etc/julia $(DESTDIR)$(PREFIX)/etc/
endif

dist-clean:
rm -fr julia-*.tar.gz julia-*.exe julia-*.7z julia-$(JULIA_COMMIT)

dist:
rm -fr julia-*.tar.gz julia-*.exe julia-$(JULIA_COMMIT)
dist: dist-clean
ifeq ($(USE_SYSTEM_BLAS),0)
ifneq ($(OPENBLAS_DYNAMIC_ARCH),1)
@echo OpenBLAS must be rebuilt with OPENBLAS_DYNAMIC_ARCH=1 to use dist target
Expand Down Expand Up @@ -254,7 +252,9 @@ ifeq ($(OS), WINNT)
mkdir ../$(PREFIX)/Git && \
7z x PortableGit.7z -o"../$(PREFIX)/Git" )
cd $(DESTDIR)$(PREFIX)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
./dist-extras/7z a -mx9 -sfx7z.sfx julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).exe julia-$(JULIA_COMMIT)
$(call spawn,./dist-extras/nsis/makensis.exe) /NOCD /DVersion=$(VERSDIR) /DArch=$(ARCH) /DCommit=$(JULIA_COMMIT) ./contrib/windows/build-installer.nsi
./dist-extras/7z a -mx9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
cat ./dist-extras/7zS.sfx ./contrib/windows/7zSFX-config.txt "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" > "Julia Installer ${VERSDIR}-${ARCH}.exe"
else
tar zcvf julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).tar.gz julia-$(JULIA_COMMIT)
endif
Expand Down Expand Up @@ -324,22 +324,26 @@ endif
ifneq (,$(filter $(ARCH), i386 i486 i586 i686))
cd dist-extras && \
wget -O 7z920.exe http://downloads.sourceforge.net/sevenzip/7z920.exe && \
7z x -y 7z920.exe 7z.exe 7z.dll 7z.sfx && \
7z x -y 7z920.exe 7z.exe 7z.dll && \
wget -O mingw-libexpat.rpm http://download.opensuse.org/repositories/windows:/mingw:/win32/SLE_11_SP3/noarch/mingw32-libexpat-2.0.1-5.3.noarch.rpm && \
wget -O mingw-zlib.rpm http://download.opensuse.org/repositories/windows:/mingw:/win32/SLE_11_SP3/noarch/mingw32-zlib-1.2.7-2.4.noarch.rpm
else ifeq ($(ARCH),x86_64)
cd dist-extras && \
wget -O 7z920-x64.msi http://downloads.sourceforge.net/sevenzip/7z920-x64.msi && \
7z x -y 7z920-x64.msi _7z.exe _7z.dll _7z.sfx && \
7z x -y 7z920-x64.msi _7z.exe _7z.dll && \
mv _7z.dll 7z.dll && \
mv _7z.exe 7z.exe && \
mv _7z.sfx 7z.sfx && \
wget -O mingw-libexpat.rpm http://download.opensuse.org/repositories/windows:/mingw:/win64/SLE_11_SP3/noarch/mingw64-libexpat-2.0.1-4.3.noarch.rpm && \
wget -O mingw-zlib.rpm http://download.opensuse.org/repositories/windows:/mingw:/win64/SLE_11_SP3/noarch/mingw64-zlib-1.2.7-2.4.noarch.rpm
else
$(error no win-extras target for ARCH=$(ARCH))
endif
cd dist-extras && \
wget -O 7z920_extra.7z http://downloads.sourceforge.net/sevenzip/7z920_extra.7z && \
7z x -y 7z920_extra.7z 7zS.sfx && \
wget -O nsis-2.46.5-Unicode-setup.exe https://unsis.googlecode.com/files/nsis-2.46.5-Unicode-setup.exe && \
$(call spawn,./7z.exe) x -onsis nsis-2.46.5-Unicode-setup.exe && \
chmod a+x ./nsis/makensis.exe && \
chmod a+x 7z.exe && \
7z x -y mingw-libexpat.rpm -so > mingw-libexpat.cpio && \
7z e -y mingw-libexpat.cpio && \
Expand Down
4 changes: 4 additions & 0 deletions contrib/windows/7zSFX-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
;!@Install@!UTF-8!
Title="The Julia Language"
RunProgram="julia-installer.exe"
;!@InstallEnd@!
60 changes: 60 additions & 0 deletions contrib/windows/build-installer.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
!include "MUI.nsh"

Name "The Julia Language"
OutFile "julia-installer.exe"
SetCompress off
CRCCheck on
SetDataBlockOptimize on
ShowInstDetails show
RequestExecutionLevel user

# Icon settings
!define MUI_ICON "contrib\windows\julia.ico"

# Variable definitions used in installer pages
InstallDir "$LOCALAPPDATA\Julia ${Version}"
!define StartMenuFolder "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."
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Start Menu folder and shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION AddToStartMenu
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Open Julia install folder"
!define MUI_FINISHPAGE_RUN_FUNCTION ShowInstallFolder

# Pages to show

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy
SetOutPath $INSTDIR
File /a /r "julia-${Commit}\*"
WriteUninstaller "$INSTDIR\Uninstall.exe"
CreateShortcut "$INSTDIR\julia.lnk" "$INSTDIR\bin\julia-readline.exe"
SectionEnd

Section "uninstall"
Delete "$INSTDIR/uninstall.exe"
RMDir /r "$SMPROGRAMS\${StartMenuFolder}"
RMDir /r "$INSTDIR/"
SectionEnd

# Helper function to create Start Menu folder and shortcuts
Function AddToStartMenu
CreateDirectory "$SMPROGRAMS\${StartMenuFolder}"
CreateShortcut "$SMPROGRAMS\${StartMenuFolder}\julia.lnk" "$INSTDIR\julia.lnk" "" "" "" "" "" "The Julia Language"
CreateShortcut "$SMPROGRAMS\${StartMenuFolder}\Uninstall.lnk" "$instdir\Uninstall.exe"
FunctionEnd
Function ShowInstallFolder
ExecShell "open" $INSTDIR
FunctionEnd


14 changes: 0 additions & 14 deletions contrib/windows/julia.bat

This file was deleted.

0 comments on commit 864ceb1

Please sign in to comment.