strong_epoxy
16th May 2008 00:46 UTC
NSIS with main() function and no others or sections or pages?
Is there a stripped down version of NSIS that doesn't require sections, pages, or other built in functions.
In other words, a generalized scripting system supporting all the NSIS great functions and plugins, but doesn't require the install domain specific sections, pages, or install specific callback functions.
The only required function would be main()
That'd be hot...
Animaether
16th May 2008 01:17 UTC
no, but then you can make a very minimal installer of the type you describe with just this:
OutFile "Setup.exe"
Section ""
SectionEnd
Function .onInit
; your code here
Abort
FunctionEnd
Put the code you want in .onInit. The 'Abort' at the end will make the installer exit immediately, without any UI being loaded, etc. At the top you might still want to specify a compressor, but for the sake of minimalism.. the above is it.
Afrow UK
16th May 2008 10:34 UTC
Or even shorter,
OutFile file.exe
SilentInstall silent
Section
...
SectionEnd
Stu
kichik
16th May 2008 11:32 UTC
Afrow's solution also generates a smaller executable.
Animaether
16th May 2008 13:24 UTC
fancy :)
kichik
16th May 2008 18:10 UTC
Silent installers get stripped of their resources and some language strings are also not included so the overhead is smaller.
Afrow UK
16th May 2008 19:25 UTC
And if you want it even smaller, you can use UPX to pack the overhead and then you can remove the icon with Resource Hacker, both by using !packhdr. You can't use !packhdr more than once so you need to use batch scripts.
Just to share with everyone, the batches I use in every installer I make:
NSIS\packhdr\upx.bat
cd /d %~dp0
upx %1
NSIS\packhdr\noicon.bat
cd /d %~dp0
ResHacker -delete %1, %1, icongroup,103,
del ResHacker.log
NSIS\packhdr\noicon+upx.bat
cd /d %~dp0
ResHacker -delete %1, %1, icongroup,103,
del ResHacker.log
upx %1
Example NSIS code to compress overhead and remove icon:
!packhdr $%TEMP%\exehead.tmp `"${NSISDIR}\packhdr\noicon+upx.bat" "$%TEMP%\exehead.tmp"`
You need to extract Resource Hacker and UPX to NSIS\packhdr as well of course.
http://angusj.com/resourcehacker/
http://upx.sourceforge.net/
Stu