installer.nsi 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. ; Haxe/Neko Install script
  2. ; Instructions:
  3. ; - put haxe files in resources/haxe
  4. ; - put neko files in resources/neko
  5. ; - run
  6. ;--------------------------------
  7. !include "MUI.nsh"
  8. !include "LogicLib.nsh"
  9. !include "WordFunc.nsh"
  10. !include "winmessages.nsh"
  11. !include "EnvVarUpdate.nsh"
  12. ;--------------------------------
  13. ; Define version info
  14. !define VERSION "%%VERSION%%"
  15. !define VERSTRING "%%VERSTRING%%"
  16. !define VERLONG "%%VERLONG%%"
  17. ; Define Neko info
  18. !define NEKO_VERSION "2.1.0"
  19. ; Installer details
  20. VIAddVersionKey "CompanyName" "Haxe Foundation"
  21. VIAddVersionKey "ProductName" "Haxe Installer"
  22. VIAddVersionKey "LegalCopyright" "Haxe Foundation 2005-2017"
  23. VIAddVersionKey "FileDescription" "Haxe Installer"
  24. VIAddVersionKey "ProductVersion" "${VERSION}.0"
  25. VIAddVersionKey "FileVersion" "${VERSION}.0"
  26. VIProductVersion "${VERSION}.0"
  27. ; The name of the installer
  28. Name "Haxe ${VERSTRING}"
  29. ; The captions of the installer
  30. Caption "Haxe ${VERLONG} Setup"
  31. UninstallCaption "Haxe ${VERLONG} Uninstall"
  32. ; The file to write
  33. OutFile "haxe-${VERSTRING}-win.exe"
  34. ; Default installation folder
  35. InstallDir "C:\HaxeToolkit\"
  36. ; Define executable files
  37. !define EXECUTABLE "$INSTDIR\haxe\haxe.exe"
  38. !define HaxeLIB "$INSTDIR\Haxe\haxelib.exe"
  39. !define NEKOEXE "$INSTDIR\neko\neko.exe"
  40. ; Vista redirects $SMPROGRAMS to all users without this
  41. RequestExecutionLevel admin
  42. ; Use replace and version compare
  43. !insertmacro WordReplace
  44. !insertmacro VersionCompare
  45. ; Required props
  46. SetFont /LANG=${LANG_ENGLISH} "Tahoma" 8
  47. SetCompressor /SOLID lzma
  48. CRCCheck on
  49. XPStyle on
  50. ;--------------------------------
  51. ; Interface Configuration
  52. !define MUI_HEADERIMAGE
  53. !define MUI_ABORTWARNING
  54. !define MUI_HEADERIMAGE_BITMAP "images\Banner.bmp"
  55. !define MUI_WELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
  56. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
  57. !define MUI_PAGE_HEADER_SUBTEXT "Please view the license before installing Haxe ${VERLONG}."
  58. !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of $(^NameDA).\r\n\r\nIt is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.\r\n\r\n$_CLICK"
  59. ;--------------------------------
  60. ; Pages
  61. !insertmacro MUI_PAGE_WELCOME
  62. !insertmacro MUI_PAGE_COMPONENTS
  63. !insertmacro MUI_PAGE_DIRECTORY
  64. !insertmacro MUI_PAGE_INSTFILES
  65. !insertmacro MUI_PAGE_FINISH
  66. !insertmacro MUI_UNPAGE_WELCOME
  67. !insertmacro MUI_UNPAGE_CONFIRM
  68. !insertmacro MUI_UNPAGE_COMPONENTS
  69. !insertmacro MUI_UNPAGE_INSTFILES
  70. !insertmacro MUI_UNPAGE_FINISH
  71. !insertmacro MUI_LANGUAGE "English"
  72. ;--------------------------------
  73. ; InstallTypes
  74. InstType "Default"
  75. InstType "un.Default"
  76. InstType "un.Full"
  77. ;--------------------------------
  78. ; Functions
  79. Function .onInit
  80. FunctionEnd
  81. ;--------------------------------
  82. ; Install Sections
  83. !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
  84. !define env_hkcu 'HKCU "Environment"'
  85. Section "Haxe ${VERSION}" Main
  86. SectionIn 1 2 RO
  87. SetOverwrite on
  88. RMDir /r /REBOOTOK "$INSTDIR\haxe\std"
  89. SetOutPath "$INSTDIR\haxe"
  90. File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\haxe\*.*"
  91. ExecWait "$INSTDIR\haxe\haxesetup.exe -silent"
  92. WriteUninstaller "$INSTDIR\Uninstall.exe"
  93. SectionEnd
  94. Section "Neko ${NEKO_VERSION}" Neko
  95. SectionIn 1 2
  96. SetOverwrite on
  97. SetOutPath "$INSTDIR\neko"
  98. File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\neko\*.*"
  99. SectionEnd
  100. ;--------------------------------
  101. ; Install section strings
  102. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  103. !insertmacro MUI_DESCRIPTION_TEXT ${Main} "Installs Haxe and other core files."
  104. !insertmacro MUI_DESCRIPTION_TEXT ${Neko} "Installs Neko, which is required by various Haxe tools."
  105. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  106. ;--------------------------------
  107. ; Uninstall Sections
  108. Section "un.Haxe" UninstMain
  109. RMDir /r "$INSTDIR\haxe"
  110. ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%HAXEPATH%"
  111. DeleteRegValue ${env_hklm} HAXEPATH
  112. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  113. SectionEnd
  114. Section "un.Neko" UninstNeko
  115. RMDir /r "$INSTDIR\neko"
  116. ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%NEKO_INSTPATH%"
  117. DeleteRegValue ${env_hklm} NEKO_INSTPATH
  118. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  119. SectionEnd
  120. ;--------------------------------
  121. ; Uninstall section strings
  122. !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  123. !insertmacro MUI_DESCRIPTION_TEXT ${UninstMain} "Uninstalls Haxe and other core files."
  124. !insertmacro MUI_DESCRIPTION_TEXT ${UninstNeko} "Uninstalls Neko."
  125. !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
  126. ;--------------------------------