Merge remote-tracking branch 'origin/master' into 2.0
[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
108 File "%cdist_deps%/bin/asdcp-libdcp-1.0.dll"
109 File "%cdist_deps%/bin/kumu-libdcp-1.0.dll"
110 File "%cdist_deps%/bin/avcodec-55.dll"
111 File "%cdist_deps%/bin/avfilter-4.dll"
112 File "%cdist_deps%/bin/avformat-55.dll"
113 File "%cdist_deps%/bin/avutil-52.dll"
114 File "%cdist_deps%/bin/avdevice-55.dll"
115 File "%cdist_deps%/bin/postproc-52.dll"
116 File "%cdist_deps%/bin/dcp-1.0.dll"
117 File "%cdist_deps%/bin/libopenjpeg-1.dll"
118 File "%cdist_deps%/bin/swresample-0.dll"
119 File "%cdist_deps%/bin/swscale-2.dll"
120 File "%cdist_deps%/bin/cxml-0.dll"
121 File "%cdist_deps%/bin/ffprobe.exe"
122
123 File "%binaries%/src/wx/dcpomatic2-wx.dll"
124 File "%binaries%/src/lib/dcpomatic2.dll"
125
126 # I don't know why, but sometimes it seems that 
127 # delegates.xml must be in with the binaries, and
128 # sometimes in the $PROFILE.  Meh.
129 File "%static_deps%/etc/ImageMagick-6/delegates.xml"
130 SetOutPath "$PROFILE\\.magick"
131 File "%static_deps%/etc/ImageMagick-6/delegates.xml"
132
133 SetOutPath "$INSTDIR\\locale\\fr\\LC_MESSAGES"
134 File "%binaries%/src/lib/mo/fr_FR/libdcpomatic2.mo"
135 File "%binaries%/src/wx/mo/fr_FR/libdcpomatic2-wx.mo"
136 File "%binaries%/src/tools/mo/fr_FR/dcpomatic2.mo"
137 File "%static_deps%/share/locale/fr/LC_MESSAGES/wxstd.mo"
138 SetOutPath "$INSTDIR\\locale\\it\\LC_MESSAGES"
139 File "%binaries%/src/lib/mo/it_IT/libdcpomatic2.mo"
140 File "%binaries%/src/wx/mo/it_IT/libdcpomatic2-wx.mo"
141 File "%binaries%/src/tools/mo/it_IT/dcpomatic2.mo"
142 File "%static_deps%/share/locale/it/LC_MESSAGES/wxstd.mo"
143 SetOutPath "$INSTDIR\\locale\\es\\LC_MESSAGES"
144 File "%binaries%/src/lib/mo/es_ES/libdcpomatic2.mo"
145 File "%binaries%/src/wx/mo/es_ES/libdcpomatic2-wx.mo"
146 File "%binaries%/src/tools/mo/es_ES/dcpomatic2.mo"
147 File "%static_deps%/share/locale/es/LC_MESSAGES/wxstd.mo"
148 SetOutPath "$INSTDIR\\locale\\sv\\LC_MESSAGES"
149 File "%binaries%/src/lib/mo/sv_SE/libdcpomatic2.mo"
150 File "%binaries%/src/wx/mo/sv_SE/libdcpomatic2-wx.mo"
151 File "%binaries%/src/tools/mo/sv_SE/dcpomatic2.mo"
152 File "%static_deps%/share/locale/sv/LC_MESSAGES/wxstd.mo"
153 SetOutPath "$INSTDIR\\locale\\de\\LC_MESSAGES"
154 File "%binaries%/src/lib/mo/de_DE/libdcpomatic2.mo"
155 File "%binaries%/src/wx/mo/de_DE/libdcpomatic2-wx.mo"
156 File "%binaries%/src/tools/mo/de_DE/dcpomatic2.mo"
157 File "%static_deps%/share/locale/de/LC_MESSAGES/wxstd.mo"
158 SetOutPath "$INSTDIR\\locale\\nl\\LC_MESSAGES"
159 File "%binaries%/src/lib/mo/nl_NL/libdcpomatic2.mo"
160 File "%binaries%/src/wx/mo/nl_NL/libdcpomatic2-wx.mo"
161 File "%binaries%/src/tools/mo/nl_NL/dcpomatic2.mo"
162 File "%static_deps%/share/locale/nl/LC_MESSAGES/wxstd.mo"
163
164 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"
165 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"
166 WriteUninstaller "$INSTDIR\\Uninstall.exe"
167
168 SectionEnd
169
170 Section "DCP-o-matic" SEC_MASTER
171 SetOutPath "$INSTDIR\\bin"
172 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
173 File "%binaries%/src/tools/dcpomatic2.exe"
174 File "%binaries%/src/tools/dcpomatic2_batch.exe"
175 File "%binaries%/src/tools/dcpomatic2_cli.exe"
176 CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""
177 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" "" "$INSTDIR\\bin\\dcpomatic2.exe" 0
178 CreateShortCut "$DESKTOP\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe" ""
179 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 batch converter.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" "" "$INSTDIR\\bin\\dcpomatic2_batch.exe" 0
180 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
181 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"
182 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"
183 WriteUninstaller "$INSTDIR\\Uninstall.exe"
184 SectionEnd
185
186 Section "Encode server" SEC_SERVER
187 SetOutPath "$INSTDIR\\bin"
188 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
189 File "%binaries%/src/tools/dcpomatic2_server_cli.exe"
190 File "%binaries%/src/tools/dcpomatic2_server.exe"
191 CreateShortCut "$DESKTOP\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" ""
192 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 encode server.lnk" "$INSTDIR\\bin\\dcpomatic_server.exe" "" "$INSTDIR\\bin\\dcpomatic2_server.exe" 0
193 CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
194 SectionEnd
195
196 LangString DESC_SEC_MASTER ${LANG_ENGLISH} "DCP-o-matic"
197 LangString DESC_SEC_SERVER ${LANG_ENGLISH} "DCP-o-matic encode server"
198
199 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
200   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MASTER} $(DESC_SEC_MASTER)
201   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER} $(DESC_SEC_SERVER)
202 !insertmacro MUI_FUNCTION_DESCRIPTION_END
203
204 !insertmacro MUI_PAGE_INSTFILES
205 !insertmacro MUI_PAGE_FINISH
206
207 !insertmacro MUI_UNPAGE_WELCOME
208 !insertmacro MUI_UNPAGE_CONFIRM
209 !insertmacro MUI_UNPAGE_INSTFILES
210 !insertmacro MUI_UNPAGE_FINISH
211 !insertmacro MUI_LANGUAGE "English"
212
213 Section "Uninstall"
214 RMDir /r "$INSTDIR\\*.*"    
215 RMDir "$INSTDIR"
216 Delete "$DESKTOP\\DCP-o-matic 2.lnk"
217 Delete "$DESKTOP\\DCP-o-matic 2 batch converter.lnk"
218 Delete "$DESKTOP\\DCP-o-matic 2 encode server.lnk"
219 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
220 RmDir  "$SMPROGRAMS\\DCP-o-matic 2"
221 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic2"
222 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2"
223  SectionEnd
224     """, file=f)
225     
226
227 def build(bld):
228     write_installer(32, bld.env.VERSION)
229     write_installer(64, bld.env.VERSION)