Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 15th May 2008, 23:46   #1
strong_epoxy
Junior Member
 
Join Date: Jan 2007
Posts: 3
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...
strong_epoxy is offline   Reply With Quote
Old 16th May 2008, 00:17   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
no, but then you can make a very minimal installer of the type you describe with just this:

code:

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.
Animaether is offline   Reply With Quote
Old 16th May 2008, 09:34   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
Or even shorter,

OutFile file.exe
SilentInstall silent

Section
...
SectionEnd

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 16th May 2008, 10:32   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
Afrow's solution also generates a smaller executable.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th May 2008, 12:24   #5
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
fancy
Animaether is offline   Reply With Quote
Old 16th May 2008, 17:10   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
Silent installers get stripped of their resources and some language strings are also not included so the overhead is smaller.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th May 2008, 18:25   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
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
code:

cd /d %~dp0

upx %1


NSIS\packhdr\noicon.bat
code:

cd /d %~dp0

ResHacker -delete %1, %1, icongroup,103,
del ResHacker.log


NSIS\packhdr\noicon+upx.bat
code:

cd /d %~dp0

ResHacker -delete %1, %1, icongroup,103,
del ResHacker.log

upx %1



Example NSIS code to compress overhead and remove icon:
code:
!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

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump