installer.nsi 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. !include "FileAssociation.nsh"
  13. ;--------------------------------
  14. ; Define version info
  15. !define VERSION "%%VERSION%%"
  16. !define VERSTRING "%%VERSTRING%%"
  17. !define VERLONG "%%VERLONG%%"
  18. ; Define Neko info
  19. !define NEKO_VERSION "2.3.0"
  20. ; Installer details
  21. VIAddVersionKey "CompanyName" "Haxe Foundation"
  22. VIAddVersionKey "ProductName" "Haxe Installer"
  23. VIAddVersionKey "LegalCopyright" "Haxe Foundation 2005-2019"
  24. VIAddVersionKey "FileDescription" "Haxe Installer"
  25. VIAddVersionKey "ProductVersion" "${VERSION}.0"
  26. VIAddVersionKey "FileVersion" "${VERSION}.0"
  27. VIProductVersion "${VERSION}.0"
  28. ; The name of the installer
  29. Name "Haxe ${VERSTRING}"
  30. ; The captions of the installer
  31. Caption "Haxe ${VERLONG} Setup"
  32. UninstallCaption "Haxe ${VERLONG} Uninstall"
  33. ; The file to write
  34. OutFile "haxe-${VERSTRING}-win.exe"
  35. ; Default installation folder
  36. InstallDir "C:\HaxeToolkit\"
  37. ; Define executable files
  38. !define EXECUTABLE "$INSTDIR\haxe\haxe.exe"
  39. !define HaxeLIB "$INSTDIR\Haxe\haxelib.exe"
  40. !define NEKOEXE "$INSTDIR\neko\neko.exe"
  41. ; Vista redirects $SMPROGRAMS to all users without this
  42. RequestExecutionLevel admin
  43. ; Use replace and version compare
  44. !insertmacro WordReplace
  45. !insertmacro VersionCompare
  46. ; Required props
  47. SetFont /LANG=${LANG_ENGLISH} "Tahoma" 8
  48. SetCompressor /SOLID lzma
  49. CRCCheck on
  50. XPStyle on
  51. ;--------------------------------
  52. ; Interface Configuration
  53. !define MUI_HEADERIMAGE
  54. !define MUI_ABORTWARNING
  55. !define MUI_HEADERIMAGE_BITMAP "images\Banner.bmp"
  56. !define MUI_WELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
  57. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "images\Wizard.bmp"
  58. !define MUI_PAGE_HEADER_SUBTEXT "Please view the license before installing Haxe ${VERLONG}."
  59. !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"
  60. ;--------------------------------
  61. ; Pages
  62. !insertmacro MUI_PAGE_WELCOME
  63. !insertmacro MUI_PAGE_COMPONENTS
  64. !insertmacro MUI_PAGE_DIRECTORY
  65. !insertmacro MUI_PAGE_INSTFILES
  66. !insertmacro MUI_PAGE_FINISH
  67. !insertmacro MUI_UNPAGE_WELCOME
  68. !insertmacro MUI_UNPAGE_CONFIRM
  69. !insertmacro MUI_UNPAGE_COMPONENTS
  70. !insertmacro MUI_UNPAGE_INSTFILES
  71. !insertmacro MUI_UNPAGE_FINISH
  72. !insertmacro MUI_LANGUAGE "English"
  73. ;--------------------------------
  74. ; InstallTypes
  75. InstType "Default"
  76. InstType "un.Default"
  77. InstType "un.Full"
  78. ;--------------------------------
  79. ; Functions
  80. Function .onInit
  81. FunctionEnd
  82. ;--------------------------------
  83. ; Install Sections
  84. !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
  85. !define env_hkcu 'HKCU "Environment"'
  86. Section "Haxe ${VERSION}" Main
  87. SectionIn 1 2 RO
  88. SetOverwrite on
  89. RMDir /r /REBOOTOK "$INSTDIR\haxe\std"
  90. SetOutPath "$INSTDIR\haxe"
  91. 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\*.*"
  92. ${registerExtension} "$INSTDIR\haxe\haxe.exe --prompt" ".hxml" "Haxe compiler arguments list"
  93. WriteUninstaller "$INSTDIR\Uninstall.exe"
  94. SectionEnd
  95. Section "Neko ${NEKO_VERSION}" Neko
  96. SectionIn 1 2
  97. SetOverwrite on
  98. SetOutPath "$INSTDIR\neko"
  99. 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\*.*"
  100. SectionEnd
  101. Section "-Update PATH"
  102. ExecWait '"$INSTDIR\haxe\haxe.exe" --cwd "$INSTDIR\haxe" -x WinSetup.hx'
  103. SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000
  104. SectionEnd
  105. ;--------------------------------
  106. ; Install section strings
  107. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  108. !insertmacro MUI_DESCRIPTION_TEXT ${Main} "Installs Haxe and other core files."
  109. !insertmacro MUI_DESCRIPTION_TEXT ${Neko} "Installs Neko, which is required by various Haxe tools."
  110. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  111. ;--------------------------------
  112. ; Uninstall Sections
  113. Section "un.Haxe" UninstMain
  114. RMDir /r "$INSTDIR\haxe"
  115. ${unregisterExtension} ".hxml" "Haxe compiler arguments list"
  116. ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%HAXEPATH%"
  117. DeleteRegValue ${env_hklm} HAXEPATH
  118. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  119. SectionEnd
  120. Section "un.Neko" UninstNeko
  121. RMDir /r "$INSTDIR\neko"
  122. ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "%NEKO_INSTPATH%"
  123. DeleteRegValue ${env_hklm} NEKO_INSTPATH
  124. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  125. SectionEnd
  126. ;--------------------------------
  127. ; Uninstall section strings
  128. !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  129. !insertmacro MUI_DESCRIPTION_TEXT ${UninstMain} "Uninstalls Haxe and other core files."
  130. !insertmacro MUI_DESCRIPTION_TEXT ${UninstNeko} "Uninstalls Neko."
  131. !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
  132. ;--------------------------------