Old 28th April 2011, 18:45   #1
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Universal 32 and 64-bit installers

Hi,

I like to maintain one installer for our software which has 32-bit and 64-bit versions of the binaries (exes and dlls).

Most of the support libraries are shared, but on a 32-bit, 64-bit system, it should install into the correct program files directory. are there any known issues with doing this? is there an easy way to avoid redundancy in installing the files since I don't want to copy and paste the 75 or so shared files so i can do the if architecture == 64 do this, else do that since there are really only 10 files that is needed to be in the 64-bit folders.

i am going to have x64 and x86 in the src tree of my nsis installer so it can reference it properly, but for the rest of the files, I don't want to just copy everything twice.

is this achievable, or do i need to maintain separate installers for both architectures.

thanks.
jweinraub is offline   Reply With Quote
Old 28th April 2011, 19:05   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
You're not being entirely clear on what exactly you want to accomplish. If you're asking about runtime differentiation between 32 bit and 64 bits operating system, use the macros in x64.nsh. (A simple search would've told you this.)

If you're talking about compiletime differentiation so you can build two kinds of installer with only one .nsi file, you can use makensis's /D parameter to define YourDefine, and use !ifdef YourDefine etc in your script. You can find this info in chapter 3 of the manual. http://nsis.sourceforge.net/Docs/Chapter3.html
MSG is offline   Reply With Quote
Old 28th April 2011, 19:15   #3
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Sorry for not being clear. I know how to do 64-bit differentiation. I did a search what I want to do, but what I want to do I think is maybe unique.

To simplify things, my installer say installs about 100 files. I want to use the same installer on any machine (32 or 64-bit). When the installer installs, it automatically copies the appropriate files to the appropriate program files folder.

My question is, do I need to have the if statement on the top of the code when it gets installed for the correct program files folder flag gets set correctly (I am assuming $PROGRAMFILES is determined at runtime?) How does it get determined if it goes into Program Files (x86) or Program Files where 64-bit compiled programs go?

That is where I think I am not understanding the workflow on how this should be accomplished.

So say 15 of those 100 files is what is compiled for 64-bit systems. So in my nsis src folder, I have x64 folder with those 15 files, a x86 folder where 15 of those files are that are 32-bit, and the remaining 85 files are in main src folder, the parent folder.

Is NSIS smart enough for me to just reference the x64 or x86 folders and still copy the rest of the support files I need to install.

I hope this was more clear.
Thanks.
jweinraub is offline   Reply With Quote
Old 28th April 2011, 19:44   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
$PROGRAMFILES always points to the 32bits version (usually called "Program Files (x86)" on 64 bits windows), because NSIS is a 32 bits application. To install something to x64 program files, use $PROGRAMFILES64. See chapter 4 of the manual: http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.3

So in code:
${If} ${RunningX64}
SetOutPath "$PROGRAMFILES64\YourPath"
File x64file1.ext
File x64file2.ext
File x64file3.ext
{Else}
SetOutPath "$PROGRAMFILES\YourPath"
File x68file1.ext
File x68file2.ext
File x68file3.ext
${EndIf}
File commonfile1.ext
File commonfile2.ext
File commonfile3.ext
MSG is offline   Reply With Quote
Old 28th April 2011, 19:57   #5
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
I see, so the common files will still install in its proper folder of Programfiles64 / 32 then, i think i get it now.

thanks.
jweinraub is offline   Reply With Quote
Old 28th April 2011, 20:53   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
$PROGRAMFILES64 will have the same value as $PROGRAMFILES on 32-bit Windows so you can just use $PROGRAMFILES64 throughout although using both is probably good for code readability.

Stu
Afrow UK 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