mirror of
https://github.com/reactos/RosBE.git
synced 2024-11-23 19:39:51 +00:00
6e3298b0e1
svn path=/trunk/tools/RosBE/; revision=1144
275 lines
9.6 KiB
Plaintext
275 lines
9.6 KiB
Plaintext
!define PRODUCT_NAME "ReactOS Build Environment for Windows - ARM Target Compiler"
|
|
!define PRODUCT_VERSION "1.0"
|
|
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\RosBE.cmd"
|
|
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
|
!define PRODUCT_UNINST_ROOT_KEY "HKCU"
|
|
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
|
|
|
|
;;
|
|
;; Basic installer options
|
|
;;
|
|
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
|
OutFile "RosBE-ARM-${PRODUCT_VERSION}.exe"
|
|
InstallDirRegKey HKCU "${PRODUCT_DIR_REGKEY}" ""
|
|
ShowInstDetails show
|
|
ShowUnInstDetails show
|
|
|
|
;;
|
|
;; Add version/product information metadata to the installation file.
|
|
;;
|
|
VIAddVersionKey /LANG=1033 "FileVersion" "1.0.0.0"
|
|
VIAddVersionKey /LANG=1033 "ProductVersion" "${PRODUCT_VERSION}"
|
|
VIAddVersionKey /LANG=1033 "ProductName" "${PRODUCT_NAME}"
|
|
VIAddVersionKey /LANG=1033 "Comments" "This installer was written by Peter Ward and Daniel Reimer using Nullsoft Scriptable Install System (http://nsis.sourceforge.net/)"
|
|
VIAddVersionKey /LANG=1033 "CompanyName" "ReactOS Team"
|
|
VIAddVersionKey /LANG=1033 "LegalTrademarks" "Copyright © 2009 ReactOS Team"
|
|
VIAddVersionKey /LANG=1033 "LegalCopyright" "Copyright © 2009 ReactOS Team"
|
|
VIAddVersionKey /LANG=1033 "FileDescription" "${PRODUCT_NAME} Setup"
|
|
VIProductVersion "1.0.0.0"
|
|
|
|
CRCCheck force
|
|
SetDatablockOptimize on
|
|
XPStyle on
|
|
SetCompressor /FINAL /SOLID lzma
|
|
|
|
!include "MUI2.nsh"
|
|
!include "InstallOptions.nsh"
|
|
!include "RosSourceDir.nsh"
|
|
!include "LogicLib.nsh"
|
|
!include "x64.nsh"
|
|
|
|
;;
|
|
;; Read our custom page ini, remove previous version and make sure only
|
|
;; one instance of the installer is running.
|
|
;;
|
|
Function .onInit
|
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "RosBE-v${PRODUCT_VERSION}-Installer") i .r1 ?e'
|
|
Pop $R0
|
|
StrCmp $R0 0 +3
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "The ${PRODUCT_NAME} v${PRODUCT_VERSION} installer is already running."
|
|
Abort
|
|
${If} ${RunningX64}
|
|
StrCpy $INSTDIR "$PROGRAMFILES64\RosBE"
|
|
${Else}
|
|
StrCpy $INSTDIR "$PROGRAMFILES\RosBE"
|
|
${Endif}
|
|
Call UninstallPrevious
|
|
!insertmacro INSTALLOPTIONS_EXTRACT "RosSourceDir.ini"
|
|
FunctionEnd
|
|
|
|
;;
|
|
;; MUI Settings
|
|
;;
|
|
!define MUI_ABORTWARNING
|
|
!define MUI_ICON "Icons\rosbe.ico"
|
|
!define MUI_UNICON "Icons\uninstall.ico"
|
|
!define MUI_COMPONENTSPAGE_NODESC
|
|
|
|
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
;!insertmacro MUI_PAGE_LICENSE "Root\License.txt"
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
;;
|
|
;; ReactOS Source Directory Pages
|
|
;;
|
|
var REACTOS_SOURCE_DIRECTORY
|
|
!insertmacro CUSTOM_PAGE_ROSDIRECTORY
|
|
|
|
;;
|
|
;; Start menu page
|
|
;;
|
|
var ICONS_GROUP
|
|
!define MUI_STARTMENUPAGE_NODISABLE
|
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "ReactOS Build Environment"
|
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
|
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
|
|
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
!define MUI_FINISHPAGE_TITLE_3LINES
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
;;
|
|
;; Uninstaller pages
|
|
;;
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
;;
|
|
;; Language and reserve files
|
|
;;
|
|
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
Section -MinGWGCCNASM SEC01
|
|
SetOutPath "$INSTDIR\arm"
|
|
SetOverwrite try
|
|
File /r Components\arm\*.*
|
|
SetOutPath "$INSTDIR"
|
|
SetOverwrite try
|
|
File /r Root\options.cmd
|
|
IfFileExists "$INSTDIR\RosBE.ps1" 0 +3
|
|
File /r Components\Powershell\options.ps1
|
|
SetOutPath "$INSTDIR\Tools"
|
|
SetOverwrite try
|
|
File /r Components\Tools\options.exe
|
|
SectionEnd
|
|
|
|
Section -StartMenuShortcuts SEC02
|
|
SetShellVarContext current
|
|
|
|
;;
|
|
;; Add our start menu shortcuts.
|
|
;;
|
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
|
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
|
|
SetOutPath $REACTOS_SOURCE_DIRECTORY
|
|
IfFileExists "$INSTDIR\RosBE.cmd" 0 +2
|
|
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\ReactOS Build Environment - ARM.lnk" "$SYSDIR\cmd.exe" '/k "$INSTDIR\RosBE.cmd" arm' "$INSTDIR\rosbe.ico"
|
|
IfFileExists "$INSTDIR\RosBE.ps1" 0 +2
|
|
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\ReactOS Build Environment - ARM - Powershell.lnk" "$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" "-noexit &'$INSTDIR\RosBE.ps1' arm" "$INSTDIR\rosbe.ico"
|
|
IfFileExists "$INSTDIR\Tools\options.exe" 0 +2
|
|
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Options - ARM.lnk" "$INSTDIR\Tools\options.exe" arm
|
|
SetOutPath $INSTDIR
|
|
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall RosBE - ARM Target.lnk" \
|
|
"$INSTDIR\Uninstall-ARM-${PRODUCT_VERSION}.exe"
|
|
!insertmacro MUI_STARTMENU_WRITE_END
|
|
SectionEnd
|
|
|
|
Section /o "Desktop Shortcuts" SEC03
|
|
SetShellVarContext current
|
|
|
|
;;
|
|
;; Add our desktop shortcuts.
|
|
;;
|
|
SetOutPath $REACTOS_SOURCE_DIRECTORY
|
|
IfFileExists "$INSTDIR\RosBE.cmd" 0 +2
|
|
CreateShortCut "$DESKTOP\ReactOS Build Environment - ARM.lnk" "$SYSDIR\cmd.exe" '/k "$INSTDIR\RosBE.cmd" arm' "$INSTDIR\rosbe.ico"
|
|
IfFileExists "$INSTDIR\RosBE.ps1" 0 +2
|
|
CreateShortCut "$DESKTOP\ReactOS Build Environment - ARM - Powershell.lnk" "$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" "-noexit &'$INSTDIR\RosBE.ps1' arm" "$INSTDIR\rosbe.ico"
|
|
SectionEnd
|
|
|
|
Section /o "Quick Launch Shortcuts" SEC04
|
|
SetShellVarContext current
|
|
|
|
;;
|
|
;; Add our quick launch shortcuts.
|
|
;;
|
|
SetOutPath $REACTOS_SOURCE_DIRECTORY
|
|
IfFileExists "$INSTDIR\RosBE.cmd" 0 +2
|
|
CreateShortCut "$QUICKLAUNCH\ReactOS Build Environment - ARM.lnk" "$SYSDIR\cmd.exe" '/k "$INSTDIR\RosBE.cmd" arm' "$INSTDIR\rosbe.ico"
|
|
IfFileExists "$INSTDIR\RosBE.ps1" 0 +2
|
|
CreateShortCut "$QUICKLAUNCH\ReactOS Build Environment - ARM - Powershell.lnk" "$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" "-noexit &'$INSTDIR\RosBE.ps1' arm" "$INSTDIR\rosbe.ico"
|
|
SectionEnd
|
|
|
|
Section -Post SEC06
|
|
WriteUninstaller "$INSTDIR\Uninstall-ARM-${PRODUCT_VERSION}.exe"
|
|
WriteRegStr HKCU "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\RosBE.cmd"
|
|
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
|
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall-ARM-${PRODUCT_VERSION}.exe"
|
|
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
|
SectionEnd
|
|
|
|
Function un.onUninstSuccess
|
|
HideWindow
|
|
MessageBox MB_ICONINFORMATION|MB_OK \
|
|
"ReactOS Build Environment - ARM Target was successfully removed from your computer."
|
|
FunctionEnd
|
|
|
|
Function un.onInit
|
|
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
|
|
"Are you sure you want to completely remove ReactOS Build Environment - ARM Target and all of its components?" \
|
|
IDYES +2
|
|
Abort
|
|
FunctionEnd
|
|
|
|
Section Uninstall
|
|
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
|
|
SetShellVarContext current
|
|
|
|
;;
|
|
;; Clean up installed files.
|
|
;;
|
|
RMDir /r /REBOOTOK "$INSTDIR\arm"
|
|
Delete /REBOOTOK "$INSTDIR\Uninstall-${PRODUCT_VERSION}.exe"
|
|
;; Whoever dares to change this back into: RMDir /r /REBOOTOK "$INSTDIR" will be KILLED!!!
|
|
RMDir /REBOOTOK "$INSTDIR"
|
|
Delete /REBOOTOK "$DESKTOP\ReactOS Build Environment - ARM.lnk"
|
|
Delete /REBOOTOK "$QUICKLAUNCH\ReactOS Build Environment - ARM.lnk"
|
|
Delete /REBOOTOK "$DESKTOP\ReactOS Build Environment - ARM - Powershell.lnk"
|
|
Delete /REBOOTOK "$QUICKLAUNCH\ReactOS Build Environment - ARM - Powershell.lnk"
|
|
|
|
;;
|
|
;; Clean up the registry.
|
|
;;
|
|
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
|
DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
|
|
SetAutoClose true
|
|
SectionEnd
|
|
|
|
Function UninstallPrevious
|
|
ReadRegStr $R0 HKCU \
|
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
|
|
"UninstallString"
|
|
ReadRegStr $R1 HKCU \
|
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
|
|
"DisplayVersion"
|
|
${If} $R1 == "${PRODUCT_VERSION}"
|
|
messageBox MB_OK|MB_ICONEXCLAMATION \
|
|
"You already have the ${PRODUCT_NAME} v${PRODUCT_VERSION} installed. You should uninstall the ${PRODUCT_NAME} v${PRODUCT_VERSION} if you want to reinstall."
|
|
${EndIf}
|
|
${If} $R0 == ""
|
|
ReadRegStr $R0 HKLM \
|
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\ReactOS Build Environment" \
|
|
"UninstallString"
|
|
ReadRegStr $R1 HKLM \
|
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\ReactOS Build Environment" \
|
|
"DisplayVersion"
|
|
${If} $R0 == ""
|
|
Return
|
|
${EndIf}
|
|
${EndIf}
|
|
MessageBox MB_YESNO|MB_ICONQUESTION \
|
|
"A previous version of the ${PRODUCT_NAME} was found. You should uninstall it before installing this version.$\n$\nDo you want to do that now?" \
|
|
IDNO UninstallPrevious_no \
|
|
IDYES UninstallPrevious_yes
|
|
Abort
|
|
UninstallPrevious_yes:
|
|
Var /global PREVIOUSINSTDIR
|
|
Push $R0
|
|
Call GetParent
|
|
Pop $PREVIOUSINSTDIR
|
|
Pop $R0
|
|
ExecWait '$R0 _?=$PREVIOUSINSTDIR'
|
|
UninstallPrevious_no:
|
|
FunctionEnd
|
|
|
|
Function GetParent
|
|
Exch $R0
|
|
Push $R1
|
|
Push $R2
|
|
Push $R3
|
|
|
|
StrCpy $R1 0
|
|
StrLen $R2 $R0
|
|
|
|
loop:
|
|
IntOp $R1 $R1 + 1
|
|
IntCmp $R1 $R2 get 0 get
|
|
StrCpy $R3 $R0 1 -$R1
|
|
StrCmp $R3 "\" get
|
|
Goto loop
|
|
|
|
get:
|
|
StrCpy $R0 $R0 -$R1
|
|
|
|
Pop $R3
|
|
Pop $R2
|
|
Pop $R1
|
|
Exch $R0
|
|
FunctionEnd
|