Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use one NSIS installer to install 32-bit binaries on 32-bit OS and 64-bit binaries on 64-bit OS possible?

I currently have two WIX installers for a product that I maintain. One for 32-bit operating systems, and one for 64-bit operating systems. Instead of maintaining two separate installers, I want to combine them into one NSIS installer that can "determine" the "bitness" of the OS and then copy the appropriate binaries into the program directory. Has anyone had any experience with this and could provide a working sample script that NSIS can use to make the installer?

like image 863
Julian Easterling Avatar asked Jun 20 '12 19:06

Julian Easterling


1 Answers

x64.nsh has some helper macros and you can install into $programfiles32 or $programfiles64

Edit:

Function .onInit
StrCpy $instdir $programfiles32\MyApp
${If} ${RunningX64}
  StrCpy $instdir $programfiles64\MyApp
${EndIf}
FunctionEnd

...

Section
Setoutpath $instdir
${If} ${RunningX64}
  File /r build\64\*
${Else}
  File /r build\32\*
${EndIf}
SectionEnd
like image 99
Anders Avatar answered Oct 07 '22 19:10

Anders