Change MagickImageProxy to FFmpegImageProxy and make it use FFmpeg
[dcpomatic.git] / platform / windows / wscript
1 from __future__ import print_function
2 import os
3
4 def write_installer(bits, windows_version, dcpomatic_version, debug):
5     try:
6         os.makedirs('build/platform/windows')
7     except:
8         pass
9
10     filename = 'build/platform/windows/installer.'
11     if windows_version is not None:
12         filename += 'xp.'
13     filename += '%d.nsi' % bits
14
15     f = open(filename, 'w')
16     print('!include "MUI2.nsh"', file=f)
17     if bits == 64:
18         print('!include "x64.nsh"', file=f)
19
20     if debug:
21         print('Name "DCP-o-matic debug"', file=f)
22     else:
23         print('Name "DCP-o-matic"', file=f)
24
25     print('RequestExecutionLevel admin', file=f)
26
27     outfile = 'DCP-o-matic '
28     if debug:
29         outfile += 'Debug '
30     outfile += '%s %d-bit ' % (dcpomatic_version, bits)
31     if windows_version is 'xp':
32         outfile += 'XP '
33     outfile += 'Installer.exe'
34
35     print('outFile "%s"' % outfile, file=f)
36
37     print("""
38 !define MUI_ICON "%graphics%/windows/dcpomatic2.ico"
39 !define MUI_UNICON "%graphics%/windows/dcpomatic2.ico"
40 !define MUI_SPECIALBITMAP "%graphics%/windows/dcpomatic.bmp"
41 !include "Sections.nsh"
42     """, file=f)
43
44     if bits == 64:
45         program_files = "$PROGRAMFILES64"
46     else:
47         program_files = "$PROGRAMFILES"
48
49     if debug:
50         print('InstallDir "%s\\DCP-o-matic 2 debug"' % program_files, file=f)
51     else:
52         print('InstallDir "%s\\DCP-o-matic 2"' % program_files, file=f)
53
54     print("""
55 !insertmacro MUI_PAGE_WELCOME
56 !insertmacro MUI_PAGE_LICENSE "../../../COPYING"
57 !insertmacro MUI_PAGE_DIRECTORY
58 !insertmacro MUI_PAGE_COMPONENTS
59
60 Section "Common files (required)" SEC_COMMON
61 SectionIn RO
62     """, file=f)
63
64     if bits == 64:
65         print("""
66 ; disable registry redirection (enable access to 64-bit portion of registry)
67 SetRegView 64
68         """, file=f)
69
70     print("""
71 SetOutPath "$INSTDIR\\bin"
72 WriteUninstaller "$INSTDIR\\Uninstall.exe"
73
74 File "%static_deps%/bin/libintl-8.dll"
75 File "%static_deps%/bin/libboost_chrono-mt.dll"
76 File "%static_deps%/bin/libboost_filesystem-mt.dll"
77 File "%static_deps%/bin/libboost_system-mt.dll"
78 File "%static_deps%/bin/libboost_thread_win32-mt.dll"
79 File "%static_deps%/bin/libboost_date_time-mt.dll"
80 File "%static_deps%/bin/libboost_locale-mt.dll"
81 File "%static_deps%/bin/libboost_regex-mt.dll"
82 File "%static_deps%/bin/libeay32.dll"
83 """, file=f)
84
85     if bits == 32:
86         print('File "%static_deps%/bin/libgcc_s_sjlj-1.dll"', file=f)
87     else:
88         print('File "%static_deps%/bin/libgcc_s_seh-1.dll"', file=f)
89
90     print("""
91 File "%static_deps%/bin/libgio-2.0-0.dll"
92 File "%static_deps%/bin/libglib-2.0-0.dll"
93 File "%static_deps%/bin/libgobject-2.0-0.dll"
94 File "%static_deps%/bin/libiconv-2.dll"
95 File "%static_deps%/bin/libjpeg-9.dll"
96 File "%static_deps%/bin/libpng16-16.dll"
97 File "%static_deps%/bin/libsigc-2.0-0.dll"
98 File "%static_deps%/bin/libsndfile-1.dll"
99 File "%static_deps%/bin/libssh.dll"
100 File "%static_deps%/bin/libstdc++-6.dll"
101 File "%static_deps%/bin/zlib1.dll"
102 File "%static_deps%/bin/libjpeg-9.dll"
103 File "%static_deps%/bin/wxbase30u_gcc_custom.dll"
104 File "%static_deps%/bin/wxmsw30u_core_gcc_custom.dll"
105 File "%static_deps%/bin/wxmsw30u_adv_gcc_custom.dll"
106 File "%static_deps%/bin/wxmsw30u_richtext_gcc_custom.dll"
107 File "%static_deps%/bin/wxmsw30u_html_gcc_custom.dll"
108 File "%static_deps%/bin/wxbase30u_xml_gcc_custom.dll"
109 File "%static_deps%/bin/libcairo-2.dll"
110 File "%static_deps%/bin/libfreetype-6.dll"
111 File "%static_deps%/bin/libgthread-2.0-0.dll"
112 File "%static_deps%/bin/libpango-1.0-0.dll"
113 File "%static_deps%/bin/libgmodule-2.0-0.dll"
114 File "%static_deps%/bin/libpangocairo-1.0-0.dll"
115 File "%static_deps%/bin/libpangowin32-1.0-0.dll"
116 File "%static_deps%/bin/libtiff-5.dll"
117 File "%static_deps%/bin/libglibmm-2.4-1.dll"
118 File "%static_deps%/bin/libxml++-2.6-2.dll"
119 File "%static_deps%/bin/libxml2-2.dll"
120 File "%static_deps%/bin/libpixman-1-0.dll"
121 File "%static_deps%/bin/libfontconfig-1.dll"
122 File "%static_deps%/bin/libexpat-1.dll"
123 File "%static_deps%/bin/libbz2.dll"
124 File "%static_deps%/bin/libxmlsec1.dll"
125 File "%static_deps%/bin/libxmlsec1-openssl.dll"
126 File "%static_deps%/bin/libexslt-0.dll"
127 File "%static_deps%/bin/libxslt-1.dll"
128 File "%static_deps%/bin/libffi-6.dll"
129 File "%static_deps%/bin/openssl.exe"
130 File "%static_deps%/bin/libcurl-4.dll"
131 File "%static_deps%/bin/ssleay32.dll"
132 File "%static_deps%/bin/libzip-4.dll"
133 File "%static_deps%/bin/libcairomm-1.0-1.dll"
134 File "%static_deps%/bin/libpangomm-1.4-1.dll"
135 File "%static_deps%/bin/libsamplerate-0.dll"
136 File "%static_deps%/bin/libnettle-6.dll"
137 File "%static_deps%/bin/icuuc56.dll"
138 File "%static_deps%/bin/icudt56.dll"
139 File "%static_deps%/bin/icuin56.dll"
140 File "%static_deps%/bin/liblzma-5.dll"
141 File "%static_deps%/bin/libpcre-1.dll"
142 File "%static_deps%/bin/libharfbuzz-0.dll"
143 File "%static_deps%/bin/libjasper.dll"
144 File "%static_deps%/bin/liblcms2-2.dll"
145 File "%static_deps%/bin/libwinpthread-1.dll"
146 File "%static_deps%/bin/libgnutls-30.dll"
147 File "%static_deps%/bin/libgmp-10.dll"
148 File "%static_deps%/bin/libhogweed-4.dll"
149 File "%static_deps%/bin/libidn2-0.dll"
150 File "%static_deps%/bin/libunistring-2.dll"
151 File "%static_deps%/bin/libssh2-1.dll"
152 File "%static_deps%/bin/libgcrypt-20.dll"
153 """, file=f)
154
155     if bits == 32:
156         print('File "%static_deps%/bin/libgpg-error-0.dll"', file=f)
157     else:
158         print('File "%static_deps%/bin/libgpg-error6-0.dll"', file=f)
159
160     print("""
161 File "%static_deps%/bin/libpangoft2-1.0-0.dll"
162 File "%static_deps%/bin/libx264-152.dll"
163
164 File "%cdist_deps%/bin/asdcp-cth.dll"
165 File "%cdist_deps%/bin/kumu-cth.dll"
166     """, file=f)
167
168     if windows_version == 'xp':
169         print("""
170 File "%cdist_deps%/bin/avcodec-57.dll"
171 File "%cdist_deps%/bin/avfilter-6.dll"
172 File "%cdist_deps%/bin/avformat-57.dll"
173 File "%cdist_deps%/bin/avutil-55.dll"
174 File "%cdist_deps%/bin/avdevice-57.dll"
175 File "%cdist_deps%/bin/postproc-54.dll"
176 File "%cdist_deps%/bin/swresample-2.dll"
177 File "%cdist_deps%/bin/swscale-4.dll"
178         """, file=f)
179     else:
180         print("""
181 File "%cdist_deps%/bin/avcodec-58.dll"
182 File "%cdist_deps%/bin/avfilter-7.dll"
183 File "%cdist_deps%/bin/avformat-58.dll"
184 File "%cdist_deps%/bin/avutil-56.dll"
185 File "%cdist_deps%/bin/avdevice-58.dll"
186 File "%cdist_deps%/bin/postproc-55.dll"
187 File "%cdist_deps%/bin/swresample-3.dll"
188 File "%cdist_deps%/bin/swscale-5.dll"
189         """, file=f)
190
191     print("""
192 File "%cdist_deps%/bin/dcp-1.0.dll"
193 File "%cdist_deps%/bin/cxml-0.dll"
194 File "%cdist_deps%/bin/sub-1.0.dll"
195 File "%cdist_deps%/bin/ffprobe.exe"
196     """, file=f)
197
198     if windows_version == 'xp':
199         print('File "%cdist_deps%/bin/libopenjpeg-1.dll"', file=f)
200     else:
201         print('File "%cdist_deps%/bin/libopenjp2.dll"', file=f)
202
203     if debug:
204         print('File "%resources%/gdb_script"', file=f)
205         print('File "%resources%/dcpomatic2_debug.bat"', file=f)
206         print('File "%resources%/dcpomatic2_batch_debug.bat"', file=f)
207         print('File "%resources%/dcpomatic2_kdm_debug.bat"', file=f)
208         print('File "%resources%/dcpomatic2_player_debug.bat"', file=f)
209         print('File "%mingw%/gdb.exe"', file=f)
210         print('File "%mingw%/addr2line.exe"', file=f)
211     else:
212         print('File "%binaries%/src/wx/dcpomatic2-wx.dll"', file=f)
213         print('File "%binaries%/src/lib/dcpomatic2.dll"', file=f)
214
215     print("""
216 SetOutPath "$INSTDIR\\bin"
217
218 SetOutPath "$INSTDIR\\locale\\fr\\LC_MESSAGES"
219 File "%binaries%/src/lib/mo/fr_FR/libdcpomatic2.mo"
220 File "%binaries%/src/wx/mo/fr_FR/libdcpomatic2-wx.mo"
221 File "%binaries%/src/tools/mo/fr_FR/dcpomatic2.mo"
222 File "%static_deps%/share/locale/fr/LC_MESSAGES/wxstd.mo"
223 SetOutPath "$INSTDIR\\locale\\it\\LC_MESSAGES"
224 File "%binaries%/src/lib/mo/it_IT/libdcpomatic2.mo"
225 File "%binaries%/src/wx/mo/it_IT/libdcpomatic2-wx.mo"
226 File "%binaries%/src/tools/mo/it_IT/dcpomatic2.mo"
227 File "%static_deps%/share/locale/it/LC_MESSAGES/wxstd.mo"
228 SetOutPath "$INSTDIR\\locale\\es\\LC_MESSAGES"
229 File "%binaries%/src/lib/mo/es_ES/libdcpomatic2.mo"
230 File "%binaries%/src/wx/mo/es_ES/libdcpomatic2-wx.mo"
231 File "%binaries%/src/tools/mo/es_ES/dcpomatic2.mo"
232 File "%static_deps%/share/locale/es/LC_MESSAGES/wxstd.mo"
233 SetOutPath "$INSTDIR\\locale\\sv\\LC_MESSAGES"
234 File "%binaries%/src/lib/mo/sv_SE/libdcpomatic2.mo"
235 File "%binaries%/src/wx/mo/sv_SE/libdcpomatic2-wx.mo"
236 File "%binaries%/src/tools/mo/sv_SE/dcpomatic2.mo"
237 File "%static_deps%/share/locale/sv/LC_MESSAGES/wxstd.mo"
238 SetOutPath "$INSTDIR\\locale\\de\\LC_MESSAGES"
239 File "%binaries%/src/lib/mo/de_DE/libdcpomatic2.mo"
240 File "%binaries%/src/wx/mo/de_DE/libdcpomatic2-wx.mo"
241 File "%binaries%/src/tools/mo/de_DE/dcpomatic2.mo"
242 File "%static_deps%/share/locale/de/LC_MESSAGES/wxstd.mo"
243 SetOutPath "$INSTDIR\\locale\\nl\\LC_MESSAGES"
244 File "%binaries%/src/lib/mo/nl_NL/libdcpomatic2.mo"
245 File "%binaries%/src/wx/mo/nl_NL/libdcpomatic2-wx.mo"
246 File "%binaries%/src/tools/mo/nl_NL/dcpomatic2.mo"
247 File "%static_deps%/share/locale/nl/LC_MESSAGES/wxstd.mo"
248 SetOutPath "$INSTDIR\\locale\\ru\\LC_MESSAGES"
249 File "%binaries%/src/lib/mo/ru_RU/libdcpomatic2.mo"
250 File "%binaries%/src/wx/mo/ru_RU/libdcpomatic2-wx.mo"
251 File "%binaries%/src/tools/mo/ru_RU/dcpomatic2.mo"
252 File "%static_deps%/share/locale/ru/LC_MESSAGES/wxstd.mo"
253 SetOutPath "$INSTDIR\\locale\\pl\\LC_MESSAGES"
254 File "%binaries%/src/lib/mo/pl_PL/libdcpomatic2.mo"
255 File "%binaries%/src/wx/mo/pl_PL/libdcpomatic2-wx.mo"
256 File "%binaries%/src/tools/mo/pl_PL/dcpomatic2.mo"
257 File "%static_deps%/share/locale/pl/LC_MESSAGES/wxstd.mo"
258 SetOutPath "$INSTDIR\\locale\\da\\LC_MESSAGES"
259 File "%binaries%/src/lib/mo/da_DK/libdcpomatic2.mo"
260 File "%binaries%/src/wx/mo/da_DK/libdcpomatic2-wx.mo"
261 File "%binaries%/src/tools/mo/da_DK/dcpomatic2.mo"
262 File "%static_deps%/share/locale/da/LC_MESSAGES/wxstd.mo"
263 SetOutPath "$INSTDIR\\locale\\pt_PT\\LC_MESSAGES"
264 File "%binaries%/src/lib/mo/pt_PT/libdcpomatic2.mo"
265 File "%binaries%/src/wx/mo/pt_PT/libdcpomatic2-wx.mo"
266 File "%binaries%/src/tools/mo/pt_PT/dcpomatic2.mo"
267 SetOutPath "$INSTDIR\\locale\\pt_BR\\LC_MESSAGES"
268 File "%binaries%/src/lib/mo/pt_BR/libdcpomatic2.mo"
269 File "%binaries%/src/wx/mo/pt_BR/libdcpomatic2-wx.mo"
270 File "%binaries%/src/tools/mo/pt_BR/dcpomatic2.mo"
271 SetOutPath "$INSTDIR\\locale\\sk\\LC_MESSAGES"
272 File "%binaries%/src/lib/mo/sk_SK/libdcpomatic2.mo"
273 File "%binaries%/src/wx/mo/sk_SK/libdcpomatic2-wx.mo"
274 File "%binaries%/src/tools/mo/sk_SK/dcpomatic2.mo"
275 SetOutPath "$INSTDIR\\locale\\cs\\LC_MESSAGES"
276 File "%binaries%/src/lib/mo/cs_CZ/libdcpomatic2.mo"
277 File "%binaries%/src/wx/mo/cs_CZ/libdcpomatic2-wx.mo"
278 File "%binaries%/src/tools/mo/cs_CZ/dcpomatic2.mo"
279 File "%static_deps%/share/locale/cs/LC_MESSAGES/wxstd.mo"
280 SetOutPath "$INSTDIR\\locale\\uk\\LC_MESSAGES"
281 File "%binaries%/src/lib/mo/uk_UA/libdcpomatic2.mo"
282 File "%binaries%/src/wx/mo/uk_UA/libdcpomatic2-wx.mo"
283 File "%binaries%/src/tools/mo/uk_UA/dcpomatic2.mo"
284 SetOutPath "$INSTDIR\\locale\\zh_cn\\LC_MESSAGES"
285 File "%binaries%/src/lib/mo/zh_CN/libdcpomatic2.mo"
286 File "%binaries%/src/wx/mo/zh_CN/libdcpomatic2-wx.mo"
287 File "%binaries%/src/tools/mo/zh_CN/dcpomatic2.mo"
288
289 SetOutPath "$INSTDIR"
290 File "%resources%/../../fonts/LiberationSans-Regular.ttf"
291 File "%resources%/../../fonts/LiberationSans-Italic.ttf"
292 File "%resources%/../../fonts/LiberationSans-Bold.ttf"
293 File "%graphics%/splash.png"
294 File "%graphics%/zoom.png"
295 File "%graphics%/zoom_all.png"
296 File "%graphics%/select.png"
297 File "%graphics%/snap.png"
298 File "%graphics%/sequence.png"
299
300 SectionEnd
301     """, file=f)
302
303     if debug:
304         print('Section "DCP-o-matic 2 debug" SEC_MASTER', file=f)
305     else:
306         print('Section "DCP-o-matic 2" SEC_MASTER', file=f)
307
308     print('SetOutPath "$INSTDIR\\bin"', file=f)
309
310     if debug:
311         print('CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2 debug"', file=f)
312     else:
313         print('CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"', file=f)
314
315     print("""
316 File "%binaries%/src/tools/dcpomatic2.exe"
317 File "%binaries%/src/tools/dcpomatic2_batch.exe"
318 File "%binaries%/src/tools/dcpomatic2_cli.exe"
319 File "%binaries%/src/tools/dcpomatic2_create.exe"
320 File "%binaries%/src/tools/dcpomatic2_kdm.exe"
321 File "%binaries%/src/tools/dcpomatic2_player.exe"
322     """, file=f)
323
324     if debug:
325         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat"', file=f)
326         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 batch converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
327         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 KDM creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
328         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Player debug.lnk" "$INSTDIR\\bin\\dcpomatic2_player_debug.bat" ""', file=f)
329         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
330         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "DisplayName" "DCP-o-matic 2 debug (remove only)"', file=f)
331         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
332     else:
333         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe"', file=f)
334         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
335         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 KDM creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
336         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
337         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
338         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"', file=f)
339         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
340
341     print("SectionEnd", file=f)
342
343     if debug:
344         print('Section "DCP-o-matic 2 debug desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
345         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat" ""', file=f)
346         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 batch converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
347         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
348         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Player debug.lnk" "$INSTDIR\\bin\\dcpomatic2_player_debug.bat" ""', file=f)
349     else:
350         print('Section "DCP-o-matic 2 desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
351         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""', file=f)
352         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
353         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
354         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
355
356     print("SectionEnd", file=f)
357
358     if not debug:
359         print("""
360 Section "Encode server" SEC_SERVER
361 SetOutPath "$INSTDIR\\bin"
362 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
363 File "%binaries%/src/tools/dcpomatic2_server_cli.exe"
364 File "%binaries%/src/tools/dcpomatic2_server.exe"
365 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" "" "$INSTDIR\\bin\\dcpomatic2_server.exe" 0
366 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
367 SectionEnd
368     """, file=f)
369
370         print("""
371 Section "Encode server desktop shortcuts" SEC_SERVER_DESKTOP
372 CreateShortCut "$DESKTOP\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" ""
373 SectionEnd
374     """, file=f)
375
376     if debug:
377         print('LangString DESC_SEC_MASTER ${LANG_ENGLISH} "DCP-o-matic 2 debug"', file=f)
378         print('LangString DESC_SEC_MASTER_DESKTOP ${LANG_ENGLISH} "DCP-o-matic 2 debug desktop shortcuts"', file=f)
379     else:
380         print('LangString DESC_SEC_MASTER ${LANG_ENGLISH} "DCP-o-matic 2"', file=f)
381         print('LangString DESC_SEC_MASTER_DESKTOP ${LANG_ENGLISH} "DCP-o-matic 2 desktop shortcuts"', file=f)
382         print('LangString DESC_SEC_SERVER ${LANG_ENGLISH} "DCP-o-matic 2 encode server"', file=f)
383         print('LangString DESC_SEC_SERVER_DESKTOP ${LANG_ENGLISH} "DCP-o-matic 2 encode server desktop shortcuts"', file=f)
384
385     print("""
386 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
387   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MASTER} $(DESC_SEC_MASTER)
388   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MASTER_DESKTOP} $(DESC_SEC_MASTER_DESKTOP)
389   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER} $(DESC_SEC_SERVER)
390   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER_DESKTOP} $(DESC_SEC_SERVER_DESKTOP)
391 !insertmacro MUI_FUNCTION_DESCRIPTION_END
392
393 !insertmacro MUI_PAGE_INSTFILES
394 !insertmacro MUI_PAGE_FINISH
395
396 !insertmacro MUI_UNPAGE_WELCOME
397 !insertmacro MUI_UNPAGE_CONFIRM
398 !insertmacro MUI_UNPAGE_INSTFILES
399 !insertmacro MUI_UNPAGE_FINISH
400 !insertmacro MUI_LANGUAGE "English"
401     """, file=f)
402
403     if debug:
404         print("""
405 Section "Uninstall"
406 RMDir /r "$INSTDIR\\*.*"
407 RMDir "$INSTDIR"
408 Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
409 Delete "$DESKTOP\\DCP-o-matic 2 batch converter debug.lnk"
410 Delete "$DESKTOP\\DCP-o-matic 2 KDM creator debug.lnk"
411 Delete "$SMPROGRAMS\\DCP-o-matic 2 debug\\*.*"
412 RmDir  "$SMPROGRAMS\\DCP-o-matic 2 debug"
413 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2 debug"
414 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug"
415  SectionEnd
416         """, file=f)
417     else:
418         print("""
419 Section "Uninstall"
420 RMDir /r "$INSTDIR\\*.*"
421 RMDir "$INSTDIR"
422 Delete "$DESKTOP\\DCP-o-matic 2.lnk"
423 Delete "$DESKTOP\\DCP-o-matic 2 batch converter.lnk"
424 Delete "$DESKTOP\\DCP-o-matic 2 encode server.lnk"
425 Delete "$DESKTOP\\DCP-o-matic 2 KDM creator.lnk"
426 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
427 RmDir  "$SMPROGRAMS\\DCP-o-matic 2"
428 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2"
429 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2"
430  SectionEnd
431     """, file=f)
432
433
434 def build(bld):
435     write_installer(32, None, bld.env.VERSION, bld.env.DEBUG)
436     write_installer(64, None, bld.env.VERSION, bld.env.DEBUG)
437     write_installer(32, 'xp', bld.env.VERSION, bld.env.DEBUG)
438     write_installer(64, 'xp', bld.env.VERSION, bld.env.DEBUG)