###################################################################### !define APP_NAME "LuaEngine" !define COMP_NAME "Syping" !define WEB_SITE "https://luaengine.syping.de/" !define VERSION "0.1.0.0" !define COPYRIGHT "Copyright © 2018-2020 Syping" !define DESCRIPTION "LuaEngine Runtime and Compiler" !define INSTALLER_NAME "luaengine_setup.exe" !define MAIN_APP_RUNTIME "luaengine.exe" !define MAIN_APP_COMPILER "luaenginec.exe" !define INSTALL_TYPE "SetShellVarContext all" !define REG_ROOT "HKLM" !define REG_APP_RUNTIME "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_RUNTIME}" !define REG_APP_COMPILER "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_COMPILER}" !define REG_ENVIRONMENT "System\CurrentControlSet\Control\Session Manager\Environment" !define REG_ENV_RUNTIME "LUAENGINE_RUNTIME" !define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" !define LICENSE_TXT "LICENSE" ###################################################################### VIProductVersion "${VERSION}" VIAddVersionKey "ProductName" "${APP_NAME}" VIAddVersionKey "ProductVersion" "${VERSION}" VIAddVersionKey "CompanyName" "${COMP_NAME}" VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" VIAddVersionKey "FileDescription" "${DESCRIPTION}" VIAddVersionKey "FileVersion" "${VERSION}" ###################################################################### !include "x64.nsh" SetCompressor LZMA Name "${APP_NAME}" Caption "${APP_NAME}" OutFile "${INSTALLER_NAME}" #BrandingText "${APP_NAME}" XPStyle on Unicode true InstallDirRegKey "${REG_ROOT}" "${REG_APP_RUNTIME}" "" InstallDir "$PROGRAMFILES64\Syping\LuaEngine" ###################################################################### !include "MUI2.nsh" !define MUI_ABORTWARNING !define MUI_UNABORTWARNING !define MUI_LANGDLL_REGISTRY_ROOT "${REG_ROOT}" !define MUI_LANGDLL_REGISTRY_KEY "${UNINSTALL_PATH}" !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" !insertmacro MUI_PAGE_WELCOME !ifdef LICENSE_TXT !insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}" !endif !insertmacro MUI_PAGE_DIRECTORY !ifdef REG_START_MENU !define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LuaEngine" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}" !define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}" !insertmacro MUI_PAGE_STARTMENU Application $SM_Folder !endif !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_RUNTIME}" !define MUI_FINISHPAGE_RUN_PARAMETERS "$\"$INSTDIR\scripts\luaenginert.lea$\"" !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_RESERVEFILE_LANGDLL ###################################################################### Function .onInit !insertmacro MUI_LANGDLL_DISPLAY !ifdef WIN32 MessageBox MB_OK|MB_ICONSTOP "Windows 32-Bit is not supported anymore!" Quit !endif SetRegView 64 FunctionEnd ###################################################################### Section -MainProgram ${INSTALL_TYPE} SetOverwrite ifnewer SetOutPath "$INSTDIR" File "LuaEngine.dll" File "luaengine.exe" File "luaenginec.exe" File "LuaEngineGui.dll" File "LuaEngineIO.dll" File "LuaEngineNetwork.dll" File "LuaEngineOS.dll" File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll" File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll" File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libcrypto-1_1-x64.dll" File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libssl-1_1-x64.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Core.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Gui.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Network.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll" SetOutPath "$INSTDIR\imageformats" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qgif.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qicns.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qico.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qjpeg.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qsvg.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtga.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtiff.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwbmp.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwebp.dll" SetOutPath "$INSTDIR\platforms" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/platforms/qwindows.dll" SetOutPath "$INSTDIR\scripts" File "scripts/luaenginec.lea" File "scripts/luaenginert.lea" SetOutPath "$INSTDIR\sstubs" File "sstubs/windows.json" File "windows.le" SetOutPath "$INSTDIR\styles" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qcleanlooksstyle.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qplastiquestyle.dll" File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qwindowsvistastyle.dll" SectionEnd ###################################################################### Section -Icons_Reg SetOutPath "$INSTDIR" WriteUninstaller "$INSTDIR\uninstall.exe" !ifdef REG_START_MENU !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$SM_Folder" CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_RUNTIME}" "$\"$INSTDIR\scripts\luaenginert.lea$\"" CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Compiler.lnk" "$INSTDIR\${MAIN_APP_RUNTIME}" "$\"$INSTDIR\scripts\luaenginec.lea$\"" CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" !ifdef WEB_SITE WriteIniStr "$INSTDIR\${APP_NAME} Website.url" "InternetShortcut" "URL" "${WEB_SITE}" CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} Website.url" !endif !insertmacro MUI_STARTMENU_WRITE_END !endif !ifndef REG_START_MENU CreateDirectory "$SMPROGRAMS\LuaEngine" CreateShortCut "$SMPROGRAMS\LuaEngine\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_RUNTIME}" "$\"$INSTDIR\scripts\luaenginert.lea$\"" CreateShortCut "$SMPROGRAMS\LuaEngine\${APP_NAME} Compiler.lnk" "$INSTDIR\${MAIN_APP_RUNTIME}" "$\"$INSTDIR\scripts\luaenginec.lea$\"" CreateShortCut "$SMPROGRAMS\LuaEngine\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" !ifdef WEB_SITE WriteIniStr "$INSTDIR\${APP_NAME} Website.url" "InternetShortcut" "URL" "${WEB_SITE}" CreateShortCut "$SMPROGRAMS\LuaEngine\${APP_NAME} Website.lnk" "$INSTDIR\${APP_NAME} Website.url" !endif !endif WriteRegStr ${REG_ROOT} "${REG_APP_RUNTIME}" "" "$INSTDIR\${MAIN_APP_RUNTIME}" WriteRegStr ${REG_ROOT} "${REG_APP_COMPILER}" "" "$INSTDIR\${MAIN_APP_COMPILER}" WriteRegStr ${REG_ROOT} "${REG_ENVIRONMENT}" "LUAENGINE_RUNTIME" "$INSTDIR\${MAIN_APP_RUNTIME}" WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}" WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_RUNTIME}" WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}" WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}" !ifdef WEB_SITE WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}" !endif SectionEnd ###################################################################### Section Uninstall ${INSTALL_TYPE} Delete "$INSTDIR\LuaEngine.dll" Delete "$INSTDIR\luaengine.exe" Delete "$INSTDIR\luaenginec.exe" Delete "$INSTDIR\LuaEngineGui.dll" Delete "$INSTDIR\LuaEngineIO.dll" Delete "$INSTDIR\LuaEngineNetwork.dll" Delete "$INSTDIR\LuaEngineOS.dll" Delete "$INSTDIR\libc++.dll" Delete "$INSTDIR\libunwind.dll" Delete "$INSTDIR\libcrypto-1_1-x64.dll" Delete "$INSTDIR\libssl-1_1-x64.dll" Delete "$INSTDIR\Qt5Core.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Network.dll" Delete "$INSTDIR\Qt5Svg.dll" Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\imageformats\qgif.dll" Delete "$INSTDIR\imageformats\qicns.dll" Delete "$INSTDIR\imageformats\qico.dll" Delete "$INSTDIR\imageformats\qjpeg.dll" Delete "$INSTDIR\imageformats\qsvg.dll" Delete "$INSTDIR\imageformats\qtga.dll" Delete "$INSTDIR\imageformats\qtiff.dll" Delete "$INSTDIR\imageformats\qwbmp.dll" Delete "$INSTDIR\imageformats\qwebp.dll" Delete "$INSTDIR\platforms\qwindows.dll" Delete "$INSTDIR\scripts\luaenginec.lea" Delete "$INSTDIR\scripts\luaenginert.lea" Delete "$INSTDIR\sstubs\windows.json" Delete "$INSTDIR\sstubs\windows.le" Delete "$INSTDIR\styles\qcleanlooksstyle.dll" Delete "$INSTDIR\styles\qplastiquestyle.dll" Delete "$INSTDIR\styles\qwindowsvistastyle.dll" RmDir "$INSTDIR\sstubs" RmDir "$INSTDIR\imageformats" RmDir "$INSTDIR\platforms" RmDir "$INSTDIR\styles" Delete "$INSTDIR\uninstall.exe" !ifdef WEB_SITE Delete "$INSTDIR\${APP_NAME} Website.url" !endif RmDir "$INSTDIR" !ifdef REG_START_MENU !insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Compiler.lnk" Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" !ifdef WEB_SITE Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Website.lnk" !endif RmDir "$SMPROGRAMS\$SM_Folder" !endif !ifndef REG_START_MENU Delete "$SMPROGRAMS\LuaEngine\${APP_NAME}.lnk" Delete "$SMPROGRAMS\LuaEngine\${APP_NAME} Compiler.lnk" Delete "$SMPROGRAMS\LuaEngine\Uninstall ${APP_NAME}.lnk" !ifdef WEB_SITE Delete "$SMPROGRAMS\LuaEngine\${APP_NAME} Website.lnk" !endif RmDir "$SMPROGRAMS\LuaEngine" !endif DeleteRegKey ${REG_ROOT} "${REG_APP_RUNTIME}" DeleteRegKey ${REG_ROOT} "${REG_APP_COMPILER}" DeleteRegValue ${REG_ROOT} "${REG_ENV_RUNTIME}" "${REG_ENVIRONMENT}" DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" SectionEnd ###################################################################### Function un.onInit !insertmacro MUI_UNGETLANGUAGE SetRegView 64 FunctionEnd ######################################################################