Fix special cscript build for Windows XP.
authorCarl Hetherington <cth@carlh.net>
Sat, 18 Jun 2016 21:21:43 +0000 (22:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 18 Jun 2016 22:19:59 +0000 (23:19 +0100)
cscript
platform/windows/wscript

diff --git a/cscript b/cscript
index beafafc95036b4ce3f3e6fe9b0bc0ea57c9e2508..3c3aeb4ed85f067674befc66a0c3798e6fb65b2f 100644 (file)
--- a/cscript
+++ b/cscript
@@ -265,15 +265,19 @@ def build(target, options):
         target.command('./waf install')
 
 def package_windows(target):
-    shutil.copyfile('build/platform/windows/installer.%s.nsi' % target.bits, 'build/platform/windows/installer2.%s.nsi' % target.bits)
-    target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
-    target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
-    target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, target.bits))
-    target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.directory, target.bits))
-    target.command('sed -i "s~%%mingw%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.mingw_path, target.bits))
-    target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), target.bits))
-    target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % target.bits)
-    target.command('makensis build/platform/windows/installer2.%s.nsi' % target.bits)
+    identifier = ''
+    if target.version is not None:
+        identifier = '%s.' % target.version
+    identifier += '%d' % target.bits
+    shutil.copyfile('build/platform/windows/installer.%s.nsi' % identifier, 'build/platform/windows/installer2.%s.nsi' % identifier)
+    target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
+    target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
+    target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.windows_prefix, identifier))
+    target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.directory, identifier))
+    target.command('sed -i "s~%%mingw%%~%s~g" build/platform/windows/installer2.%s.nsi' % (target.mingw_path, identifier))
+    target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/installer2.%s.nsi' % (os.getcwd(), identifier))
+    target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/installer2.%s.nsi' % identifier)
+    target.command('makensis build/platform/windows/installer2.%s.nsi' % identifier)
     return os.path.abspath(glob.glob('build/platform/windows/*%s*.exe' % target.bits)[0])
 
 def package_debian(target, cpu, version):
index 54d53eff5b5f90f45aeebeb1f1f7537db47051f5..cc90cf55d6449a761f4b8623e4398ca0e2b63dbd 100644 (file)
@@ -1,13 +1,18 @@
 from __future__ import print_function
 import os
 
-def write_installer(bits, version, debug):
+def write_installer(bits, windows_version, dcpomatic_version, debug):
     try:
         os.makedirs('build/platform/windows')
     except:
         pass
 
-    f = open('build/platform/windows/installer.%d.nsi' % bits, 'w')
+    filename = 'build/platform/windows/installer.'
+    if windows_version is not None:
+        filename += 'xp.'
+    filename += '%d.nsi' % bits
+
+    f = open(filename, 'w')
     print('!include "MUI2.nsh"', file=f)
     if bits == 64:
         print('!include "x64.nsh"', file=f)
@@ -19,10 +24,15 @@ def write_installer(bits, version, debug):
 
     print('RequestExecutionLevel admin', file=f)
 
+    outfile = 'DCP-o-matic '
     if debug:
-        print('outFile "DCP-o-matic Debug %s %d-bit Installer.exe"' % (version, bits), file=f)
-    else:
-        print('outFile "DCP-o-matic %s %d-bit Installer.exe"' % (version, bits), file=f)
+        outfile += 'Debug '
+    outfile += '%s %d-bit ' % (dcpomatic_version, bits)
+    if windows_version is 'xp':
+        outfile += 'XP '
+    outfile += 'Installer.exe'
+
+    print('outFile "%s"' % outfile, file=f)
 
     print("""
 !define MUI_ICON "%graphics%/dcpomatic2.ico"
@@ -134,13 +144,17 @@ File "%cdist_deps%/bin/avdevice-57.dll"
 File "%cdist_deps%/bin/postproc-54.dll"
 File "%cdist_deps%/bin/swresample-2.dll"
 File "%cdist_deps%/bin/dcp-1.0.dll"
-File "%cdist_deps%/bin/libopenjp2.dll"
 File "%cdist_deps%/bin/swscale-4.dll"
 File "%cdist_deps%/bin/cxml-0.dll"
 File "%cdist_deps%/bin/sub-1.0.dll"
 File "%cdist_deps%/bin/ffprobe.exe"
     """, file=f)
 
+    if windows_version == 'xp':
+        print('File "%cdist_deps%/bin/libopenjpeg-1.dll"', file=f)
+    else:
+        print('File "%cdist_deps%/bin/libopenjp2.dll"', file=f)
+
     if debug:
         print('File "%resources%/gdb_script"', file=f)
         print('File "%resources%/debug.bat"', file=f)
@@ -355,5 +369,7 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 
 
 def build(bld):
-    write_installer(32, bld.env.VERSION, bld.env.DEBUG)
-    write_installer(64, bld.env.VERSION, bld.env.DEBUG)
+    write_installer(32, None, bld.env.VERSION, bld.env.DEBUG)
+    write_installer(64, None, bld.env.VERSION, bld.env.DEBUG)
+    write_installer(32, 'xp', bld.env.VERSION, bld.env.DEBUG)
+    write_installer(64, 'xp', bld.env.VERSION, bld.env.DEBUG)