diff options
| author | ruki <[email protected]> | 2017-01-23 22:23:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-01-23 22:23:23 +0800 |
| commit | 2d5313cb6f4f3ac3829c1ae0e68c02a90f74b7eb (patch) | |
| tree | 71a38c1f4ab5504d6b7323f9cddff822271dc57b | |
| parent | 85dba60e9e68a75f188f8b7561f7b0a4a416e353 (diff) | |
add installer.nsi for nsis
| -rw-r--r-- | installer.nsi | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/installer.nsi b/installer.nsi new file mode 100644 index 000000000..abffbde8f --- /dev/null +++ b/installer.nsi @@ -0,0 +1,110 @@ +; xmake.nsi
+;
+; This script is perhaps one of the simplest NSIs you can make. All of the
+; optional settings are left to their default settings. The installer simply
+; prompts the user asking them where to install, and drops a copy of xmake.nsi
+; there.
+
+;--------------------------------
+; includes
+!include "MUI2.nsh"
+!include "WordFunc.nsh"
+!include "WinMessages.nsh"
+
+;--------------------------------
+
+; The name of the installer
+Name "xmake"
+
+; The file to write
+OutFile "xmake.exe"
+
+; The default installation directory
+InstallDir $PROGRAMFILES\xmake
+
+; Request application privileges for Windows Vista
+RequestExecutionLevel admin
+
+;--------------------------------
+;Interface Settings
+
+!define MUI_ABORTWARNING
+
+;--------------------------------
+;Pages
+
+!insertmacro MUI_PAGE_LICENSE "LICENSE.md"
+!insertmacro MUI_PAGE_COMPONENTS
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+;--------------------------------
+
+; Installer
+Section "xmake (required)" Installer
+
+ SectionIn RO
+
+ ; Set output path to the installation directory.
+ SetOutPath $INSTDIR
+
+ ; Put file there
+ File /r /x ".DS_Store" "xmake\*.*"
+ File "tools\xmake.exe"
+
+ ; Write the installation path into the registry
+ WriteRegStr HKLM SOFTWARE\NSIS_xmake "Install_Dir" "$INSTDIR"
+
+ ; Write the uninstall keys for Windows
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xmake" "DisplayName" "NSIS xmake"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xmake" "UninstallString" '"$INSTDIR\uninstall.exe"'
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xmake" "NoModify" 1
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xmake" "NoRepair" 1
+ WriteUninstaller "uninstall.exe"
+
+ ; Write the installation path into the $PATH environment variable
+ ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+ WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR"
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment"
+
+SectionEnd
+
+;--------------------------------
+;Descriptions
+
+;Language strings
+LangString DESC_Installer ${LANG_ENGLISH} "A make-like build utility based on Lua"
+
+;Assign language strings to sections
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+!insertmacro MUI_DESCRIPTION_TEXT ${Installer} $(DESC_Installer)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;--------------------------------
+
+; Uninstaller
+
+Section "Uninstall"
+
+ ; Remove registry keys
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\xmake"
+ DeleteRegKey HKLM SOFTWARE\NSIS_xmake
+
+ ; Remove directories used
+ RMDir /r "$INSTDIR"
+
+ ; Remove the installation path from the $PATH environment variable
+ ReadRegStr $R0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+ ${WordReplace} $R0 ";$INSTDIR" "" "+" $R1
+ ; MessageBox MB_OK|MB_USERICON '$R0 - $INSTDIR - $R1 '
+ WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1"
+
+SectionEnd
|
