Win32 NSIS installer
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?
Hello Chris, I did the most recent changes in the installer. I welcome any help and advise. I made a wiki page http://wiki.inkscape.org/wiki/index.php/Win32_Installer but this might not be up to date.
Things that where on my agenda are: - let the user choose language: there is an issue in launchpad - check what is needed for a portable apps package - create a msi package: there is an issue in launchpad
Pls let me know your thoughts.
HTH, Adib. Chris Morgan wrote:
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... mailto: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?
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Comments on the said wiki page about the win32 installer:
- MSI installer, not a good idea. - Reported problems: first three a real bug, I fixed it. - Uninstaller not working for limited users etc.: I think this is an issue with the multi-user/single-user thing, and I've fixed that. I think that fixes the first three points in that section. - Uninstaller deletes $INSTDIR: that is (no longer?) the case. RMDir $INSTDIR is the closest it gets - and without /s it doesn't force it. - Problems and Questions -> Languages: use the MUI_LANGDLL_DISPLAY code and all. I can swing that. Then also make it only install up to one extra language by default - the user's selected language.
As for my other comments which I've already said in my initial, I think I'll just do them and then tell you :-)
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?
On Jul 28, 2009, at 11:27 PM, Chris Morgan wrote:
Comments on the said wiki page about the win32 installer: MSI installer, not a good idea.
Actually I think it's a very needed item.
More and more, large institutions (universities, companies, etc.) want MSI's. If there is a version for windows that is MSI, then we can get more adoption in those areas.
I don't think this might be best for 0.47, but is something to keep in mind. Personally I think it would be good if some group out there could setup up and provide some bodies to actually do the MSI. :-)
On Sat, Aug 1, 2009 at 12:58 PM, Jon A. Cruz <jon@...18...> wrote:
On Jul 28, 2009, at 11:27 PM, Chris Morgan wrote:
Comments on the said wiki page about the win32 installer:
- MSI installer, not a good idea.
Actually I think it's a very needed item. More and more, large institutions (universities, companies, etc.) want MSI's. If there is a version for windows that is MSI, then we can get more adoption in those areas.
But *why*? What benefits are there from it? In my experience, there are only disadvantages in the MSI format.
I don't think this might be best for 0.47, but is something to keep in mind. Personally I think it would be good if some group out there could setup up and provide some bodies to actually do the MSI. :-)
I've looked at code for MSI things and I think I could bone up on them enough to do one but I don't want to unless a serious reason for it. I can only think of a couple of instances where open source apps have used MSI packaging... 7-Zip 64-bit is one instance... though I don't understand why - NSIS supports 64-bit just as well. Hey, is there any Inkscapey goodness for 64-bit Windows?
-- 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?
On Jul 31, 2009, at 8:23 PM, Chris Morgan wrote:
More and more, large institutions (universities, companies, etc.) want MSI's. If there is a version for windows that is MSI, then we can get more adoption in those areas. But why? What benefits are there from it? In my experience, there are only disadvantages in the MSI format.
I don't think this might be best for 0.47, but is something to keep in mind. Personally I think it would be good if some group out there could setup up and provide some bodies to actually do the MSI. :-) I've looked at code for MSI things and I think I could bone up on them enough to do one but I don't want to unless a serious reason for it. I can only think of a couple of instances where open source apps have used MSI packaging... 7-Zip 64-bit is one instance... though I don't understand why - NSIS supports 64-bit just as well. Hey, is there any Inkscapey goodness for 64-bit Windows?
For the way that certain organizations run their administration of their Windows systems, a MSI is the main way to go.
It's similar to packaging in .rpm for a company centralized on YUM.
On Sat, 2009-08-01 at 13:23 +1000, Chris Morgan wrote:
I've looked at code for MSI things and I think I could bone up on them enough to do one but I don't want to unless a serious reason for it. I can only think of a couple of instances where open source apps have used MSI packaging... 7-Zip 64-bit is one instance... though I don't understand why - NSIS supports 64-bit just as well. Hey, is there any Inkscapey goodness for 64-bit Windows?
MSI's are typically used for software management in larger settings. It's eases deployment and management for the IT staff. Even if we're not big in the enterprise realm at this point, think of the usefulness of this for educational institutions (I'm mentioning this because I've had this requested in person at a conference).
As for 64-bit versions for Windows, there have been none officially released by the project and I have seen nothing in the wild.
Cheers, Josh
I just took a look at the uninstallation log section - for an installation of Inkscape, uninstall.log was *16MB*. Removing the common "C:\Program Files\Inkscape" saved about 5MB, that's easy enough to change in it. I propose that eithera) we change it so it doesn't store any checksum at all and just deletes all the files it created, for which we can use an official script header, Memento or something I think it was called, and I'd expect its output to be smaller but don't know how much smaller, or b) we switch from MD5 checksums to CRC32 checksums with http://nsis.sourceforge.net/CRC_generator_plugin which will make a 10 character (hex) checksum instead of a 32 character (hex) checksum, which will shrink it about another 4MB.
Opinions would be nice.
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?
Hi, I should have my basic theme ported to Drupal during this weekend. It currently looks like this [1], and when finished it will look like this [2]. Could I use inkscape.org/drupal as a test site? I would need account with privileges to create content and custom views and to upload template files.
[1] http://wstaw.org/p/23da [2] http://wstaw.org/p/23ddOn 07/29/2009 11:18:23 AM, Chris Morgan wrote:
On 07/29/2009 08:00:11 AM, Chris Morgan wrote:
The whole website redesign to Drupal project seems to have gone stale; my suggestion is that I take it over and come up with something. The pertinent detail for this discussion is that then we could use Drupal forums, which in my opinion are the best available; as an example of a good implementation (though I had nothing to do with it), our forums at PortableApps.comhttp://portableapps.com/forums. I've got the Drupal experience necessary to do the theming and site setup, and am coming up with a design based on one of the others submitted in the original DeviantArt topic. If you like, I'll continue on making a prototype and provide a test site online.
Next increment. I did a few things, but mainly it's the icon, and installer images which I did. I also added a "DUMMYINSTALL" define which I used for quick testing - it skips all the sections and evaluates an empty one, so that it generates the installer very quickly.
Having tried the inkscape logo and the cup from the splash in the welcome/finish page, I decided the cup looked better.
I'd still like comments on the checksum method. I'm working on changing the whole uninstall log method too - it's *very* inefficient as it currently is.
-- 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?
Hello Chris,
regarding the uninstall; it should do following tasks: - delete the files that where installed - let the user choose for changed files - do not delete user created files
in the past 0.46 time the uninstaller removed all the files from the install directory (delete *.*). There where a few problems. - one user installed on c:\Program Files instead C:\Program Files\Inkscape ; very bad uninstall - some user add templates - some user changed the templates - you need to detect file change not by date/size but by content
I found a script on the nsis site that addresses those problems using the md5 sums. That script I modified and used it for the 0.46 uninstaller. Yes, it takes a very long time. But I think it is worth to address the problems above. Let me know how you can speed up the method.
Thanks again for your effort.
Adib.
On Sat, Aug 1, 2009 at 3:31 AM, Chris Morgan<chris.morganiser@...400...> wrote:
Next increment. I did a few things, but mainly it's the icon, and installer images which I did. I also added a "DUMMYINSTALL" define which I used for quick testing - it skips all the sections and evaluates an empty one, so that it generates the installer very quickly. Having tried the inkscape logo and the cup from the splash in the welcome/finish page, I decided the cup looked better. I'd still like comments on the checksum method. I'm working on changing the whole uninstall log method too - it's very inefficient as it currently is.
-- 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?
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On Sat, Aug 1, 2009 at 6:55 PM, the Adib <theadib@...1439...> wrote:
Hello Chris,
regarding the uninstall; it should do following tasks:
- delete the files that where installed
- let the user choose for changed files
- do not delete user created files
I picked up that much from the installer.
in the past 0.46 time the uninstaller removed all the files from the
install directory (delete *.*). There where a few problems.
- one user installed on c:\Program Files instead C:\Program
Files\Inkscape ; very bad uninstall
- some user add templates
- some user changed the templates
- you need to detect file change not by date/size but by content
I found a script on the nsis site that addresses those problems using the md5 sums. That script I modified and used it for the 0.46 uninstaller. Yes, it takes a very long time. But I think it is worth to address the problems above. Let me know how you can speed up the method.
The method used opens and closes the install log lots of times. Each time you open it, it scans the directory, and then when you close it, it scans it again and saves the diff. The whole process will be considerably faster if just done once at start and end. Currently also the MD5 creation is separate from that; it could be made more efficient by merging the two steps. I'm proposing a switch to CRC32 checksums purely for the reason of storage; it saves almost 9MB. I'm not sure what speed is like, but I would expect CRC32 to be faster as well, as it is a simpler routine, I understand.
Thanks again for your effort.
Don't think I'm doing this for you - when one sees something which needs fixing, ... ;-) :P I do enjoy doing it though, this and the website stuff :-)
-- 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?
...
the md5 sums. That script I modified and used it for the 0.46
uninstaller. Yes, it takes a very long time. But I think it is worth to address the problems above. Let me know how you can speed up the method.
The method used opens and closes the install log lots of times. Each time you open it, it scans the directory, and then when you close it, it scans it again and saves the diff. The whole process will be considerably faster if just done once at start and end. Currently also the MD5 creation is separate from that; it could be made more efficient by merging the two steps. I'm proposing a switch to CRC32 checksums purely for the reason of storage; it saves almost 9MB. I'm not sure what speed is like, but I would expect CRC32 to be faster as well, as it is a simpler routine, I understand.
If you can merge the steps that would be great. Regarding speed and size; I think we can stay with MD5. 9MB does not matter compared with the whole size of the package.
my 2 ct.
Adib.
Thanks again for your effort.
Don't think I'm doing this for you - when one sees something which needs fixing, ... ;-) :P I do enjoy doing it though, this and the website stuff :-)
-- 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?
On Aug 1, 2009, at 2:10 AM, Chris Morgan wrote:
CRC32 checksums purely for the reason of storage; it saves almost 9MB. I'm not sure what speed is like, but I would expect CRC32 to be faster as well, as it is a simpler routine, I understand.
Well... for a baseline Windows machine (even the cheapest Dell I could find) things starting at 320GB are around the minimum nowadays. That would translate to saving 0.0003% on a new low-end PC's hard drive.
Probably a better number might be to see what % of the overall Inkscape use that would be.
Anyway, for many use cases size is not the main factor. For some it might be, though, so we should identify those.
With CRC32 there is a much higher chance of false matches than with MD5.
So it basically comes down to a size-vs-safety tradeoff.
I have now committed this. Now I'm continuing to work on the language support as I judge it to be more important than the uninstallation stuff.
On Sat, Aug 1, 2009 at 11:31 AM, Chris Morgan <chris.morganiser@...400...>wrote:
Next increment. I did a few things, but mainly it's the icon, and installer images which I did. I also added a "DUMMYINSTALL" define which I used for quick testing - it skips all the sections and evaluates an empty one, so that it generates the installer very quickly.
Having tried the inkscape logo and the cup from the splash in the welcome/finish page, I decided the cup looked better.
I'd still like comments on the checksum method. I'm working on changing the whole uninstall log method too - it's *very* inefficient as it currently is.
-- 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?
Thanks,
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?
On Mon, Aug 3, 2009 at 9:09 PM, Chris Morgan <chris.morganiser@...400...>wrote:
I have now committed this. Now I'm continuing to work on the language support as I judge it to be more important than the uninstallation stuff.
I have now committed this also. It worked more easily than I had hoped which is good :-). Noteworthy though are that the NSIS language "TradChinese" is "ChineseTaiwan" in Inkscape, and "Galician" (correct) is "Gallegan" in Inkscape (which appears to be incorrect/deprecated/something). I'm wondering about whether I should create a whole host of other language files so they can be selected by default - they'd only have the NSIS strings pre-translated, not the Inkscape-specific ones (yet), but it'd be easier for users to use. Currently if they select English, they'll have to select their own language, as they're all now deselected by default :-) (the installer language section is selected, e.g. if you choose Spanish, the Spanish files will be selected by default).
-- 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?
participants (6)
-
Adib taraben
-
Chris Morgan
-
Jarosław Foksa
-
Jon A. Cruz
-
Joshua A. Andler
-
the Adib