4e38e4f2d4ba7cb6ee54a2976f5d91a374dcd33c
[dcpomatic.git] / platform / windows / wscript
1 from __future__ import print_function
2 import os
3
4 def write_installer(bits, version):
5     try:
6         os.makedirs('build/platform/windows')
7     except:
8         pass
9
10     f = open('build/platform/windows/installer.%d.nsi' % bits, 'w')
11     print('!include "MUI2.nsh"', file=f)
12     if bits == 64:
13         print('!include "x64.nsh"', file=f)
14
15     print('Name "DCP-o-matic"', file=f)
16     print('RequestExecutionLevel admin', file=f)
17
18     print('outFile "DCP-o-matic %s %d-bit Installer.exe"' % (version, bits), file=f)
19     print("""
20 !define MUI_ICON "%resources%/dcpomatic.ico"
21 !define MUI_UNICON "%resources%/dcpomatic.ico"
22 !define MUI_SPECIALBITMAP "%resources%/dcpomatic.bmp"
23 !include "Sections.nsh"
24
25 InstallDir "$PROGRAMFILES\\DCP-o-matic 2"
26
27 !insertmacro MUI_PAGE_WELCOME
28 !insertmacro MUI_PAGE_LICENSE "../../../COPYING"
29 !insertmacro MUI_PAGE_DIRECTORY
30 !insertmacro MUI_PAGE_COMPONENTS
31
32 Section "Common files (required)" SEC_COMMON
33 SectionIn RO
34     """, file=f)
35
36     if bits == 64:
37         print("""
38 ${If} ${RunningX64}
39    DetailPrint "Installer running on 64-bit host"
40    ; disable registry redirection (enable access to 64-bit portion of registry)
41    SetRegView 64
42    ; change install dir
43    StrCpy $INSTDIR "$PROGRAMFILES64\DCP-o-matic 2"
44 ${EndIf}
45         """, file=f)
46
47     print("""
48 SetOutPath "$INSTDIR\\bin"
49 WriteUninstaller "$INSTDIR\Uninstall.exe"
50
51 File "%static_deps%/bin/libintl-8.dll"
52 File "%static_deps%/bin/libboost_chrono-mt.dll"
53 File "%static_deps%/bin/libboost_filesystem-mt.dll"
54 File "%static_deps%/bin/libboost_system-mt.dll"
55 File "%static_deps%/bin/libboost_thread_win32-mt.dll"
56 File "%static_deps%/bin/libboost_date_time-mt.dll"
57 File "%static_deps%/bin/libboost_locale-mt.dll"
58 File "%static_deps%/bin/libeay32.dll"
59 File "%static_deps%/bin/libgcc_s_sjlj-1.dll"
60 File "%static_deps%/bin/libgio-2.0-0.dll"
61 File "%static_deps%/bin/libglib-2.0-0.dll"
62 File "%static_deps%/bin/libgobject-2.0-0.dll"
63 File "%static_deps%/bin/libiconv-2.dll"
64 File "%static_deps%/bin/libjpeg-8.dll"
65 File "%static_deps%/bin/libMagick++-6.Q16-3.dll"
66 File "%static_deps%/bin/libMagickCore-6.Q16-1.dll"
67 File "%static_deps%/bin/libMagickWand-6.Q16-1.dll"
68 File "%static_deps%/bin/libpng15-15.dll"
69 File "%static_deps%/bin/libsigc-2.0-0.dll"
70 File "%static_deps%/bin/libsndfile-1.dll"
71 File "%static_deps%/bin/libssh.dll"
72 File "%static_deps%/bin/libstdc++-6.dll"
73 File "%static_deps%/bin/zlib1.dll"
74 File "%static_deps%/bin/libjpeg-8.dll"
75 File "%static_deps%/bin/wxbase30u_gcc_custom.dll"
76 File "%static_deps%/bin/wxmsw30u_core_gcc_custom.dll"
77 File "%static_deps%/bin/wxmsw30u_adv_gcc_custom.dll"
78 File "%static_deps%/bin/wxmsw30u_richtext_gcc_custom.dll"
79 File "%static_deps%/bin/wxmsw30u_html_gcc_custom.dll"
80 File "%static_deps%/bin/wxbase30u_xml_gcc_custom.dll"
81 File "%static_deps%/bin/libcairo-2.dll"
82 File "%static_deps%/bin/libfreetype-6.dll"
83 File "%static_deps%/bin/libgthread-2.0-0.dll"
84 File "%static_deps%/bin/libpango-1.0-0.dll"
85 File "%static_deps%/bin/libgmodule-2.0-0.dll"
86 File "%static_deps%/bin/libpangocairo-1.0-0.dll"
87 File "%static_deps%/bin/libpangowin32-1.0-0.dll"
88 File "%static_deps%/bin/libtiff-5.dll"
89 File "%static_deps%/bin/libglibmm-2.4-1.dll"
90 File "%static_deps%/bin/libxml++-2.6-2.dll"
91 File "%static_deps%/bin/libxml2-2.dll"
92 File "%static_deps%/bin/libpixman-1-0.dll"
93 File "%static_deps%/bin/libfontconfig-1.dll"
94 File "%static_deps%/bin/libexpat-1.dll"
95 File "%static_deps%/bin/libbz2.dll"
96 File "%static_deps%/bin/libxmlsec1.dll"
97 File "%static_deps%/bin/libxmlsec1-openssl.dll"
98 File "%static_deps%/bin/libexslt-0.dll"
99 File "%static_deps%/bin/libxslt-1.dll"
100 File "%static_deps%/bin/libffi-6.dll"
101 File "%static_deps%/bin/openssl.exe"
102 File "%static_deps%/bin/libcurl-4.dll"
103 File "%static_deps%/bin/ssleay32.dll"
104 File "%static_deps%/bin/libzip-2.dll"
105 File "%static_deps%/bin/libcairomm-1.0-1.dll"
106 File "%static_deps%/bin/libpangomm-1.4-1.dll"
107 File "%static_deps%/bin/pango-querymodules.exe"
108
109 File "%cdist_deps%/bin/asdcp-libdcp-1.0.dll"
110 File "%cdist_deps%/bin/kumu-libdcp-1.0.dll"
111 File "%cdist_deps%/bin/avcodec-56.dll"
112 File "%cdist_deps%/bin/avfilter-5.dll"
113 File "%cdist_deps%/bin/avformat-56.dll"
114 File "%cdist_deps%/bin/avutil-54.dll"
115 File "%cdist_deps%/bin/avdevice-56.dll"
116 File "%cdist_deps%/bin/postproc-53.dll"
117 File "%cdist_deps%/bin/dcp-1.0.dll"
118 File "%cdist_deps%/bin/libopenjpeg-1.dll"
119 File "%cdist_deps%/bin/swresample-1.dll"
120 File "%cdist_deps%/bin/swscale-3.dll"
121 File "%cdist_deps%/bin/cxml-0.dll"
122 File "%cdist_deps%/bin/sub.dll"
123 File "%cdist_deps%/bin/ffprobe.exe"
124
125 File "%binaries%/src/wx/dcpomatic2-wx.dll"
126 File "%binaries%/src/lib/dcpomatic2.dll"
127
128 SetOutPath "$INSTDIR\\lib\\pango\\1.8.0\\modules"
129 File "%static_deps%/lib/pango/1.8.0/modules/pango-arabic-lang.dll"
130 File "%static_deps%/lib/pango/1.8.0/modules/pango-basic-win32.dll"
131 File "%static_deps%/lib/pango/1.8.0/modules/pango-indic-lang.dll"
132
133 SetOutPath "$INSTDIR\\bin"
134 # I don't know why, but sometimes it seems that 
135 # delegates.xml must be in with the binaries, and
136 # sometimes in the $PROFILE.  Meh.
137 File "%static_deps%/etc/ImageMagick-6/delegates.xml"
138 SetOutPath "$PROFILE\\.magick"
139 File "%static_deps%/etc/ImageMagick-6/delegates.xml"
140
141 SetOutPath "$INSTDIR\\locale\\fr\\LC_MESSAGES"
142 File "%binaries%/src/lib/mo/fr_FR/libdcpomatic2.mo"
143 File "%binaries%/src/wx/mo/fr_FR/libdcpomatic2-wx.mo"
144 File "%binaries%/src/tools/mo/fr_FR/dcpomatic2.mo"
145 File "%static_deps%/share/locale/fr/LC_MESSAGES/wxstd.mo"
146 SetOutPath "$INSTDIR\\locale\\it\\LC_MESSAGES"
147 File "%binaries%/src/lib/mo/it_IT/libdcpomatic2.mo"
148 File "%binaries%/src/wx/mo/it_IT/libdcpomatic2-wx.mo"
149 File "%binaries%/src/tools/mo/it_IT/dcpomatic2.mo"
150 File "%static_deps%/share/locale/it/LC_MESSAGES/wxstd.mo"
151 SetOutPath "$INSTDIR\\locale\\es\\LC_MESSAGES"
152 File "%binaries%/src/lib/mo/es_ES/libdcpomatic2.mo"
153 File "%binaries%/src/wx/mo/es_ES/libdcpomatic2-wx.mo"
154 File "%binaries%/src/tools/mo/es_ES/dcpomatic2.mo"
155 File "%static_deps%/share/locale/es/LC_MESSAGES/wxstd.mo"
156 SetOutPath "$INSTDIR\\locale\\sv\\LC_MESSAGES"
157 File "%binaries%/src/lib/mo/sv_SE/libdcpomatic2.mo"
158 File "%binaries%/src/wx/mo/sv_SE/libdcpomatic2-wx.mo"
159 File "%binaries%/src/tools/mo/sv_SE/dcpomatic2.mo"
160 File "%static_deps%/share/locale/sv/LC_MESSAGES/wxstd.mo"
161 SetOutPath "$INSTDIR\\locale\\de\\LC_MESSAGES"
162 File "%binaries%/src/lib/mo/de_DE/libdcpomatic2.mo"
163 File "%binaries%/src/wx/mo/de_DE/libdcpomatic2-wx.mo"
164 File "%binaries%/src/tools/mo/de_DE/dcpomatic2.mo"
165 File "%static_deps%/share/locale/de/LC_MESSAGES/wxstd.mo"
166 SetOutPath "$INSTDIR\\locale\\nl\\LC_MESSAGES"
167 File "%binaries%/src/lib/mo/nl_NL/libdcpomatic2.mo"
168 File "%binaries%/src/wx/mo/nl_NL/libdcpomatic2-wx.mo"
169 File "%binaries%/src/tools/mo/nl_NL/dcpomatic2.mo"
170 File "%static_deps%/share/locale/nl/LC_MESSAGES/wxstd.mo"
171
172 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"
173 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"
174 WriteUninstaller "$INSTDIR\\Uninstall.exe"
175
176 CreateDirectory "$INSTDIR\etc\pango"
177 ReadEnvStr $0 COMSPEC
178 SetOutPath "$INSTDIR"
179 nsExec::ExecToLog '$0 /C bin\pango-querymodules.exe > etc\pango\pango.modules'
180
181 SectionEnd
182
183 Section "DCP-o-matic" SEC_MASTER
184 SetOutPath "$INSTDIR\\bin"
185 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
186 File "%binaries%/src/tools/dcpomatic2.exe"
187 File "%binaries%/src/tools/dcpomatic2_batch.exe"
188 File "%binaries%/src/tools/dcpomatic2_cli.exe"
189 CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""
190 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" "" "$INSTDIR\\bin\\dcpomatic2.exe" 0
191 CreateShortCut "$DESKTOP\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe" ""
192 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" "" "$INSTDIR\\bin\\dcpomatic2_batch.exe" 0
193 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
194 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"
195 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"
196 WriteUninstaller "$INSTDIR\\Uninstall.exe"
197 SectionEnd
198
199 Section "Encode server" SEC_SERVER
200 SetOutPath "$INSTDIR\\bin"
201 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
202 File "%binaries%/src/tools/dcpomatic2_server_cli.exe"
203 File "%binaries%/src/tools/dcpomatic2_server.exe"
204 CreateShortCut "$DESKTOP\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" ""
205 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic_server.exe" "" "$INSTDIR\\bin\\dcpomatic2_server.exe" 0
206 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
207 SectionEnd
208
209 LangString DESC_SEC_MASTER ${LANG_ENGLISH} "DCP-o-matic"
210 LangString DESC_SEC_SERVER ${LANG_ENGLISH} "DCP-o-matic encode server"
211
212 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
213   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MASTER} $(DESC_SEC_MASTER)
214   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER} $(DESC_SEC_SERVER)
215 !insertmacro MUI_FUNCTION_DESCRIPTION_END
216
217 !insertmacro MUI_PAGE_INSTFILES
218 !insertmacro MUI_PAGE_FINISH
219
220 !insertmacro MUI_UNPAGE_WELCOME
221 !insertmacro MUI_UNPAGE_CONFIRM
222 !insertmacro MUI_UNPAGE_INSTFILES
223 !insertmacro MUI_UNPAGE_FINISH
224 !insertmacro MUI_LANGUAGE "English"
225
226 Section "Uninstall"
227 RMDir /r "$INSTDIR\\*.*"    
228 RMDir "$INSTDIR"
229 Delete "$DESKTOP\\DCP-o-matic 2.lnk"
230 Delete "$DESKTOP\\DCP-o-matic 2 batch converter.lnk"
231 Delete "$DESKTOP\\DCP-o-matic 2 encode server.lnk"
232 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
233 RmDir  "$SMPROGRAMS\\DCP-o-matic 2"
234 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic2"
235 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2"
236  SectionEnd
237     """, file=f)
238     
239
240 def build(bld):
241     write_installer(32, bld.env.VERSION)
242     write_installer(64, bld.env.VERSION)