Prebuild.nsi 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. !verbose 3
  2. !define PRODUCT_NAME "Prebuild"
  3. !define PRODUCT_VERSION "1.3.1"
  4. !define PRODUCT_PUBLISHER "Prebuild"
  5. !define PRODUCT_PACKAGE "prebuild"
  6. !define PRODUCT_WEB_SITE "http://dnpb.sourceforge.net"
  7. !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Prebuild"
  8. !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Prebuild"
  9. !define PRODUCT_UNINST_ROOT_KEY "HKLM"
  10. !define PRODUCT_PATH ".."
  11. ;!define MUI_WELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp"
  12. ;!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
  13. ;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp"
  14. ;!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
  15. BrandingText "© 2003-2006 David Hudson, http://dnpb.sourceforge.net/"
  16. SetCompressor lzma
  17. CRCCheck on
  18. ; File Association defines
  19. ;!include "fileassoc.nsh"
  20. ; MUI 1.67 compatible ------
  21. !include "MUI.nsh"
  22. ; MUI Settings
  23. !define MUI_ABORTWARNING
  24. !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
  25. !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
  26. ;--------------------------------
  27. ;Variables
  28. ;--------------------------------
  29. ;Installer Pages
  30. ; Welcome page
  31. !insertmacro MUI_PAGE_WELCOME
  32. ; License page
  33. !insertmacro MUI_PAGE_LICENSE "..\doc\license.txt"
  34. ; Directory page
  35. !insertmacro MUI_PAGE_DIRECTORY
  36. ; Instfiles page
  37. !insertmacro MUI_PAGE_INSTFILES
  38. ; Finish page
  39. !insertmacro MUI_PAGE_FINISH
  40. ;------------------------------------
  41. ; Uninstaller pages
  42. !insertmacro MUI_UNPAGE_CONFIRM
  43. !insertmacro MUI_UNPAGE_INSTFILES
  44. !insertmacro MUI_UNPAGE_FINISH
  45. ;------------------------------------
  46. ; Language files
  47. !insertmacro MUI_LANGUAGE "English"
  48. ; Reserve files
  49. !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
  50. ; MUI end ------
  51. Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  52. OutFile "..\${PRODUCT_PACKAGE}-${PRODUCT_VERSION}-setup.exe"
  53. InstallDir "$PROGRAMFILES\Prebuild"
  54. InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
  55. ShowInstDetails show
  56. ShowUnInstDetails show
  57. ; .NET Framework check
  58. ; http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/redistdeploy1_1.asp
  59. ; Section "Detecting that the .NET Framework 1.1 is installed"
  60. Function .onInit
  61. ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" Install
  62. StrCmp $R0 "" 0 CheckPreviousVersion
  63. MessageBox MB_OK "Microsoft .NET Framework 1.1 was not found on this system.$\r$\n$\r$\nUnable to continue this installation."
  64. Abort
  65. CheckPreviousVersion:
  66. ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName"
  67. StrCmp $R0 "" CheckOSVersion 0
  68. MessageBox MB_OK "An old version of Prebuild is installed on this computer, please uninstall first.$\r$\n$\r$\nUnable to continue this installation."
  69. Abort
  70. CheckOSVersion:
  71. Call IsSupportedWindowsVersion
  72. Pop $R0
  73. StrCmp $R0 "False" NoAbort 0
  74. MessageBox MB_OK "The operating system you are using is not supported by Prebuild (95/98/ME/NT3.x/NT4.x)."
  75. Abort
  76. NoAbort:
  77. FunctionEnd
  78. Section "Source" SecSource
  79. SetOverwrite ifnewer
  80. SetOutPath "$INSTDIR\src"
  81. File /r /x *.swp /x .svn /x *.xml /x *.csproj /x *.user /x *.build /x *.prjx /x *.mdp /x bin /x obj /x *.nsi ${PRODUCT_PATH}\src\*.*
  82. ;Store installation folder
  83. WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
  84. SectionEnd
  85. Section "Runtime" SecRuntime
  86. SetOverwrite ifnewer
  87. SetOutPath "$INSTDIR"
  88. File /r /x *.swp /x .svn /x *.nsi /x src /x *.sln /x *.cmbx /x *.mds ${PRODUCT_PATH}\Prebuild.exe ${PRODUCT_PATH}\prebuild.xml
  89. ;Store installation folder
  90. WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
  91. SectionEnd
  92. Section "Documentation" SecDocs
  93. SetOverwrite ifnewer
  94. SetOutPath "$INSTDIR\doc"
  95. File /r /x *.swp /x .svn /x *.exe ${PRODUCT_PATH}\doc\*.*
  96. ;Store installation folder
  97. WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
  98. SectionEnd
  99. Section "Scripts" SecScripts
  100. SetOverwrite ifnewer
  101. SetOutPath "$INSTDIR\scripts"
  102. File /r /x *.swp /x .svn /x *.nsi /x *.exe ${PRODUCT_PATH}\scripts\*.*
  103. ;Store installation folder
  104. WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
  105. SectionEnd
  106. ;Language strings
  107. Section -AdditionalIcons
  108. WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  109. SectionEnd
  110. Section -Post
  111. WriteUninstaller "$INSTDIR\uninst.exe"
  112. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  113. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  114. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  115. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  116. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
  117. SectionEnd
  118. Section Uninstall
  119. DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  120. DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  121. RMDir /r "$INSTDIR"
  122. SectionEnd
  123. ; GetWindowsVersion, taken from NSIS help, modified for our purposes
  124. Function IsSupportedWindowsVersion
  125. Push $R0
  126. Push $R1
  127. ReadRegStr $R0 HKLM \
  128. "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  129. IfErrors 0 lbl_winnt
  130. ; we are not NT
  131. ReadRegStr $R0 HKLM \
  132. "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
  133. StrCpy $R1 $R0 1
  134. StrCmp $R1 '4' 0 lbl_error
  135. StrCpy $R1 $R0 3
  136. StrCmp $R1 '4.0' lbl_win32_95
  137. StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
  138. lbl_win32_95:
  139. StrCpy $R0 'False'
  140. Goto lbl_done
  141. lbl_win32_98:
  142. StrCpy $R0 'False'
  143. Goto lbl_done
  144. lbl_win32_ME:
  145. StrCpy $R0 'False'
  146. Goto lbl_done
  147. lbl_winnt:
  148. StrCpy $R1 $R0 1
  149. StrCmp $R1 '3' lbl_winnt_x
  150. StrCmp $R1 '4' lbl_winnt_x
  151. StrCpy $R1 $R0 3
  152. StrCmp $R1 '5.0' lbl_winnt_2000
  153. StrCmp $R1 '5.1' lbl_winnt_XP
  154. StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
  155. lbl_winnt_x:
  156. StrCpy $R0 'False'
  157. Goto lbl_done
  158. lbl_winnt_2000:
  159. Strcpy $R0 'True'
  160. Goto lbl_done
  161. lbl_winnt_XP:
  162. Strcpy $R0 'True'
  163. Goto lbl_done
  164. lbl_winnt_2003:
  165. Strcpy $R0 'True'
  166. Goto lbl_done
  167. lbl_error:
  168. Strcpy $R0 'False'
  169. lbl_done:
  170. Pop $R1
  171. Exch $R0
  172. FunctionEnd