source: packaging/nagslang.nsi@ 669:30ae339d7224

Last change on this file since 669:30ae339d7224 was 669:30ae339d7224, checked in by Neil Muller <drnlmuller@…>, 8 years ago

py2exe packaging

File size: 4.1 KB
Line 
1; Compile with ./scripts/makensis ./scripts/nagslang.nsi .
2; You'll need to have previously run wine-py2exe
3
4 !include "MUI.nsh"
5
6; Application Details
7
8 !define WS_VERSION "0.0.0" ; set by makensis scripts
9 !define WS_UNPACK "nagslang-${WS_VERSION}"
10 !define DIST_FOLDER "../dist"
11
12 Name "Werewolf Sonata"
13 OutFile "${DIST_FOLDER}\nagslang-${WS_VERSION}.exe"
14 InstallDir "$PROGRAMFILES\Werewolf-Sonata-${WS_VERSION}"
15
16; Interface Settings
17
18 !define MUI_ABORTWARNING
19
20 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico"
21 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico"
22
23 !define MUI_HEADERIMAGE
24 !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
25 !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
26
27; Dependencies
28
29 !define COMBINED_LICENSE "../LICENSE.txt"
30 !define WS_PY2EXE_ZIP "nagslang-${WS_VERSION}.zip"
31 !define VCREDIST "vcredist_x86.exe"
32 !define VCREDIST_KEY "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}"
33 !define UNINSTALLER "Uninstaller.exe"
34
35; Pages
36
37 !insertmacro MUI_PAGE_LICENSE "${COMBINED_LICENSE}"
38 !insertmacro MUI_PAGE_DIRECTORY
39 !insertmacro MUI_PAGE_INSTFILES
40
41 !insertmacro MUI_UNPAGE_CONFIRM
42 !insertmacro MUI_UNPAGE_INSTFILES
43
44; Languages
45
46 !insertmacro MUI_LANGUAGE "English"
47
48; Other Stuff
49
50 SetCompress off ; all the big stuff is already compressed
51
52; Installer Sections
53
54Section "vcredist"
55
56 SetOutPath "$INSTDIR"
57 File "${DIST_FOLDER}\${VCREDIST}"
58 ; Check if it's already installed by checking for the uninstall key
59 ; Idea and key value to check taken post and comments at:
60 ; http://blogs.msdn.com/b/astebner/archive/2009/01/29/9384143.aspx
61
62 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${VCREDIST_KEY}" UninstallString
63 ; NSIS docs say if the key doesn't exist, we get an error and an empty string
64 IfErrors install done
65
66install:
67 ; Runs install with progress bar and no cancel button
68 ; Details taken from
69 ; http://blogs.msdn.com/b/astebner/archive/2010/10/18/9513328.aspx
70
71 DetailPrint "Installing required MS runtime libraries"
72 ExecWait "$INSTDIR/${VCREDIST} /qb!"
73
74done:
75
76 DetailPrint "MS runtime libraries already installed, skipping"
77
78SectionEnd
79
80Section "Werewolf Sonata"
81 SetOutPath "$INSTDIR"
82
83 WriteUninstaller "$INSTDIR\${UNINSTALLER}"
84
85 File "${DIST_FOLDER}\${WS_PY2EXE_ZIP}"
86
87 ZipDLL::extractall "$INSTDIR\${WS_PY2EXE_ZIP}" "$INSTDIR"
88 Delete "$INSTDIR\${WS_PY2EXE_ZIP}"
89
90 CreateDirectory "$SMPROGRAMS\Werewolf Sonata"
91
92 # link.lnk target.exe
93 # parameters icon.file icon_index_number start_options
94 # keyboard_shortcut description
95
96 CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${WS_UNPACK}\nagslang.exe" \
97 "" "" "" SW_SHOWNORMAL \
98 "" "Werewolf Sonata"
99
100 CreateShortCut "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk" "$INSTDIR\${UNINSTALLER}" \
101 "" "" "" SW_SHOWNORMAL \
102 "" "Uninstall Werewolf Sonata"
103
104SectionEnd
105
106UninstallText "This will uninstall Werewolf Sonata ${WS_VERSION}."
107
108Section "Uninstall"
109 ; Delete files not deleted during install
110
111 ; Remove py2exe folder
112 RMDir /r /REBOOTOK "$INSTDIR\${WS_UNPACK}"
113
114 ; Remove shortcut links
115 Delete "$SMPROGRAMS\Werewolf Sonata\Werewolf Sonata ${WS_VERSION}.lnk"
116 Delete "$SMPROGRAMS\Werewolf Sonata\Uninstall Werewolf Sonata ${WS_VERSION}.lnk"
117
118 ; Remove shortcut folder if no links left
119 IfFileExists "$SMPROGRAMS\Werewolf Sonata\*.lnk" shortcuts_exist 0
120 RMDir /REBOOTOK "$SMPROGRAMS\Werewolf Sonata"
121 shortcuts_exist:
122
123 ; Final Clean up (no point doing this while the uninstall is incomplete)
124 RMDir /r /REBOOTOK $INSTDIR
125
126 ; Offer to reboot if needed
127 IfRebootFlag 0 noreboot
128 MessageBox MB_YESNO "A reboot is required to finish the uninstallation. Do you wish to reboot now?" IDNO noreboot
129 Reboot
130 noreboot:
131
132 ; TODO: We don't touch the vcredist stuff, since we can't tell a) if we were
133 ; the ones who installed it and b) if anything else needs it. This may cause
134 ; cruft on the users system, so should we tell the user?
135
136SectionEnd
Note: See TracBrowser for help on using the repository browser.