Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic NSIS installer builder for Windows #5378

Merged
merged 4 commits into from
Jan 15, 2014
Merged

Conversation

ihnorton
Copy link
Member

This adds a script to build a Windows installer using NSIS, updates Makefile, and removes julia.bat (#4861).

Issues:

  • bare-bones, for now (no Start Menu shortcuts or registry entries)
  • uses LZMA so download is larger than current 7zip (~32->36 MB)

@ihnorton
Copy link
Member Author

Also building/compressing is slower (~2x?), but I guess that is only a problem for packagers.

@tknopp
Copy link
Contributor

tknopp commented Jan 13, 2014

This is great. One related comment. Once we start modifying environoment variables I would strongly encourage using either "large string" NSIS or "unicode" NSIS. The normal NSIS will corrupt e.g. PATH when it is longer than 1024 characters. With large string this limit is pushed to 8096 characters.

@ihnorton
Copy link
Member Author

@tknopp thanks, will do.

@vtjnash any thoughts? I looked at InnoSetup too, but the command line install seemed to be brittle and I want something that works smoothly in cross-compile for obvious reasons. NSIS seems fine, except for the package size. There are some more options I will play with to see if I can get it closer to what we have right now. FWIW, two people have used a package built with this branch, and said that everything worked fine.

@ihnorton
Copy link
Member Author

Hmm, Firefox uses NSIS to create an uncompressed installer, and then compresses it into a 7z sfx. Doesn't seem too hard, so I guess I'll do both and get max compression.

@IainNZ
Copy link
Member

IainNZ commented Jan 14, 2014

This will be great for getting the Windows people in my department onto Julia, the current install freaks them out a bit.

@@ -254,7 +251,7 @@ 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)
./dist-extras/nsis/makensis.exe /NOCD /DVersion=$(VERSDIR) /DArch=$(ARCH) /DCommit=$(JULIA_COMMIT) contrib/windows/build-installer.nsi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be written as: $(call spawn,./dist-extras/nsis/makensis.exe) so that it gets wrapped in a call to wine, if needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks. I wasn't sure about that, but It Worked For Me :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a kernel option. ubuntu turns it on so it just works. others don't

@vtjnash
Copy link
Member

vtjnash commented Jan 14, 2014

Is it possible to create a hierarchical installer? I'm thinking that we could just bundle the actual msysgit (InnoSetup) installer and offer it as an option during install. (https://code.google.com/p/msysgit/downloads/detail?name=Git-1.8.5.2-preview20131230.exe&can=2&q=)

Is it possible to mention somewhere in the installer that the user is practically encouraged to install this anywhere they want, including portable flash drives and home directories without admin privileges? It's probably a good idea to drop in a click-through license too.

uses LZMA so download is larger than current 7zip (~32->36 MB)

this difference is unimportant (I thought the 7z installer was also using a derivative of LZMA). as long as it isn't using zip (which compresses to about 100 MB, IIRC)

This will be great for getting the Windows people in my department onto Julia, the current install freaks them out a bit.

It's sad how Window's has taught people that installing software should be complicated, contain dozens of confusing options and break (permanently) if you do anything wrong. Anything less is unprofessional. (Linux isn't always that much better, but at least they seem to be hard at work on it).

Please go ahead and merge into master whenever you want.

@ihnorton
Copy link
Member Author

Yes, all of those are possible. For now I'll at least add the license click-through so it looks official for Iain.

@IainNZ
Copy link
Member

IainNZ commented Jan 14, 2014

Haha, nice. Don't forget to mention the bitcoin miner thread at the bottom of the EULA 👍

@StefanKarpinski
Copy link
Member

It's probably a good idea to drop in a click-through license too.

Why? What are they going to agree to? This seems pointless and annoying. Our installer should have as few steps as possible.

@JeffBezanson
Copy link
Member

Another -1 for click-thru license. It would just be a silly extra step.

@ihnorton
Copy link
Member Author

👍 less NSIS fussing for me!

@ihnorton
Copy link
Member Author

image

@vtjnash
Copy link
Member

vtjnash commented Jan 14, 2014

Privileges

@pao
Copy link
Member

pao commented Jan 14, 2014

Alternatives: "rights", "You do not need to be an Administrator." (The latter passes the Up-Goer 5 test, except for the jargon word Administrator, which might be good since we're probably not localizing this anytime soon.)

@tknopp
Copy link
Contributor

tknopp commented Jan 14, 2014

Why are Administrator privileges not required? If the user has no write access to C:\Program Files\ this will not be true.

@pao
Copy link
Member

pao commented Jan 14, 2014

True, that's conditional on selecting an alternate path.

@simonster
Copy link
Member

Not sure how hard this is, but you could make the installer default to %APPDATA\Local if the user doesn't have permissions to install in Program Files.

@ihnorton
Copy link
Member Author

@simonster well, the related question is whether or not to request elevated privileges at all. By default, it does. That can be disabled - but I don't think it can be made conditional (it's a property of the process). Do we want to allow/encourage system-wide installation?

@aviks
Copy link
Member

aviks commented Jan 14, 2014

If we do want to encourage system wide installation, but allow a fallback if privileges are not available, the message could be something along the lines of "Change the installation location to your home directory if you do not have administrator rights on this machine"

@nalimilan
Copy link
Member

I think R does something with the installer depending on whether the current user is administrator or not:
http://svn.r-project.org/R/trunk/src/gnuwin32/installer/code.iss

I don't remember what's the result exactly, but at least it allows installing both to a system directory with admin rights or to the home folder without.

@simonster
Copy link
Member

There is a UAC plugin for NSIS that I think allows privilege elevation on demand. See here for how the Firefox installer uses it.

I don't think we should hold up a better installer on this issue, though. The majority of systems only have a single user so I'm not sure the choice is especially important, but for now I'd support installing into %APPDATA, since APIs are still in flux and it may be better if individual users on a multi-user system have control over which version they're running.

@ihnorton
Copy link
Member Author

Thanks for the link. I had looked at that plugin briefly, and it appeared to be difficult to handle both the user- and admin- cases in the same executable. Maybe we can borrow the Firefox code eventually, I certainly don't want to figure all that out from scratch.

I was leaning toward the "portable app" style installer for the time being, so I'll merge this soon with a few changes: use Unicode NSIS, and default to %LOCALAPPDATA%. I added a line to tell the installer to open the target folder in Explorer after installation. Then we can iterate as needed (including about Start Menu shortcuts, which require elevation).

@joa-quim
Copy link

Please %APPDATA% and %LOCALAPPDATA% are hidden directories.
I always propose to install programs under "programs". If it doesn't exist, one will be created. "Program Files" has that idiot blank in the name that sooner or later will lead to troubles.

@ihnorton
Copy link
Member Author

There is an option to choose any directory before the installation proceeds.

@joa-quim
Copy link

Yes, but most people just click yes to what is proposed.

@simonster
Copy link
Member

While it's true that without a Start Menu shortcut it could be difficult to find, %LOCALAPPDATA% is the standard user application directory on Windows. Our default should either be to install there or in Program Files. Anywhere else is unusual for a Windows application.

@joa-quim
Copy link

Well, I don't have a single program installed in %LOCALAPPDATA%, though lots of them leave tons of (hidden) trash there after uninstallling.
Other places than Program Files might be unusual but they are not that rare and if Program Files is a bad place because of the space in the name, why supporting it?

@tknopp
Copy link
Contributor

tknopp commented Jan 14, 2014

Also vote for standard locations. But I don't see a pressing reason not to install into C:\Program Files. The debs and rpms will also be system wide. Why should this be different here?

@tknopp
Copy link
Contributor

tknopp commented Jan 14, 2014

@joa-quim why is the space an issue?

@joa-quim
Copy link

@tknopp Because if you have address to a full file name that has a space in the name without using quotes you'll get a file or command not found error.
I've seen lots of '...\Programs' not found errors.
Note that Cygwin proposes C:\cygwin
mingw c:\mingw
osgeo4win C:\OSGeo4W
GMT C:\programs\GMT (well, no wonder, it was me who did it)

@tknopp
Copy link
Contributor

tknopp commented Jan 14, 2014

yes thats an issue. But installing things to C: does not scale well and is non-standard. Lets better put julia into the PATH variable so that it is directly available from the command line.

@ihnorton
Copy link
Member Author

This is one of those meaning-of-life questions on Windows. I certainly understand that spaces can be annoying, but we should do the standard thing for the most common use case. People who have a strong opinion about installation location are free to change the directory.

Once this is merged then I will probably post a 0.3-pre installer package for people to try out; we can see how that goes, and people can make pull requests for further improvements.

@nalimilan
Copy link
Member

Applications/libraries that do not support spaces in paths are broken, period. Installing to Program files will be a good thing: it will help detecting and fixing them (if any), instead of bugging people with subtle issues. ;-)

@vtjnash
Copy link
Member

vtjnash commented Jan 14, 2014

Are we 32/64 bit aware in our choice of APPDATA directory?

@ihnorton
Copy link
Member Author

@vtjnash what is the difference?

This commit adds NSIS installer support for Julia on Windows.

The NSIS installer is built uncompressed, compressed by 7-zip,
then combined into a self-extracting archive using the 7zS.sfx
module from the 7-zip extras distribution. (Thanks to Firefox
for this idea).

The default install directory is %LOCALAPPDATA%, but the user
is prompted to choose a directory before installation. After
installation, the install directory is opened in Windows
Explorer.
* use Modern UI option for familiar look, and checkbox options at end
* checkbox options (default: checked)
    - open install folder
    - create start menu folder w/ shortcut
* use icon on the install page

Note: the most efficient way to hack on the NSIS file is to make a
dummy build folder with a few text files, and run `makensis` directly.
ihnorton added a commit that referenced this pull request Jan 15, 2014
Add basic NSIS installer builder for Windows
@ihnorton ihnorton merged commit 864ceb1 into JuliaLang:master Jan 15, 2014
@ihnorton
Copy link
Member Author

I used more NSIS features to make it look nicer, image links below. There is now an option to add Start Menu shortcuts on the final page (default: checked). Hopefully this will sufficiently cover the "can't find my %APPDATA%" use case for the average user who clicks through the defaults.

1st page
Installing
Final page

@ihnorton ihnorton deleted the nsis branch January 15, 2014 06:06
@ihnorton
Copy link
Member Author

A nice little touch would be to customize the SFX to use the nice Julia icon. I have some vague idea how to do this, but haven't tried yet. If somebody knows how or wants to try, please have at it.

@StefanKarpinski
Copy link
Member

This is such a huge "first date experience" improvement for Windows. Thanks so much for doing it.

@staticfloat
Copy link
Member

This is interfering with my linux nightly windows builds (ironic that I just managed to get them working a day or two ago!):

...
Processing archive: nsis-2.46.5-Unicode-setup.exe

file nsis\$PLUGINSDIR\modern-wizard.bmp
already exists. Overwrite with 
$PLUGINSDIR\modern-wizard.bmp?
(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit? 
ERROR: Can't allocate required memory!

It looks to me like NSIS is trying to ask for confirmation for something; can we force it to just go through with the operation?

@vtjnash
Copy link
Member

vtjnash commented Jan 16, 2014

Looks like ihnorton fixed that. Although at this point, it seems like the win-extras target (which started as a way for me to document the files I needed to manually download and extract to build binaries) is doing entirely too much as a shell script and not enough as a set of makefile rules.

@vtjnash
Copy link
Member

vtjnash commented Jan 16, 2014

The easiest way to add an icon may be to host a private copy of 7zS.sfx with the julia icon already swapped out in any windows resource editor (http://7zsfx.info/en/icon.html)

@ihnorton
Copy link
Member Author

@StefanKarpinski the retro terminal is now kind of bemusing.

@vtjnash a shell script might be a good idea so that it can be shared with Windows.mk...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.