Hi all, Today I decided to take a look at the NSIS installer for Win32, and decided to optimise it. It currently uses a macro and function for reading options from the command line. Since then, FileFunc.nsh has had added to it the GetParameters and GetOptions macros, which make the code inside the installer obsolete. I was amused to see that the option-reading code was made by (a different) Chris Morgan in 2004! For your assurance that I hopefully know what I'm doing, I have had lots of NSIS experience, mainly at PortableApps.com, where our launchers and installer are in NSIS. NSIS is an area I can help in, unlike the one I wanted to do more, https://bugs.launchpad.net/inkscape/+bug/398603, which I'd like to fix but can't really.
I also optimised readability and similar through the use of LogicLib's logical code structures.
I cleaned up the language sections significantly, using a single macro rather than a section for each, containing a macro. In all of them, polng was equal to lng, with the exception of Japanese which had, incorrectly, jp rather than ja for lng. lng was only used for "....\inkscape*.${lng}.txt" anyway - a mask which matches no files for any language. I'd propose that that line be vanquished as it's not used (historical?). In the meantime, I simplified it into one argument for the two. More on languages later.
While doing this I found about half a dozen minor bugs, all of which I've fixed. Starting at line 1382 (old), that set of things had the conditions the wrong way around, so it would only print the detail if it was *empty*, rather than if it was something... utterly insignificant, but a bug :D More importantly, all the code around that section was inefficient, I rearranged it to make it more efficient. Also the deleting HKCU.svg[z] thing was looking for the wrong thing, fixed that.
The biggest bug I found was that single-user installations didn't work (at least judging by the code). The shell var context had been formerly set to "all", and the all users section set it to "all" and had a bit of code which wouldn't ever get executed. I got around this the easiest way, which was just to create an unshown section before it to SetShellVarContext current.
All in all, I took it down from 1559 lines (47,874 bytes) to 930 lines (34,534 bytes) (60% of the lines, 72% of the filesize), shrunk the installer output by about 25KB (0.07% :P), fixed some bugs and made it more readable in the process.
Now for some discussion on what I reckon having looked at it.
Languages: I can optimise those still further, just thought I'd send round what I'd got so far. In particular, I want to change it so that no languages are installed by default; this would speed up installation on Windows exponentially - due to the LZMA solid compression used, each language takes an inordinate time to install. I think I can fix that up too, but I'll need to experiment on it a bit. Moving the files first should help in the technique... I'll try it out and report back. However, back on the main topic, I want to change it so English is not shown on the list (it's really pretty meaningless, it's an empty section... and the SectionGroup is "Translations" of the interface, English is pretty much a given), and so that the only language which is installed is that which the installer is running in. I can do that easily enough. Possibly also the MUI LANGDLL should be displayed to let the user choose the initial language.
Presets: we've got the SectionIn 1 2 3 bits all over the place, but aren't using the presets at all (any more I guess from commented out code). I think they should be added back, that way you can have all languages in full, the suggested one in optimal and none in minimal. Also I think that quick launch and desktop icons should be on by default.
Start menu: currently this is forced on, in a set location, which isn't very nice. We should use the MUI STARTMENU stuff.
I also think that a lot of the DetailPrint bits should be cleaned up to either be removed or so they can be more useful.
The welcome and finish pages should get their own images, I'll make a proposal for it. Also the header image should get the new logo; likewise I can do that.
Right, I think that's enough for now, though I've probably forgotten something I was going to say, and missed a bug or two I fixed.
-- Chris Morgan <chris.morganiser@...400...>
I don't need a quote in my signature. It's hard enough surviving as it is without having to find a meaningful quote. Will you forgive me? Or don't you read this bit?