Skip to content

Commit

Permalink
nsis: add 64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Sep 3, 2013
1 parent c8d1a0c commit 56ba1d7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 23 deletions.
35 changes: 13 additions & 22 deletions ms-windows/QGIS-Installer.nsi
Expand Up @@ -27,6 +27,7 @@ RequestExecutionLevel admin

;NSIS Includes

!include "x64.nsh"
!include "MUI.nsh"
!include "LogicLib.nsh"

Expand Down Expand Up @@ -60,6 +61,14 @@ OutFile "${INSTALLER_NAME}"
;Define installation folder
InstallDir "$PROGRAMFILES\${QGIS_BASE}"

${If} ${RunningX64}
DetailPrint "Installer running on 64-bit host"
; disable registry redirection (enable access to 64-bit portion of registry)
SetRegView 64
; change install dir
StrCpy $INSTDIR "$PROGRAMFILES64\${QGIS_BASE}"
${EndIf}

;Tell the installer to show Install and Uninstall details as default
ShowInstDetails show
ShowUnInstDetails show
Expand Down Expand Up @@ -270,7 +279,7 @@ Section "QGIS" SecQGIS

SectionIn RO

;Added by Tim to set the reg key so we get default plugin loading
;Added by Tim to set the reg key so we get default plugin loading
!include plugins.nsh
;Added by Tim to set the reg key so we get default python & py plugins
!include python_plugins.nsh
Expand Down Expand Up @@ -334,7 +343,7 @@ Section "QGIS" SecQGIS

;Create the Desktop Shortcut
SetShellVarContext current

;Create the Windows Start Menu Shortcuts
SetShellVarContext all

Expand All @@ -355,24 +364,6 @@ RebootNecessary:
SetRebootFlag true

NoRebootNecessary:
Delete "$DESKTOP\QGIS (${VERSION_NUMBER}).lnk"
Delete "$SMPROGRAMS\${QGIS_BASE}\QGIS (${VERSION_NUMBER}).lnk"

Delete "$DESKTOP\QGIS Desktop (${VERSION_NUMBER}).lnk"
CreateShortCut "$DESKTOP\QGIS Desktop (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$SMPROGRAMS\${QGIS_BASE}\QGIS Desktop (${VERSION_NUMBER}).lnk"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\QGIS Desktop (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$DESKTOP\QGIS Browser (${VERSION_NUMBER}).lnk"
CreateShortCut "$DESKTOP\QGIS Browser (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}-browser.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$SMPROGRAMS\${QGIS_BASE}\QGIS Browser (${VERSION_NUMBER}).lnk"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\QGIS Browser (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}-browser.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

SectionEnd

Expand Down Expand Up @@ -406,7 +397,7 @@ Function DownloadDataSet
Pop $0
StrCmp $0 "success" untar_ok untar_failed

untar_ok:
untar_ok:
Rename "$GIS_DATABASE\$ORIGINAL_UNTAR_FOLDER" "$GIS_DATABASE\$CUSTOM_UNTAR_FOLDER"
Delete "$TEMP\$ARCHIVE_NAME"
Goto end
Expand Down Expand Up @@ -434,7 +425,7 @@ Section /O "North Carolina Data Set" SecNorthCarolinaSDB

;Set the size (in KB) of the unpacked archive file
AddSize 293314

StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
StrCpy $ARCHIVE_NAME "nc_spm_latest.tar.gz"
StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina"
Expand Down
2 changes: 1 addition & 1 deletion ms-windows/osgeo4w/creatensis.pl
Expand Up @@ -155,7 +155,7 @@ sub getDeps {
if( -d $unpacked ) {
unless( $keep ) {
print "Removing $unpacked directory\n" if $verbose;
system "echo rm -rf $unpacked";
system "rm -rf $unpacked";
} else {
print "Keeping $unpacked directory\n" if $verbose;
}
Expand Down
54 changes: 54 additions & 0 deletions ms-windows/x64.nsh
@@ -0,0 +1,54 @@
; ---------------------
; x64.nsh
; ---------------------
;
; A few simple macros to handle installations on x64 machines.
;
; RunningX64 checks if the installer is running on x64.
;
; ${If} ${RunningX64}
; MessageBox MB_OK "running on x64"
; ${EndIf}
;
; DisableX64FSRedirection disables file system redirection.
; EnableX64FSRedirection enables file system redirection.
;
; SetOutPath $SYSDIR
; ${DisableX64FSRedirection}
; File some.dll # extracts to C:\Windows\System32
; ${EnableX64FSRedirection}
; File some.dll # extracts to C:\Windows\SysWOW64
;

!ifndef ___X64__NSH___
!define ___X64__NSH___

!include LogicLib.nsh

!macro _RunningX64 _a _b _t _f
!insertmacro _LOGICLIB_TEMP
System::Call kernel32::GetCurrentProcess()i.s
System::Call kernel32::IsWow64Process(is,*i.s)
Pop $_LOGICLIB_TEMP
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
!macroend

!define RunningX64 `"" RunningX64 ""`

!macro DisableX64FSRedirection

System::Call kernel32::Wow64EnableWow64FsRedirection(i0)

!macroend

!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"

!macro EnableX64FSRedirection

System::Call kernel32::Wow64EnableWow64FsRedirection(i1)

!macroend

!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"

!endif # !___X64__NSH___

0 comments on commit 56ba1d7

Please sign in to comment.