9ae88ba87a15bd65856e22fc8fd623dfc6b0cb1c
[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 File "%static_deps%/share/locale/fr/LC_MESSAGES/wxstd.mo"
136 SetOutPath "$INSTDIR\\locale\\it\\LC_MESSAGES"
137 File "%binaries%/src/lib/mo/it_IT/libdcpomatic.mo"
138 File "%binaries%/src/wx/mo/it_IT/libdcpomatic-wx.mo"
139 File "%binaries%/src/tools/mo/it_IT/dcpomatic.mo"
140 File "%static_deps%/share/locale/it/LC_MESSAGES/wxstd.mo"
141 SetOutPath "$INSTDIR\\locale\\es\\LC_MESSAGES"
142 File "%binaries%/src/lib/mo/es_ES/libdcpomatic.mo"
143 File "%binaries%/src/wx/mo/es_ES/libdcpomatic-wx.mo"
144 File "%binaries%/src/tools/mo/es_ES/dcpomatic.mo"
145 File "%static_deps%/share/locale/es/LC_MESSAGES/wxstd.mo"
146 SetOutPath "$INSTDIR\\locale\\sv\\LC_MESSAGES"
147 File "%binaries%/src/lib/mo/sv_SE/libdcpomatic.mo"
148 File "%binaries%/src/wx/mo/sv_SE/libdcpomatic-wx.mo"
149 File "%binaries%/src/tools/mo/sv_SE/dcpomatic.mo"
150 File "%static_deps%/share/locale/sv/LC_MESSAGES/wxstd.mo"
151 SetOutPath "$INSTDIR\\locale\\de\\LC_MESSAGES"
152 File "%binaries%/src/lib/mo/de_DE/libdcpomatic.mo"
153 File "%binaries%/src/wx/mo/de_DE/libdcpomatic-wx.mo"
154 File "%binaries%/src/tools/mo/de_DE/dcpomatic.mo"
155 File "%static_deps%/share/locale/de/LC_MESSAGES/wxstd.mo"
156 SetOutPath "$INSTDIR\\locale\\nl\\LC_MESSAGES"
157 File "%binaries%/src/lib/mo/nl_NL/libdcpomatic.mo"
158 File "%binaries%/src/wx/mo/nl_NL/libdcpomatic-wx.mo"
159 File "%binaries%/src/tools/mo/nl_NL/dcpomatic.mo"
160 File "%static_deps%/share/locale/nl/LC_MESSAGES/wxstd.mo"
161
162 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic" "DisplayName" "DCP-o-matic (remove only)"
163 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic" "UninstallString" "$INSTDIR\\Uninstall.exe"
164 WriteUninstaller "$INSTDIR\\Uninstall.exe"
165
166 SectionEnd
167
168 Section "DCP-o-matic" SEC_MASTER
169 SetOutPath "$INSTDIR\\bin"
170 CreateDirectory "$SMPROGRAMS\\DCP-o-matic"
171 File "%binaries%/src/tools/dcpomatic.exe"
172 File "%binaries%/src/tools/dcpomatic_batch.exe"
173 File "%binaries%/src/tools/dcpomatic_cli.exe"
174 CreateShortCut "$DESKTOP\\DCP-o-matic.lnk" "$INSTDIR\\bin\\dcpomatic.exe" ""
175 CreateShortCut "$SMPROGRAMS\\DCP-o-matic\\DCP-o-matic.lnk" "$INSTDIR\\bin\\dcpomatic.exe" "" "$INSTDIR\\bin\\dcpomatic.exe" 0
176 CreateShortCut "$DESKTOP\\DCP-o-matic batch converter.lnk" "$INSTDIR\\bin\\dcpomatic_batch.exe" ""
177 CreateShortCut "$SMPROGRAMS\\DCP-o-matic\\DCP-o-matic batch converter.lnk" "$INSTDIR\\bin\\dcpomatic.exe" "" "$INSTDIR\\bin\\dcpomatic_batch.exe" 0
178 CreateShortCut "$SMPROGRAMS\\DCP-o-matic\\Uninstall DCP-o-matic.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
179 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic" "DisplayName" "DCP-o-matic (remove only)"
180 WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic" "UninstallString" "$INSTDIR\\Uninstall.exe"
181 WriteUninstaller "$INSTDIR\\Uninstall.exe"
182 SectionEnd
183
184 Section "Encode server" SEC_SERVER
185 SetOutPath "$INSTDIR\\bin"
186 CreateDirectory "$SMPROGRAMS\\DCP-o-matic"
187 File "%binaries%/src/tools/dcpomatic_server_cli.exe"
188 File "%binaries%/src/tools/dcpomatic_server.exe"
189 CreateShortCut "$DESKTOP\\DCP-o-matic encode server.lnk" "$INSTDIR\\bin\\dcpomatic_server.exe" ""
190 CreateShortCut "$SMPROGRAMS\\DCP-o-matic\\DCP-o-matic encode server.lnk" "$INSTDIR\\bin\\dcpomatic_server.exe" "" "$INSTDIR\\bin\\dcpomatic_server.exe" 0
191 CreateShortCut "$SMPROGRAMS\\DCP-o-matic\\Uninstall DCP-o-matic.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
192 SectionEnd
193
194 LangString DESC_SEC_MASTER ${LANG_ENGLISH} "DCP-o-matic"
195 LangString DESC_SEC_SERVER ${LANG_ENGLISH} "DCP-o-matic encode server"
196
197 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
198   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MASTER} $(DESC_SEC_MASTER)
199   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SERVER} $(DESC_SEC_SERVER)
200 !insertmacro MUI_FUNCTION_DESCRIPTION_END
201
202 !insertmacro MUI_PAGE_INSTFILES
203 !insertmacro MUI_PAGE_FINISH
204
205 !insertmacro MUI_UNPAGE_WELCOME
206 !insertmacro MUI_UNPAGE_CONFIRM
207 !insertmacro MUI_UNPAGE_INSTFILES
208 !insertmacro MUI_UNPAGE_FINISH
209 !insertmacro MUI_LANGUAGE "English"
210
211 Section "Uninstall"
212 RMDir /r "$INSTDIR\\*.*"    
213 RMDir "$INSTDIR"
214 Delete "$DESKTOP\\DCP-o-matic.lnk"
215 Delete "$DESKTOP\\DCP-o-matic batch converter.lnk"
216 Delete "$DESKTOP\\DCP-o-matic encode server.lnk"
217 Delete "$SMPROGRAMS\\DCP-o-matic\\*.*"
218 RmDir  "$SMPROGRAMS\\DCP-o-matic"
219 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic"
220 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic"
221  SectionEnd
222     """, file=f)
223     
224
225 def build(bld):
226     write_installer(32, bld.env.VERSION)
227     write_installer(64, bld.env.VERSION)