Minor cleanup and more LogicLib usage

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6381 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-07-10 16:34:53 +00:00
parent 5e1edb3d75
commit efefbd8269

View file

@ -6,9 +6,7 @@
!define /ifndef VER_BUILD 0 !define /ifndef VER_BUILD 0
!endif !endif
!ifndef VERSION !define /ifndef VERSION 'anonymous-build'
!define VERSION 'anonymous-build'
!endif
;-------------------------------- ;--------------------------------
;Configuration ;Configuration
@ -53,9 +51,11 @@ RequestExecutionLevel admin
Name "NSIS" Name "NSIS"
Caption "NSIS ${VERSION} Setup" Caption "NSIS ${VERSION} Setup"
!define REG_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS"
;Memento Settings ;Memento Settings
!define MEMENTO_REGISTRY_ROOT HKLM !define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" !define MEMENTO_REGISTRY_KEY "${REG_UNINST_KEY}"
;Interface Settings ;Interface Settings
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
@ -116,6 +116,11 @@ VIAddVersionKey "LegalCopyright" "http://nsis.sf.net/License"
File "/oname=$InstDir\Plugins\x86-unicode\${pi}.dll" ..\Plugins\x86-unicode\${pi}.dll File "/oname=$InstDir\Plugins\x86-unicode\${pi}.dll" ..\Plugins\x86-unicode\${pi}.dll
!macroend !macroend
!macro InstallStub stub
File ..\Stubs\${stub}-x86-ansi
File ..\Stubs\${stub}-x86-unicode
!macroend
${MementoSection} "NSIS Core Files (required)" SecCore ${MementoSection} "NSIS Core Files (required)" SecCore
SetDetailsPrint textonly SetDetailsPrint textonly
@ -149,10 +154,6 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
SetOutPath $INSTDIR\Stubs SetOutPath $INSTDIR\Stubs
File ..\Stubs\uninst File ..\Stubs\uninst
!macro InstallStub stub
File ..\Stubs\${stub}-x86-ansi
File ..\Stubs\${stub}-x86-unicode
!macroend
!insertmacro InstallStub bzip2 !insertmacro InstallStub bzip2
!insertmacro InstallStub bzip2_solid !insertmacro InstallStub bzip2_solid
!insertmacro InstallStub lzma !insertmacro InstallStub lzma
@ -227,10 +228,10 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
WriteRegStr HKCR "NSIS.Script" "" "NSIS Script File" WriteRegStr HKCR "NSIS.Script" "" "NSIS Script File"
WriteRegStr HKCR "NSIS.Script\DefaultIcon" "" "$INSTDIR\makensisw.exe,1" WriteRegStr HKCR "NSIS.Script\DefaultIcon" "" "$INSTDIR\makensisw.exe,1"
ReadRegStr $R0 HKCR "NSIS.Script\shell\open\command" "" ReadRegStr $R0 HKCR "NSIS.Script\shell\open\command" ""
StrCmp $R0 "" 0 no_nsiopen ${If} $R0 == ""
WriteRegStr HKCR "NSIS.Script\shell" "" "open" WriteRegStr HKCR "NSIS.Script\shell" "" "open"
WriteRegStr HKCR "NSIS.Script\shell\open\command" "" 'notepad.exe "%1"' WriteRegStr HKCR "NSIS.Script\shell\open\command" "" 'notepad.exe "%1"'
no_nsiopen: ${EndIf}
WriteRegStr HKCR "NSIS.Script\shell\compile" "" "Compile NSIS Script" WriteRegStr HKCR "NSIS.Script\shell\compile" "" "Compile NSIS Script"
WriteRegStr HKCR "NSIS.Script\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"' WriteRegStr HKCR "NSIS.Script\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"'
WriteRegStr HKCR "NSIS.Script\shell\compile-compressor" "" "Compile NSIS Script (Choose Compressor)" WriteRegStr HKCR "NSIS.Script\shell\compile-compressor" "" "Compile NSIS Script (Choose Compressor)"
@ -244,10 +245,10 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
WriteRegStr HKCR "NSIS.Header" "" "NSIS Header File" WriteRegStr HKCR "NSIS.Header" "" "NSIS Header File"
WriteRegStr HKCR "NSIS.Header\DefaultIcon" "" "$INSTDIR\makensisw.exe,1" WriteRegStr HKCR "NSIS.Header\DefaultIcon" "" "$INSTDIR\makensisw.exe,1"
ReadRegStr $R0 HKCR "NSIS.Header\shell\open\command" "" ReadRegStr $R0 HKCR "NSIS.Header\shell\open\command" ""
StrCmp $R0 "" 0 no_nshopen ${If} $R0 == ""
WriteRegStr HKCR "NSIS.Header\shell" "" "open" WriteRegStr HKCR "NSIS.Header\shell" "" "open"
WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"' WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
no_nshopen: ${EndIf}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
@ -752,30 +753,19 @@ Section -post
; * Always install the English language file ; * Always install the English language file
; * Always install default icons / bitmaps ; * Always install default icons / bitmaps
!insertmacro SectionFlagIsSet ${SecInterfacesModernUI} ${SF_SELECTED} mui nomui ${If} ${SectionIsSelected} ${SecInterfacesModernUI}
mui:
SetDetailsPrint textonly SetDetailsPrint textonly
DetailPrint "Configuring Modern UI..." DetailPrint "Configuring Modern UI..."
SetDetailsPrint listonly SetDetailsPrint listonly
!insertmacro SectionFlagIsSet ${SecLangFiles} ${SF_SELECTED} langfiles nolangfiles ${If} ${SectionIsSelected} ${SecLangFiles}
nolangfiles:
SetOutPath "$INSTDIR\Contrib\Language files" SetOutPath "$INSTDIR\Contrib\Language files"
File "..\Contrib\Language files\English.nlf" File "..\Contrib\Language files\English.nlf"
SetOutPath "$INSTDIR\Contrib\Language files"
File "..\Contrib\Language files\English.nsh" File "..\Contrib\Language files\English.nsh"
${EndIf}
langfiles: ${If} ${SectionIsSelected} ${SecGraphics}
!insertmacro SectionFlagIsSet ${SecGraphics} ${SF_SELECTED} graphics nographics
nographics:
SetOutPath $INSTDIR\Contrib\Graphics
SetOutPath $INSTDIR\Contrib\Graphics\Checks SetOutPath $INSTDIR\Contrib\Graphics\Checks
File "..\Contrib\Graphics\Checks\modern.bmp" File "..\Contrib\Graphics\Checks\modern.bmp"
SetOutPath $INSTDIR\Contrib\Graphics\Icons SetOutPath $INSTDIR\Contrib\Graphics\Icons
@ -785,10 +775,9 @@ Section -post
File "..\Contrib\Graphics\Header\nsis.bmp" File "..\Contrib\Graphics\Header\nsis.bmp"
SetOutPath $INSTDIR\Contrib\Graphics\Wizard SetOutPath $INSTDIR\Contrib\Graphics\Wizard
File "..\Contrib\Graphics\Wizard\win.bmp" File "..\Contrib\Graphics\Wizard\win.bmp"
${EndIf}
graphics: ${EndIf}
nomui:
SetDetailsPrint textonly SetDetailsPrint textonly
DetailPrint "Creating Registry Keys..." DetailPrint "Creating Registry Keys..."
@ -804,19 +793,19 @@ Section -post
WriteRegDword HKLM "Software\NSIS" "VersionBuild" "${VER_BUILD}" WriteRegDword HKLM "Software\NSIS" "VersionBuild" "${VER_BUILD}"
!endif !endif
WriteRegExpandStr HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString" '"$INSTDIR\uninst-nsis.exe"' WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst-nsis.exe"'
WriteRegExpandStr HKLM "${MEMENTO_REGISTRY_KEY}" "InstallLocation" "$INSTDIR" WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "DisplayName" "Nullsoft Install System" WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayName" "Nullsoft Install System"
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\NSIS.exe,0" WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayIcon" "$INSTDIR\NSIS.exe,0"
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayVersion" "${VERSION}"
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}" WriteRegDWORD HKLM "${REG_UNINST_KEY}" "VersionMajor" "${VER_MAJOR}"
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}" WriteRegDWORD HKLM "${REG_UNINST_KEY}" "VersionMinor" "${VER_MINOR}"
!endif !endif
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://nsis.sourceforge.net/" WriteRegStr HKLM "${REG_UNINST_KEY}" "URLInfoAbout" "http://nsis.sourceforge.net/"
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://nsis.sourceforge.net/Support" WriteRegStr HKLM "${REG_UNINST_KEY}" "HelpLink" "http://nsis.sourceforge.net/Support"
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "NoModify" "1" WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoModify" "1"
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "NoRepair" "1" WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoRepair" "1"
WriteUninstaller $INSTDIR\uninst-nsis.exe WriteUninstaller $INSTDIR\uninst-nsis.exe
@ -875,7 +864,7 @@ Var ReinstallPageCheck
Function PageReinstall Function PageReinstall
ReadRegStr $R0 HKLM "Software\NSIS" "" ReadRegStr $R0 HKLM "Software\NSIS" ""
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString" ReadRegStr $R1 HKLM "${REG_UNINST_KEY}" "UninstallString"
${IfThen} "$R0$R1" == "" ${|} Abort ${|} ${IfThen} "$R0$R1" == "" ${|} Abort ${|}
StrCpy $R4 "older" StrCpy $R4 "older"
@ -959,7 +948,7 @@ Function PageLeaveReinstall
StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components? StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components?
reinst_uninstall: reinst_uninstall:
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString" ReadRegStr $R1 HKLM "${REG_UNINST_KEY}" "UninstallString"
;Run uninstaller ;Run uninstaller
HideWindow HideWindow
@ -994,16 +983,12 @@ FunctionEnd
!endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD !endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
Function ShowReleaseNotes Function ShowReleaseNotes
${If} ${FileExists} $WINDIR\hh.exe StrCpy $0 $WINDIR\hh.exe
StrCpy $0 $WINDIR\hh.exe ${IfNotThen} ${FileExists} $0 ${|} SearchPath $0 hh.exe ${|}
${If} ${FileExists} $0
Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html' Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html'
${Else} ${Else}
SearchPath $0 hh.exe ExecShell "" "http://nsis.sourceforge.net/Docs/AppendixF.html#F.1"
${If} ${FileExists} $0
Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html'
${Else}
ExecShell "open" "http://nsis.sourceforge.net/Docs/AppendixF.html#F.1"
${EndIf}
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
@ -1038,7 +1023,7 @@ Section Uninstall
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
DeleteRegKey HKLM "${MEMENTO_REGISTRY_KEY}" DeleteRegKey HKLM "${REG_UNINST_KEY}"
DeleteRegKey HKLM "Software\NSIS" DeleteRegKey HKLM "Software\NSIS"
SetDetailsPrint textonly SetDetailsPrint textonly