Old 10th January 2002, 07:08   #1
hotice
Member
 
Join Date: Dec 2001
Posts: 57
how to use upx to compress exe first before make installer

for example
I have a a.exe in disk c.
I wrote ExecWait("c:\upx -9 c:\a.exe") in a Section named a at the beginning of the script file, it is no use.
If I wrote same line in Section "Copy Files", it will excute when I run the installer and it is not what i want.
hotice is offline   Reply With Quote
Old 10th January 2002, 07:24   #2
flizebogen
Senior Member
 
Join Date: Jan 2002
Location: Berlin
Posts: 171
But what do you want exactly?

You can use UPX to compress the Header of the Installer by using the following command at the beginning of the script

!packhdr "temp.dat" "C:\Programme\NSIS\upx.exe --best temp.dat"

But if you want to compress a file that you want to include in the installer you have to do it either before you built the installer or you call UPX after file was installed.
flizebogen is offline   Reply With Quote
Old 10th January 2002, 08:34   #3
hotice
Member
 
Join Date: Dec 2001
Posts: 57
but i don't think so

Quote:
Originally posted by flizebogen
But what do you want exactly?


But if you want to compress a file that you want to include in the installer you have to do it either before you built the installer or you call UPX after file was installed.
YES1
Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "sarp.bmp"

File /oname=spltmp.exe "C:\program files\nsis\splash.exe"
ExecWait '"$TEMP\spltmp.exe" 1000 $HWNDPARENT $TEMP\spltmp'
Delete $TEMP\spltmp.exe
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
hotice is offline   Reply With Quote
Old 10th January 2002, 19:30   #4
Kreft
Member
 
Join Date: Jul 2001
Posts: 61
Send a message via ICQ to Kreft
i dont fully understand if it is a question or not but if it were this would be the answer

!packhdr temp.exe "upx\upx --best temp.exe"

this will compress the header of the installer, hope that helps
Kreft is offline   Reply With Quote
Old 11th January 2002, 01:43   #5
hotice
Member
 
Join Date: Dec 2001
Posts: 57
Quote:
Originally posted by Kreft
i dont fully understand if it is a question or not but if it were this would be the answer

!packhdr temp.exe "upx\upx --best temp.exe"

this will compress the header of the installer, hope that helps
Sorry For My Poor English.
What I need is to run a command to upx my own exe file first.
then create the installer.
eg.
My App includes
a.exe 1000K bytes
a.txt 1000k bytes
My Installer
Myapp.exe
I want the srcipt
do following steps
1. upx a.exe 1000K->400K
2. nsis compress a.exe(400K)->(390K)
+a.txt(1000k)->(200K)
3. nsis add header(40k)+some info(2k)+390K+200K
to Myapp.exe (632K)
hotice is offline   Reply With Quote
Old 11th January 2002, 01:48   #6
Kreft
Member
 
Join Date: Jul 2001
Posts: 61
Send a message via ICQ to Kreft
i would check with your upx documentaion on how to compress your app then do so thru an execwait in your script and then use the code i gave you above to pack the nsis header
Kreft is offline   Reply With Quote
Old 11th January 2002, 09:29   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Hi!

What you need is a simple batch file that you run when you want to compile your installer.

Something like:
code:
upx myapp.exe
upx mytext.txt
makensis myinstall.nsi



KiCHiK
kichik is offline   Reply With Quote
Old 11th January 2002, 13:06   #8
petersa
Senior Member
 
petersa's Avatar
 
Join Date: Apr 2001
Location: Melbourne, Australia
Posts: 207
Hi hotice,
code:
!System '[path to UPX]\UPX --best [path to MyProg]\MyProg.exe'
Stick this line of code at the start of your script for any files that need compressing. These files will then be compressed before they are packed into the installer.

Hope this helps!
petersa is offline   Reply With Quote
Old 24th August 2005, 06:27   #9
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 854
This thread has not been replied to for over three and a half years . I now use upx to compress the header of my installers. I added !packhdr to the nsisconf.nsh file so all installers are now packed by upx. The overhead usually goes down to 30KB from 47KB (these are approximate).

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast 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