]> sigrok.org Git - sigrok-gtk.git/blob - contrib/sigrok-gtk.nsi.in
cli/gtk/qt: nsis: Better installer filename.
[sigrok-gtk.git] / contrib / sigrok-gtk.nsi.in
1 ##
2 ## This file is part of the sigrok project.
3 ##
4 ## Copyright (C) 2011-2012 Uwe Hermann <uwe@hermann-uwe.de>
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2 of the License, or
9 ## (at your option) any later version.
10 ##
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
15 ##
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19 ##
20
21 #
22 # This file is used to create the sigrok-gtk Windows installer via NSIS.
23 #
24 # NSIS documentation:
25 # http://nsis.sourceforge.net/Docs/
26 # http://nsis.sourceforge.net/Docs/Modern%20UI%202/Readme.html
27 #
28
29 # Include the "Modern UI" header, which gives us the usual Windows look-n-feel.
30 !include "MUI2.nsh"
31
32
33 # --- Global stuff ------------------------------------------------------------
34
35 # Installer/product name.
36 Name "@PACKAGE_NAME@"
37
38 # Filename of the installer executable.
39 OutFile "@PACKAGE_NAME@-@PACKAGE_VERSION@-installer.exe"
40
41 # Where to install the application.
42 InstallDir "$PROGRAMFILES\sigrok\@PACKAGE_NAME@"
43
44 # Request admin privileges for Windows Vista and Windows 7.
45 # http://nsis.sourceforge.net/Docs/Chapter4.html
46 RequestExecutionLevel admin
47
48 # Local helper definitions.
49 !define REGSTR "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE_NAME@"
50
51
52 # --- MUI interface configuration ---------------------------------------------
53
54 # Use the following icon for the installer EXE file.
55 !define MUI_ICON "sigrok-logo-notext.ico"
56
57 # Show a nice image at the top of each installer page.
58 !define MUI_HEADERIMAGE
59
60 # Don't automatically go to the Finish page so the user can check the log.
61 !define MUI_FINISHPAGE_NOAUTOCLOSE
62
63 # Upon "cancel", ask the user if he really wants to abort the installer.
64 !define MUI_ABORTWARNING
65
66 # Don't force the user to accept the license, just show it.
67 # Details: http://trac.videolan.org/vlc/ticket/3124
68 !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
69 !define MUI_LICENSEPAGE_TEXT_BOTTOM "Click Next to continue."
70
71 # File name of the Python installer MSI file.
72 !define PY_INST "python-3.2.2.msi"
73
74 # Standard install path of the Python installer (do not change!).
75 !define PY_BIN "c:\Python32"
76
77
78 # --- MUI pages ---------------------------------------------------------------
79
80 # Show a nice "Welcome to the ... Setup Wizard" page.
81 !insertmacro MUI_PAGE_WELCOME
82
83 # Show the license of the project.
84 !insertmacro MUI_PAGE_LICENSE "..\COPYING"
85
86 # Show a screen which allows the user to select which components to install.
87 !insertmacro MUI_PAGE_COMPONENTS
88
89 # Allow the user to select a different install directory.
90 !insertmacro MUI_PAGE_DIRECTORY
91
92 # Perform the actual installation, i.e. install the files.
93 !insertmacro MUI_PAGE_INSTFILES
94
95 # Show a final "We're done, click Finish to close this wizard" message.
96 !insertmacro MUI_PAGE_FINISH
97
98 # Pages used for the uninstaller.
99 !insertmacro MUI_UNPAGE_WELCOME
100 !insertmacro MUI_UNPAGE_CONFIRM
101 !insertmacro MUI_UNPAGE_INSTFILES
102 !insertmacro MUI_UNPAGE_FINISH
103
104
105 # --- MUI language files ------------------------------------------------------
106
107 # Select an installer language (required!).
108 !insertmacro MUI_LANGUAGE "English"
109
110
111 # --- Default section ---------------------------------------------------------
112
113 Section "@PACKAGE_NAME@ (required)" Section1
114
115         # This section is gray (can't be disabled) in the component list.
116         SectionIn RO
117
118         # Install the file(s) specified below into the specified directory.
119         SetOutPath "$INSTDIR"
120
121         # License file
122         File "..\COPYING"
123
124         # sigrok libs
125         File "c:\MinGW\msys\1.0\local\lib\libsigrok.a"
126         File "c:\MinGW\msys\1.0\local\lib\libsigrokdecode.a"
127
128         # sigrok-gtk
129         File "c:\MinGW\msys\1.0\local\bin\@PACKAGE_NAME@.exe"
130
131         # Icon
132         File "sigrok-logo-notext.ico"
133
134         # MinGW libs
135         File "c:\MinGW\bin\mingwm10.dll"
136         File "c:\MinGW\bin\libgcc_s_dw2-1.dll"
137         File "c:\MinGW\bin\intl.dll"
138         File "c:\MinGW\bin\libiconv-2.dll"
139         File "c:\MinGW\bin\libstdc++-6.dll"
140
141         # MSYS libs.
142         File "c:\MinGW\msys\1.0\bin\msys-1.0.dll"
143         File "c:\MinGW\msys\1.0\bin\msys-z.dll"
144
145         # External libs
146         File "c:\MinGW\msys\1.0\local\bin\libglib-2.0-0.dll"
147         File "c:\MinGW\msys\1.0\local\bin\libgthread-2.0-0.dll"
148         File "c:\MinGW\msys\1.0\local\bin\libusb-1.0.dll"
149         File "c:\MinGW\msys\1.0\local\bin\zlib1.dll"
150         File "c:\MinGW\msys\1.0\local\bin\libzip-2.dll"
151         File "c:\MinGW\msys\1.0\local\bin\libusb0.dll"
152         File "c:\MinGW\msys\1.0\local\bin\libftdi.dll"
153
154         # GTK+ libs
155         File "c:\MinGW\msys\1.0\local\bin\freetype6.dll"
156         File "c:\MinGW\msys\1.0\local\bin\libatk-*.dll"
157         File "c:\MinGW\msys\1.0\local\bin\libcairo-*.dll"
158         File "c:\MinGW\msys\1.0\local\bin\libfontconfig-*.dll"
159         File "c:\MinGW\msys\1.0\local\bin\libgdk_pixbuf-*.dll"
160         File "c:\MinGW\msys\1.0\local\bin\libgdk-win32-*.dll"
161         File "c:\MinGW\msys\1.0\local\bin\libgio-*.dll"
162         File "c:\MinGW\msys\1.0\local\bin\libgmodule-*.dll"
163         File "c:\MinGW\msys\1.0\local\bin\libgobject-*.dll"
164         File "c:\MinGW\msys\1.0\local\bin\libgtk-win32-*.dll"
165         File "c:\MinGW\msys\1.0\local\bin\libpango-*.dll"
166         File "c:\MinGW\msys\1.0\local\bin\libpangocairo-*.dll"
167         File "c:\MinGW\msys\1.0\local\bin\libpangoft2-*.dll"
168         File "c:\MinGW\msys\1.0\local\bin\libpangowin32-*.dll"
169         File "c:\MinGW\msys\1.0\local\bin\libpng*.dll"
170         File "c:\MinGW\msys\1.0\local\bin\libexpat-*.dll"
171
172         # Install the file(s) specified below into the specified directory.
173         SetOutPath "$INSTDIR\decoders"
174
175         # Protocol decoders
176         File /r /x "__pycache__" \
177                 "c:\MinGW\msys\1.0\local\share\libsigrokdecode\decoders\*"
178
179         # Generate the uninstaller executable.
180         WriteUninstaller "$INSTDIR\Uninstall.exe"
181
182         # Create a sub-directory in the start menu.
183         CreateDirectory "$SMPROGRAMS\sigrok"
184         CreateDirectory "$SMPROGRAMS\sigrok\@PACKAGE_NAME@"
185
186         # Create a shortcut for the GTK+ GUI application.
187         CreateShortCut \
188                 "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\sigrok GTK+ GUI.lnk" \
189                 "$INSTDIR\@PACKAGE_NAME@.exe" "" \
190                 "$INSTDIR\@PACKAGE_NAME@.exe" 0 SW_SHOWNORMAL \
191                 "" "Open-source, portable logic analyzer software"
192
193         # Create a shortcut for the uninstaller.
194         CreateShortCut "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\Uninstall.lnk" \
195                 "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 \
196                 SW_SHOWNORMAL "" "Uninstall @PACKAGE_NAME@"
197
198         # Create registry keys for "Add/remove programs" in the control panel.
199         WriteRegStr HKLM "${REGSTR}" "DisplayName" "@PACKAGE_STRING@"
200         WriteRegStr HKLM "${REGSTR}" "UninstallString" \
201                 "$\"$INSTDIR\Uninstall.exe$\""
202         WriteRegStr HKLM "${REGSTR}" "InstallLocation" "$\"$INSTDIR$\""
203         WriteRegStr HKLM "${REGSTR}" "DisplayIcon" \
204                 "$\"$INSTDIR\sigrok-logo-notext.ico$\""
205         WriteRegStr HKLM "${REGSTR}" "Publisher" "sigrok"
206         WriteRegStr HKLM "${REGSTR}" "HelpLink" \
207                 "http://sigrok.org/wiki/Sigrok-gtk"
208         WriteRegStr HKLM "${REGSTR}" "URLUpdateInfo" \
209                 "http://sigrok.org/wiki/Downloads"
210         WriteRegStr HKLM "${REGSTR}" "URLInfoAbout" "http://sigrok.org"
211         WriteRegStr HKLM "${REGSTR}" "DisplayVersion" "@PACKAGE_VERSION@"
212         WriteRegStr HKLM "${REGSTR}" "Contact" \
213                 "sigrok-devel@lists.sourceforge.org"
214         WriteRegStr HKLM "${REGSTR}" "Comments" \
215                 "This is the sigrok command-line application."
216
217         # Display "Remove" instead of "Modify/Remove" in the control panel.
218         WriteRegDWORD HKLM "${REGSTR}" "NoModify" 1
219         WriteRegDWORD HKLM "${REGSTR}" "NoRepair" 1
220
221 SectionEnd
222
223
224 # --- Python installer section ------------------------------------------------
225
226 Section "Python" Section2
227
228         # Copy the Python installer MSI file into the temporary directory.
229         SetOutPath "$TEMP"
230         File "c:\${PY_INST}"
231
232         # Run the Python installer MSI file from within our installer.
233         ExecWait '"msiexec" /i "$TEMP\${PY_INST}" /QB- /passive ALLUSERS=1'
234
235         # Remove Python installer MSI file again.
236         Delete "$TEMP\${PY_INST}"
237
238 SectionEnd
239
240
241 # --- Uninstaller section -----------------------------------------------------
242
243 Section "Uninstall"
244
245         # Always delete the uninstaller first (yes, this really works).
246         Delete "$INSTDIR\Uninstall.exe"
247
248         # Delete the application, the application data, and related libs.
249         Delete "$INSTDIR\COPYING"
250         Delete "$INSTDIR\libsigrok.a"
251         Delete "$INSTDIR\libsigrokdecode.a"
252         Delete "$INSTDIR\@PACKAGE_NAME@.exe"
253         Delete "$INSTDIR\sigrok-logo-notext.ico"
254         Delete "$INSTDIR\mingwm10.dll"
255         Delete "$INSTDIR\libgcc_s_dw2-1.dll"
256         Delete "$INSTDIR\intl.dll"
257         Delete "$INSTDIR\libiconv-2.dll"
258         Delete "$INSTDIR\libstdc++-6.dll"
259         Delete "$INSTDIR\msys-1.0.dll"
260         Delete "$INSTDIR\msys-z.dll"
261         Delete "$INSTDIR\libglib-2.0-0.dll"
262         Delete "$INSTDIR\libgthread-2.0-0.dll"
263         Delete "$INSTDIR\libusb-1.0.dll"
264         Delete "$INSTDIR\zlib1.dll"
265         Delete "$INSTDIR\libzip-2.dll"
266         Delete "$INSTDIR\libusb0.dll"
267         Delete "$INSTDIR\libftdi.dll"
268         Delete "$INSTDIR\freetype6.dll"
269         Delete "$INSTDIR\libatk-*.dll"
270         Delete "$INSTDIR\libcairo-*.dll"
271         Delete "$INSTDIR\libfontconfig-*.dll"
272         Delete "$INSTDIR\libgdk_pixbuf-*.dll"
273         Delete "$INSTDIR\libgdk-win32-*.dll"
274         Delete "$INSTDIR\libgio-*.dll"
275         Delete "$INSTDIR\libgmodule-*.dll"
276         Delete "$INSTDIR\libgobject-*.dll"
277         Delete "$INSTDIR\libgtk-win32-*.dll"
278         Delete "$INSTDIR\libpango-*.dll"
279         Delete "$INSTDIR\libpangocairo-*.dll"
280         Delete "$INSTDIR\libpangoft2-*.dll"
281         Delete "$INSTDIR\libpangowin32-*.dll"
282         Delete "$INSTDIR\libpng*.dll"
283         Delete "$INSTDIR\libexpat-*.dll"
284
285         # Delete all decoders and everything else in decoders/.
286         # There could be *.pyc files or __pycache__ subdirs and so on.
287         RMDir /r "$INSTDIR\decoders\*"
288
289         # Delete the install directory and its sub-directories.
290         RMDir "$INSTDIR\decoders"
291         RMDir "$INSTDIR"
292
293         # Delete the links from the start menu.
294         Delete "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\sigrok GTK+ GUI.lnk"
295         Delete "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\Uninstall.lnk"
296
297         # Delete the sub-directory in the start menu.
298         RMDir "$SMPROGRAMS\sigrok\@PACKAGE_NAME@"
299         RMDir "$SMPROGRAMS\sigrok"
300
301         # Delete the registry key(s).
302         DeleteRegKey HKLM "${REGSTR}"
303
304 SectionEnd
305
306
307 # --- Component selection section descriptions --------------------------------
308
309 LangString DESC_Section1 ${LANG_ENGLISH} "This installs the sigrok GTK+ GUI, the protocol decoders, and all required libraries."
310 LangString DESC_Section2 ${LANG_ENGLISH} "This installs Python 3.2 in its default location of c:\Python32. If you already have Python 3.2 installed, you don't need to re-install it."
311
312 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
313 !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
314 !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
315 !insertmacro MUI_FUNCTION_DESCRIPTION_END
316