included here is an NSIS installer for Windows. modify as needed.
Many thanks - I have checked that into the "scripts" directory with a longer file-name. I need to spend tome reading the nsis manual before I try it, and I may want to work out a strategy for me to cope with version numbers... but that is something I have wanted to get done for some time and your script is a big help. Arthur
you will need to copy the Processes.dll plugin from the following site into your plugins directory (C:\Program Files\NSIS\Plugins\)
it allows you to kill processes during uninstallation. in this case, anything with the name "reduce".
to compile the NSIS file, you need to
1. install NSIS compiler
2. start NSIS.
3. from the choices, choose "compile NSI scripts"
examine the file structure required for setup.nsi. I added 2 pdf's, the sl.pdf and the
note that the output for setup.nsi is not setup.exe, it is reduce-20090226-setup.exe. you set that within the setup.nsi file near the top on line 21 with the Outfile command.
working with NSIS is like working with a macro assembly language. it uses a stack for pretty much everything, including win32 calls as you will see within (the Mutex call for instance in .onInit function). except this language has functions. there is a .onInit function which you can define which is called before everything else on startup, and there is something like .uninit called just before uninstallation for initialization and happens before sections are executed.
sections that start with a - in the string part are executed /by default/ first before other sections. the string part of this section will not be shown, unlike other sections.
the string part of the section is what is shown as a checkbox in the installer in sections.
Every Section should have a corresponding
line (1 for each language) and a
line, (probably 1 for each language I think, and multiply that by the number of software components being installed - I really don't know how the languages thing works, I didn't look at that example, I only wrote for English, so look it up)
I changed my code and moved the pdf's into the reduce.doc directory, so the following changes need to be made on lines 257-258:
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\redlog.lnk" "$INSTDIR\reduce.doc\redlog.pdf"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\standard-lisp-manual.lnk" "$INSTDIR\reduce.doc\sl.pdf"
and lines 326-327:
at least I think that's what it is if I haven't changed a lot of stuff since posting.
I can't seem to repost the file.
this is the directory structure you should have when compiling.
corrected setup.nsi file
corrected setup.nsi file on this bug (figured out how) - wow sf.net UI has changed.
I forgot to mention that the way I wrote this setup.nsi file, it is a standalone setup file, it needs no outside files. basically, you place the .nsi file in the same directory as the files you wish to install, and when you compile, NSIS will add them
(compressed) using the File command into the setup .EXE, and because of the /r, it will keep the same directory structure. when you access the files using CopyFiles, you access them simply from "\whatever"
$SMPROGRAMS is the ...Start Menu\Programs. which user it is (all users or current user) is determined by
$INSTDIR is the
If you are distributing this on ISOs, $EXEDIR is the drive letter and directory path that setup is being executed from on the cd when it is in the drive. you use that in the Sections.
If you are making ISOs (for instance, if you distribute a linux, mac, and windows version), you will need an autorun.inf for windows use.
this makes the cd automatically run whatever you want (like a setup file) when the cd is inserted.
it basically contains 2 lines and is an ANSI text file created with NOTEPAD or similar text editor:
(it can even open a web page if you wish)
you can make ISO files using http://sf.net/projects/cdrtfe and copy the cygwin dll's from the cygwin directory into the cdrtools directory. then you can use mkisofs to make ISOs. mkisofs should be in your PATH or the path should be embedded in a batch file. If you wish I can attach a batch file I use to call mkisofs which reduces the typing to just 4 parameters: appid, publisher, volid, directory.
it is called makeiso.cmd.
well, that is NSIS in a nutshell. the rest is details in the manual and googling for answers. if you have any questions, don't hesitate to email me at
makeiso.cmd - batch file wraparound for mkisofs
sample autorun.inf for cd ISO.
I made a lot of unnecessary code using the CopyFiles command.
the Files command archives the files into the setup program, and when you run the installer, it uncompresses all the files into place for you. I found this out later.
I also learned that it's necessary to have the executable in the same directory as the .nsi installer script, or nothing (like the the program shortcuts you create) seems to work right.
the destination directory I chose was $PROGRAMFILES\Reduce\ through the command
which on most windows installations is C:\Program Files\reduce\. I chose not to date the destination directory in case someone wants to upgrade, they can upgrade in-place by the installer simply replacing files. If that is a problem during installation, simply add a
I am going to submit a setup.nsi file for the new version of reduce, this time with better documentation as to where to get the necessary NSIS plugins to compile the script. I don't think it requires anything special, but I want to make sure you have anything I've got so it works.
there is a separate include file for 64-bit OS detection and IF-then-else's if you ever get to that point.
there are some structural changes I needed to make to the latest release of the new setup.nsi as well, since I had not noticed that you put some newer pdfs in the docs directory. cool!
setup.nsi installer script for 20091021 with changes and some documentation
you will be able to find the installer at
the installer will expand the file structure I outlined into c:\program files\Reduce\
If you need a different directory because of vista/7 such as c:\reduce, let me know and I will change the InstallDir command in the script.
Installer code for windows in progress
Log in to post a comment.