Mercurial > nagslang
diff packaging/nagslang.nsi @ 669:30ae339d7224
py2exe packaging
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 08 Sep 2013 17:47:25 +0200 |
parents | |
children | 03fc9cf0f556 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/packaging/nagslang.nsi Sun Sep 08 17:47:25 2013 +0200 @@ -0,0 +1,136 @@ +; Compile with ./scripts/makensis ./scripts/nagslang.nsi . +; You'll need to have previously run wine-py2exe + + !include "MUI.nsh" + +; Application Details + + !define WS_VERSION "0.0.0" ; set by makensis scripts + !define WS_UNPACK "nagslang-${WS_VERSION}" + !define DIST_FOLDER "../dist" + + Name "Werewolf Sonata" + OutFile "${DIST_FOLDER}\nagslang-${WS_VERSION}.exe" + InstallDir "$PROGRAMFILES\Werewolf-Sonata-${WS_VERSION}" + +; Interface Settings + + !define MUI_ABORTWARNING + + !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico" + !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico" + + !define MUI_HEADERIMAGE + !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp" + !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp" + +; Dependencies + + !define COMBINED_LICENSE "../LICENSE.txt" + !define WS_PY2EXE_ZIP "nagslang-${WS_VERSION}.zip" + !define VCREDIST "vcredist_x86.exe" + !define VCREDIST_KEY "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" + !define UNINSTALLER "Uninstaller.exe" + +; Pages + + !insertmacro MUI_PAGE_LICENSE "${COMBINED_LICENSE}" + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +; Languages + + !insertmacro MUI_LANGUAGE "English" + +; Other Stuff + + SetCompress off ; all the big stuff is already compressed + +; Installer Sections + +Section "vcredist" + + SetOutPath "$INSTDIR" + File "${DIST_FOLDER}\${VCREDIST}" + ; Check if it's already installed by checking for the uninstall key + ; Idea and key value to check taken post and comments at: + ; http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx + + ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VCREDIST_KEY}" UninstallString + ; NSIS docs say if the key doesn't exist, we get an error and an empty string + IfErrors install done + +install: + ; Runs install with progress bar and no cancel button + ; Details taken from + ; http://blogs.msdn.com/b/astebner/archive/2010/10/18/9513328.aspx + + DetailPrint "Installing required MS runtime libraries" + ExecWait "$INSTDIR/${VCREDIST} /qb!" + +done: + + DetailPrint "MS runtime libraries already installed, skipping" + +SectionEnd + +Section "Werewolf Sonata" + SetOutPath "$INSTDIR" + + WriteUninstaller "$INSTDIR\${UNINSTALLER}" + + File "${DIST_FOLDER}\${WS_PY2EXE_ZIP}" + + ZipDLL::extractall "$INSTDIR\${WS_PY2EXE_ZIP}" "$INSTDIR" + Delete "$INSTDIR\${WS_PY2EXE_ZIP}" + + CreateDirectory "$SMPROGRAMS\Werewolf Sonata" + + # link.lnk target.exe + # parameters icon.file icon_index_number start_options + # keyboard_shortcut description + + CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${WS_UNPACK}\nagslang.exe" \ + "" "" "" SW_SHOWNORMAL \ + "" "Werewolf Sonata" + + CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \ + "" "" "" SW_SHOWNORMAL \ + "" "Uninstall Werewolf Sonata" + +SectionEnd + +UninstallText "This will uninstall Werewolf Sonata ${WS_VERSION}." + +Section "Uninstall" + ; Delete files not deleted during install + + ; Remove py2exe folder + RMDir /r /REBOOTOK "$INSTDIR\${WS_UNPACK}" + + ; Remove shortcut links + Delete "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk" + Delete "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk" + + ; Remove shortcut folder if no links left + IfFileExists "$SMPROGRAMS\Werewolf Sonata\*.lnk" shortcuts_exist 0 + RMDir /REBOOTOK "$SMPROGRAMS\Werewolf Sonata" + shortcuts_exist: + + ; Final Clean up (no point doing this while the uninstall is incomplete) + RMDir /r /REBOOTOK $INSTDIR + + ; Offer to reboot if needed + IfRebootFlag 0 noreboot + MessageBox MB_YESNO "A reboot is required to finish the uninstallation. Do you wish to reboot now?" IDNO noreboot + Reboot + noreboot: + + ; TODO: We don't touch the vcredist stuff, since we can't tell a) if we were + ; the ones who installed it and b) if anything else needs it. This may cause + ; cruft on the users system, so should we tell the user? + +SectionEnd