Use $HOME rather than hard-coded user name.
[dcpomatic.git] / platform / windows / wscript
index e4603808711027f321861b112f4235f14dd44a80..17965d54ce92c4680482f0f60e36ad2d7f0edece 100644 (file)
@@ -1,7 +1,15 @@
 from __future__ import print_function
 import os
 
-def write_installer(bits, dcpomatic_version, debug, variant, disk):
+
+def start_menu_shortcut(file, link, target, debug=False):
+    if debug:
+        print(f'CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\{link}.lnk" "$INSTDIR\\{target}"', file=file)
+    else:
+        print(f'CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\{link}.lnk" "$INSTDIR\\{target}"', file=file)
+
+
+def write_installer(bits, dcpomatic_version, debug, disk):
 
     tools = [
         ('batch', 'Batch Converter'),
@@ -12,12 +20,18 @@ def write_installer(bits, dcpomatic_version, debug, variant, disk):
         ('create', 'Creator'),
         ('playlist', 'Playlist Editor'),
         ('combiner', 'Combiner'),
+        ('editor', 'Editor'),
+        ('map', 'Map'),
     ]
 
     if disk:
         tools.append(('disk', 'Disk Writer'))
 
-    os.makedirs('build/platform/windows', exist_ok=True)
+    # It would be nice to use exist_ok here but it requires quite a new python
+    try:
+        os.makedirs('build/platform/windows')
+    except:
+        pass
 
     filename = 'build/platform/windows/installer.%d.nsi' % bits
 
@@ -32,6 +46,7 @@ def write_installer(bits, dcpomatic_version, debug, variant, disk):
         print('Name "DCP-o-matic"', file=f)
 
     print('RequestExecutionLevel admin', file=f)
+    print('Unicode true', file=f)
 
     outfile = 'DCP-o-matic '
     if debug:
@@ -78,15 +93,11 @@ SetOutPath "$INSTDIR\\bin"
 WriteUninstaller "$INSTDIR\\Uninstall.exe"
 
 File "%static_deps%/bin/libintl-8.dll"
-File "%static_deps%/bin/libboost_chrono-mt.dll"
-File "%static_deps%/bin/libboost_filesystem-mt.dll"
-File "%static_deps%/bin/libboost_system-mt.dll"
-File "%static_deps%/bin/libboost_thread-mt.dll"
-File "%static_deps%/bin/libboost_date_time-mt.dll"
-File "%static_deps%/bin/libboost_locale-mt.dll"
-File "%static_deps%/bin/libboost_regex-mt.dll"
 """, file=f)
 
+    for lib in ['chrono', 'filesystem', 'system', 'thread', 'date_time', 'locale', 'regex']:
+        print('File "%%static_deps%%/bin/libboost_%s-mt-x%d.dll"' % (lib, bits), file=f)
+
     if bits == 32:
         print('File "%static_deps%/bin/libgcc_s_sjlj-1.dll"', file=f)
     else:
@@ -105,14 +116,14 @@ File "%static_deps%/bin/libssh.dll"
 File "%static_deps%/bin/libstdc++-6.dll"
 File "%static_deps%/bin/zlib1.dll"
 File "%static_deps%/bin/libjpeg-9.dll"
-File "%static_deps%/bin/wxbase30u_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_core_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_adv_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_richtext_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_html_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_gl_gcc_custom.dll"
-File "%static_deps%/bin/wxmsw30u_propgrid_gcc_custom.dll"
-File "%static_deps%/bin/wxbase30u_xml_gcc_custom.dll"
+File "%static_deps%/bin/wxbase314u_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_core_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_adv_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_richtext_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_html_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_gl_gcc_custom.dll"
+File "%static_deps%/bin/wxmsw314u_propgrid_gcc_custom.dll"
+File "%static_deps%/bin/wxbase314u_xml_gcc_custom.dll"
 File "%static_deps%/bin/libcairo-2.dll"
 File "%static_deps%/bin/libfreetype-6.dll"
 File "%static_deps%/bin/libgthread-2.0-0.dll"
@@ -139,19 +150,17 @@ File "%static_deps%/bin/libzip.dll"
 File "%static_deps%/bin/libcairomm-1.0-1.dll"
 File "%static_deps%/bin/libpangomm-1.4-1.dll"
 File "%static_deps%/bin/libsamplerate-0.dll"
-File "%static_deps%/bin/libnettle-7.dll"
-File "%static_deps%/bin/icuuc65.dll"
-File "%static_deps%/bin/icudt65.dll"
-File "%static_deps%/bin/icuin65.dll"
+File "%static_deps%/bin/libnettle-8.dll"
+File "%static_deps%/bin/icuuc66.dll"
+File "%static_deps%/bin/icudt66.dll"
+File "%static_deps%/bin/icuin66.dll"
 File "%static_deps%/bin/liblzma-5.dll"
 File "%static_deps%/bin/libpcre-1.dll"
 File "%static_deps%/bin/libharfbuzz-0.dll"
-File "%static_deps%/bin/libjasper.dll"
-File "%static_deps%/bin/liblcms2-2.dll"
 File "%static_deps%/bin/libwinpthread-1.dll"
 File "%static_deps%/bin/libgnutls-30.dll"
 File "%static_deps%/bin/libgmp-10.dll"
-File "%static_deps%/bin/libhogweed-5.dll"
+File "%static_deps%/bin/libhogweed-6.dll"
 File "%static_deps%/bin/libidn2-0.dll"
 File "%static_deps%/bin/libunistring-2.dll"
 File "%static_deps%/bin/libssh2-1.dll"
@@ -160,16 +169,20 @@ File "%static_deps%/bin/libgpg-error-0.dll"
 File "%static_deps%/bin/libpangoft2-1.0-0.dll"
 File "%static_deps%/bin/libx264-155.dll"
 File "%static_deps%/bin/libwebp-7.dll"
+File "%static_deps%/bin/GLEW.dll"
+File "%static_deps%/bin/libdav1d.dll"
     """, file=f)
 
     if bits == 32:
-        print('File "%static_deps%/bin/libcrypto-1_1.dll"', file=f)
+        print('File "%static_deps%/bin/libcrypto-3.dll"', file=f)
     else:
-        print('File "%static_deps%/bin/libcrypto-1_1-x64.dll"', file=f)
+        print('File "%static_deps%/bin/libcrypto-3-x64.dll"', file=f)
 
     print("""
 File "%static_deps%/bin/libltdl-7.dll"
 File "%static_deps%/bin/libdl.dll"
+File /oname=dcpomatic2_verify.exe "%cdist_deps%/bin/dcpverify.exe"
+File /oname=dcpomatic2_kdm_inspect.exe "%cdist_deps%/bin/dcpkdm.exe"
 File "%cdist_deps%/bin/leqm_nrt.dll"
 File "%cdist_deps%/bin/asdcp-carl.dll"
 File "%cdist_deps%/bin/kumu-carl.dll"
@@ -203,6 +216,9 @@ File "%cdist_deps%/bin/libopenjp2.dll"
         print('File "%resources%/gdb_script"', file=f)
         print('File "%resources%/dcpomatic2_debug.bat"', file=f)
         print('File "%mingw%/bin/gdb.exe"', file=f)
+        print('File "%static_deps%/bin/libtermcap.dll"', file=f)
+        print('File "%static_deps%/bin/libreadline8.dll"', file=f)
+        print('File "%static_deps%/bin/libmman.dll"', file=f)
         for s, l in tools:
             print('File "%%resources%%/dcpomatic2_%s_debug.bat"' % s, file=f)
     else:
@@ -286,6 +302,22 @@ SetOutPath "$INSTDIR\\locale\\tr_tr\\LC_MESSAGES"
 File "%binaries%/src/lib/mo/tr_TR/libdcpomatic2.mo"
 File "%binaries%/src/wx/mo/tr_TR/libdcpomatic2-wx.mo"
 File "%binaries%/src/tools/mo/tr_TR/dcpomatic2.mo"
+SetOutPath "$INSTDIR\\locale\\sl_si\\LC_MESSAGES"
+File "%binaries%/src/lib/mo/sl_SI/libdcpomatic2.mo"
+File "%binaries%/src/wx/mo/sl_SI/libdcpomatic2-wx.mo"
+File "%binaries%/src/tools/mo/sl_SI/dcpomatic2.mo"
+SetOutPath "$INSTDIR\\locale\\hu_hu\\LC_MESSAGES"
+File "%binaries%/src/lib/mo/hu_HU/libdcpomatic2.mo"
+File "%binaries%/src/wx/mo/hu_HU/libdcpomatic2-wx.mo"
+File "%binaries%/src/tools/mo/hu_HU/dcpomatic2.mo"
+SetOutPath "$INSTDIR\\locale\\ka_KA\\LC_MESSAGES"
+File "%binaries%/src/lib/mo/ka_KA/libdcpomatic2.mo"
+File "%binaries%/src/wx/mo/ka_KA/libdcpomatic2-wx.mo"
+File "%binaries%/src/tools/mo/ka_KA/dcpomatic2.mo"
+SetOutPath "$INSTDIR\\locale\\fa_IR\\LC_MESSAGES"
+File "%binaries%/src/lib/mo/fa_IR/libdcpomatic2.mo"
+File "%binaries%/src/wx/mo/fa_IR/libdcpomatic2-wx.mo"
+File "%binaries%/src/tools/mo/fa_IR/dcpomatic2.mo"
 
 SetOutPath "$INSTDIR"
 File "%resources%/../../fonts/LiberationSans-Regular.ttf"
@@ -293,29 +325,56 @@ File "%resources%/../../fonts/LiberationSans-Italic.ttf"
 File "%resources%/../../fonts/LiberationSans-Bold.ttf"
 File /oname=fonts.conf "%resources%/../../fonts/fonts.conf.windows"
 File "%graphics%/splash.png"
-File "%graphics%/zoom.png"
-File "%graphics%/zoom_all.png"
-File "%graphics%/select.png"
-File "%graphics%/snap.png"
-File "%graphics%/sequence.png"
+File "%graphics%/zoom_white.png"
+File "%graphics%/zoom_black.png"
+File "%graphics%/zoom_all_white.png"
+File "%graphics%/zoom_all_black.png"
+File "%graphics%/select_white.png"
+File "%graphics%/select_black.png"
+File "%graphics%/snap_white.png"
+File "%graphics%/snap_black.png"
+File "%graphics%/sequence_white.png"
+File "%graphics%/sequence_black.png"
 File "%graphics%/me.jpg"
-File "%graphics%/tick.png"
-File "%graphics%/no_tick.png"
-File "%graphics%/link.png"
+File "%graphics%/link_white.png"
+File "%graphics%/link_black.png"
+File "%graphics%/add_black.png"
+File "%graphics%/add_white.png"
+File "%graphics%/pause_black.png"
+File "%graphics%/pause_white.png"
 SetOutPath "$INSTDIR\\xsd"
+File "%cdist_deps%/share/libdcp/xsd/DCDMSubtitle-2010.xsd"
+File "%cdist_deps%/share/libdcp/xsd/DCDMSubtitle-2014.xsd"
+File "%cdist_deps%/share/libdcp/xsd/DCSubtitle.v1.mattsson.xsd"
+File "%cdist_deps%/share/libdcp/xsd/Dolby-2012-AD.xsd"
+File "%cdist_deps%/share/libdcp/xsd/isdcf-mca.xsd"
+File "%cdist_deps%/share/libdcp/xsd/Main-Stereo-Picture-CPL.xsd"
+File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-AM-20040311.xsd"
+File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-CC-CPL-20070926.xsd"
+File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-CPL-20040511.xsd"
+File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-PKL-20040311.xsd"
+File "%cdist_deps%/share/libdcp/xsd/SMPTE-335-2012.xsd"
+File "%cdist_deps%/share/libdcp/xsd/SMPTE-395-2014-13-1-aaf.xsd"
+File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-10-2008.xsd"
+File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-12-2008.xsd"
+File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-16.xsd"
 File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-7-2006-CPL.xsd"
 File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-8-2006-PKL.xsd"
 File "%cdist_deps%/share/libdcp/xsd/SMPTE-429-9-2007-AM.xsd"
+File "%cdist_deps%/share/libdcp/xsd/xlink.xsd"
 File "%cdist_deps%/share/libdcp/xsd/xmldsig-core-schema.xsd"
 File "%cdist_deps%/share/libdcp/xsd/XMLSchema.dtd"
 File "%cdist_deps%/share/libdcp/xsd/XMLSchema.xsd"
 File "%cdist_deps%/share/libdcp/xsd/xml.xsd"
-File "%cdist_deps%/share/libdcp/xsd/DCDMSubtitle-2010.xsd"
-File "%cdist_deps%/share/libdcp/xsd/DCSubtitle.v1.mattsson.xsd"
-File "%cdist_deps%/share/libdcp/xsd/Main-Stereo-Picture-CPL.xsd"
-File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-AM-20040311.xsd"
-File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-CPL-20040511.xsd"
-File "%cdist_deps%/share/libdcp/xsd/PROTO-ASDCP-PKL-20040311.xsd"
+SetOutPath "$INSTDIR\\tags"
+File "%cdist_deps%/share/libdcp/tags/extlang"
+File "%cdist_deps%/share/libdcp/tags/language"
+File "%cdist_deps%/share/libdcp/tags/region"
+File "%cdist_deps%/share/libdcp/tags/script"
+File "%cdist_deps%/share/libdcp/tags/variant"
+File "%cdist_deps%/share/libdcp/tags/dcnc"
+SetOutPath "$INSTDIR"
+File "%cdist_deps%/share/libdcp/ratings"
 
 SectionEnd
     """, file=f)
@@ -326,6 +385,7 @@ SectionEnd
         print('Section "DCP-o-matic 2" SEC_MASTER', file=f)
 
     print('SetOutPath "$INSTDIR\\bin"', file=f)
+    print("SetShellVarContext all", file=f)
 
     if debug:
         print('CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2 debug"', file=f)
@@ -343,17 +403,17 @@ File "%resources%/dcpomatic2_disk_writer.exe.manifest"
     """, file=f)
 
     if debug:
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat"', file=f)
+        start_menu_shortcut(f, 'DCP-o-matic 2 debug', 'bin\\dcpomatic2_debug.bat', debug=True)
         for s, l in tools:
-            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 %s debug.lnk" "$INSTDIR\\bin\\dcpomatic2_%s_debug.bat" ""' % (l, s), file=f)
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
+            start_menu_shortcut(f, f'DCP-o-matic 2 {l} debug', f'bin\\dcpomatic2_{s}_debug.bat', debug=True)
+        start_menu_shortcut(f, 'Uninstall DCP-o-matic 2 debug', 'Uninstall.exe', debug=True)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "DisplayName" "DCP-o-matic 2 debug (remove only)"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
     else:
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe"', file=f)
+        start_menu_shortcut(f, 'DCP-o-matic 2', 'bin\\dcpomatic2.exe')
         for s, l in tools:
-            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 %s Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
+            start_menu_shortcut(f, f'DCP-o-matic 2 {l}', f'bin\\dcpomatic2_{s}.exe')
+        start_menu_shortcut(f, 'Uninstall DCP-o-matic 2', 'Uninstall.exe')
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
 
@@ -378,8 +438,12 @@ SetOutPath "$INSTDIR\\bin"
 CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"
 File "%binaries%/src/tools/dcpomatic2_server_cli.exe"
 File "%binaries%/src/tools/dcpomatic2_server.exe"
-CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Encode Server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" "" "$INSTDIR\\bin\\dcpomatic2_server.exe" 0
-CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe" "" "$INSTDIR\\Uninstall.exe" 0
+    """, file=f)
+
+    start_menu_shortcut(f, 'DCP-o-matic 2 Encode Server', 'bin\\dcpomatic2_server.exe')
+    start_menu_shortcut(f, 'Uninstall DCP-o-matic 2', 'Uninstall.exe')
+
+    print("""
 SectionEnd
 Section "Encode server desktop shortcuts" SEC_SERVER_DESKTOP
 CreateShortCut "$DESKTOP\\DCP-o-matic 2 Encode Server.lnk" "$INSTDIR\\bin\\dcpomatic2_server.exe" ""
@@ -413,14 +477,15 @@ SectionEnd
 !insertmacro MUI_LANGUAGE "English"
     """, file=f)
 
-    if debug:
-        print("""
+    print("""
 Section "Uninstall"
+SetShellVarContext all
 RMDir /r "$INSTDIR\\*.*"
 RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
-        """, file=f)
+    """, file=f)
 
+    if debug:
+        print('Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"', file=f)
         for s, l in tools:
             print('Delete "$DESKTOP\\DCP-o-matic 2 %s debug.lnk"' % l, file=f)
 
@@ -432,15 +497,10 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
  SectionEnd
         """, file=f)
     else:
-        print("""
-Section "Uninstall"
-RMDir /r "$INSTDIR\\*.*"
-RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2.lnk"
-        """, file=f)
-
+        print('Delete "$DESKTOP\\DCP-o-matic 2.lnk"', file=f)
         for s, l in tools:
-            print('Delete "$DESKTOP\\DCP-o-matic 2 %s.lnk"' % l)
+            print('Delete "$DESKTOP\\DCP-o-matic 2 %s.lnk"' % l, file=f)
+        print('Delete "$DESKTOP\\DCP-o-matic 2 Encode Server.lnk"', file=f)
 
         print("""
 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
@@ -452,5 +512,5 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 
 
 def build(bld):
-    write_installer(32, bld.env.VERSION, bld.env.DEBUG, bld.env.VARIANT, bld.env.ENABLE_DISK)
-    write_installer(64, bld.env.VERSION, bld.env.DEBUG, bld.env.VARIANT, bld.env.ENABLE_DISK)
+    write_installer(32, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK)
+    write_installer(64, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK)