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