]>
Commit | Line | Data |
---|---|---|
2c45d102 UH |
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-cli 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@-installer-@PACKAGE_VERSION@.exe" | |
40 | ||
41 | # Where to install the application. | |
42 | InstallDir "$PROGRAMFILES\sigrok\@PACKAGE_NAME@" | |
43 | ||
cde481b1 UH |
44 | # Request admin privileges for Windows Vista and Windows 7. |
45 | # http://nsis.sourceforge.net/Docs/Chapter4.html | |
46 | RequestExecutionLevel admin | |
2c45d102 UH |
47 | |
48 | ||
49 | # --- MUI interface configuration --------------------------------------------- | |
50 | ||
51 | # Use the following icon for the installer EXE file. | |
52 | !define MUI_ICON "sigrok-logo-notext.ico" | |
53 | ||
54 | # Show a nice image at the top of each installer page. | |
55 | !define MUI_HEADERIMAGE | |
56 | ||
57 | # Don't automatically go to the Finish page so the user can check the log. | |
58 | !define MUI_FINISHPAGE_NOAUTOCLOSE | |
59 | ||
60 | # Upon "cancel", ask the user if he really wants to abort the installer. | |
61 | !define MUI_ABORTWARNING | |
62 | ||
63 | # Don't force the user to accept the license, just show it. | |
64 | # Details: http://trac.videolan.org/vlc/ticket/3124 | |
65 | !define MUI_LICENSEPAGE_BUTTON $(^NextBtn) | |
66 | !define MUI_LICENSEPAGE_TEXT_BOTTOM "Click Next to continue." | |
67 | ||
68 | # File name of the Python installer MSI file. | |
69 | !define PY_INST "python-3.2.2.msi" | |
70 | ||
71 | # Standard install path of the Python installer (do not change!). | |
72 | !define PY_BIN "c:\Python32" | |
73 | ||
74 | ||
75 | # --- MUI pages --------------------------------------------------------------- | |
76 | ||
77 | # Show a nice "Welcome to the ... Setup Wizard" page. | |
78 | !insertmacro MUI_PAGE_WELCOME | |
79 | ||
80 | # Show the license of the project. | |
81 | !insertmacro MUI_PAGE_LICENSE "..\COPYING" | |
82 | ||
83 | # Show a screen which allows the user to select which components to install. | |
84 | !insertmacro MUI_PAGE_COMPONENTS | |
85 | ||
86 | # Allow the user to select a different install directory. | |
87 | !insertmacro MUI_PAGE_DIRECTORY | |
88 | ||
89 | # Perform the actual installation, i.e. install the files. | |
90 | !insertmacro MUI_PAGE_INSTFILES | |
91 | ||
92 | # Show a final "We're done, click Finish to close this wizard" message. | |
93 | !insertmacro MUI_PAGE_FINISH | |
94 | ||
95 | # Pages used for the uninstaller. | |
96 | !insertmacro MUI_UNPAGE_WELCOME | |
97 | !insertmacro MUI_UNPAGE_CONFIRM | |
98 | !insertmacro MUI_UNPAGE_INSTFILES | |
99 | !insertmacro MUI_UNPAGE_FINISH | |
100 | ||
101 | ||
102 | # --- MUI language files ------------------------------------------------------ | |
103 | ||
104 | # Select an installer language (required!). | |
105 | !insertmacro MUI_LANGUAGE "English" | |
106 | ||
107 | ||
108 | # --- Default section --------------------------------------------------------- | |
109 | ||
110 | Section "@PACKAGE_NAME@ (required)" Section1 | |
111 | ||
112 | # This section is gray (can't be disabled) in the component list. | |
113 | SectionIn RO | |
114 | ||
115 | # Install the file(s) specified below into the specified directory. | |
116 | SetOutPath "$INSTDIR" | |
117 | ||
118 | # License file | |
119 | File "..\COPYING" | |
120 | ||
121 | # sigrok libs | |
122 | File "c:\MinGW\msys\1.0\local\lib\libsigrok.a" | |
123 | File "c:\MinGW\msys\1.0\local\lib\libsigrokdecode.a" | |
124 | ||
125 | # sigrok-cli | |
126 | File "c:\MinGW\msys\1.0\local\bin\@PACKAGE_NAME@.exe" | |
127 | ||
128 | # MinGW libs | |
129 | File "c:\MinGW\bin\mingwm10.dll" | |
130 | File "c:\MinGW\bin\libgcc_s_dw2-1.dll" | |
131 | File "c:\MinGW\bin\intl.dll" | |
132 | File "c:\MinGW\bin\libiconv-2.dll" | |
133 | File "c:\MinGW\bin\libstdc++-6.dll" | |
134 | ||
3005dc6a UH |
135 | # MSYS libs. |
136 | File "c:\MinGW\msys\1.0\bin\msys-1.0.dll" | |
137 | File "c:\MinGW\msys\1.0\bin\msys-z.dll" | |
138 | ||
2c45d102 UH |
139 | # External libs |
140 | File "c:\MinGW\msys\1.0\local\bin\libglib-2.0-0.dll" | |
141 | File "c:\MinGW\msys\1.0\local\bin\libgthread-2.0-0.dll" | |
142 | File "c:\MinGW\msys\1.0\local\bin\libusb-1.0.dll" | |
143 | File "c:\MinGW\msys\1.0\local\bin\zlib1.dll" | |
144 | File "c:\MinGW\msys\1.0\local\bin\libzip-2.dll" | |
145 | File "c:\MinGW\msys\1.0\local\bin\libusb0.dll" | |
146 | File "c:\MinGW\msys\1.0\local\bin\libftdi.dll" | |
147 | ||
148 | # Install the file(s) specified below into the specified directory. | |
149 | SetOutPath "$INSTDIR\decoders" | |
150 | ||
151 | # Protocol decoders | |
152 | File /r /x "__pycache__" \ | |
153 | "c:\MinGW\msys\1.0\local\share\libsigrokdecode\decoders\*" | |
154 | ||
155 | # Generate the uninstaller executable. | |
156 | WriteUninstaller "$INSTDIR\Uninstall.exe" | |
157 | ||
158 | # Create a sub-directory in the start menu. | |
159 | CreateDirectory "$SMPROGRAMS\sigrok" | |
160 | CreateDirectory "$SMPROGRAMS\sigrok\@PACKAGE_NAME@" | |
161 | ||
69ddd7a5 UH |
162 | # Create a shortcut for sigrok-cli (this merely opens a "DOS box"). |
163 | # Set the working directory (where the user will be placed into when | |
164 | # the DOS box starts) to the user's Desktop directory. | |
165 | SetOutPath "$DESKTOP" | |
166 | CreateShortCut "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\sigrok command-line tool.lnk" \ | |
167 | "$SYSDIR\cmd.exe" \ | |
168 | "/K echo For instructions run sigrok-cli --help." \ | |
ba77cddf | 169 | "$SYSDIR\cmd.exe" 0 \ |
69ddd7a5 | 170 | SW_SHOWNORMAL "" "Run @PACKAGE_NAME@" |
2c45d102 UH |
171 | |
172 | # Create a shortcut for the uninstaller. | |
173 | CreateShortCut "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\Uninstall.lnk" \ | |
174 | "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 \ | |
175 | SW_SHOWNORMAL "" "Uninstall @PACKAGE_NAME@" | |
176 | ||
69ddd7a5 UH |
177 | # TODO: Add sigrok-cli directory to the PATH env. variable. |
178 | ||
2c45d102 UH |
179 | SectionEnd |
180 | ||
181 | ||
182 | # --- Python installer section ------------------------------------------------ | |
183 | ||
184 | Section "Python" Section2 | |
185 | ||
186 | # Copy the Python installer MSI file into the temporary directory. | |
187 | SetOutPath "$TEMP" | |
188 | File "c:\${PY_INST}" | |
189 | ||
190 | # Run the Python installer MSI file from within our installer. | |
191 | ExecWait '"msiexec" /i "$TEMP\${PY_INST}" /QB- /passive ALLUSERS=1' | |
192 | ||
193 | # Remove Python installer MSI file again. | |
194 | Delete "$TEMP\${PY_INST}" | |
195 | ||
196 | SectionEnd | |
197 | ||
198 | ||
199 | # --- Uninstaller section ----------------------------------------------------- | |
200 | ||
201 | Section "Uninstall" | |
202 | ||
203 | # Always delete the uninstaller first (yes, this really works). | |
204 | Delete "$INSTDIR\Uninstall.exe" | |
205 | ||
206 | # Delete the application, the application data, and related libs. | |
207 | Delete "$INSTDIR\COPYING" | |
208 | Delete "$INSTDIR\libsigrok.a" | |
209 | Delete "$INSTDIR\libsigrokdecode.a" | |
210 | Delete "$INSTDIR\@PACKAGE_NAME@.exe" | |
211 | Delete "$INSTDIR\mingwm10.dll" | |
212 | Delete "$INSTDIR\libgcc_s_dw2-1.dll" | |
213 | Delete "$INSTDIR\intl.dll" | |
214 | Delete "$INSTDIR\libiconv-2.dll" | |
215 | Delete "$INSTDIR\libstdc++-6.dll" | |
3005dc6a UH |
216 | Delete "$INSTDIR\msys-1.0.dll" |
217 | Delete "$INSTDIR\msys-z.dll" | |
2c45d102 UH |
218 | Delete "$INSTDIR\libglib-2.0-0.dll" |
219 | Delete "$INSTDIR\libgthread-2.0-0.dll" | |
220 | Delete "$INSTDIR\libusb-1.0.dll" | |
221 | Delete "$INSTDIR\zlib1.dll" | |
222 | Delete "$INSTDIR\libzip-2.dll" | |
223 | Delete "$INSTDIR\libusb0.dll" | |
224 | Delete "$INSTDIR\libftdi.dll" | |
225 | ||
226 | # Delete all decoders and everything else in decoders/. | |
227 | # There could be *.pyc files or __pycache__ subdirs and so on. | |
228 | RMDir /r "$INSTDIR\decoders\*" | |
229 | ||
230 | # Delete the install directory and its sub-directories. | |
231 | RMDir "$INSTDIR\decoders" | |
232 | RMDir "$INSTDIR" | |
233 | ||
234 | # Delete the links from the start menu. | |
69ddd7a5 | 235 | Delete "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\sigrok command-line tool.lnk" |
2c45d102 UH |
236 | Delete "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\Uninstall.lnk" |
237 | ||
238 | # Delete the sub-directory in the start menu. | |
239 | RMDir "$SMPROGRAMS\sigrok\@PACKAGE_NAME@" | |
240 | RMDir "$SMPROGRAMS\sigrok" | |
241 | ||
242 | SectionEnd | |
243 | ||
244 | ||
245 | # --- Component selection section descriptions -------------------------------- | |
246 | ||
247 | LangString DESC_Section1 ${LANG_ENGLISH} "This installs the sigrok command-line tool, the protocol decoders, and all required libraries." | |
248 | 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." | |
249 | ||
250 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | |
251 | !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1) | |
252 | !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2) | |
253 | !insertmacro MUI_FUNCTION_DESCRIPTION_END | |
254 |