Build "all" and "player" installers for Windows (#2531). player-installer
authorCarl Hetherington <cth@carlh.net>
Tue, 16 May 2023 21:51:51 +0000 (23:51 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 May 2023 23:35:13 +0000 (01:35 +0200)
cscript
platform/windows/wscript

diff --git a/cscript b/cscript
index d0c4aba91fd1c2e765a5c3061760cc3d6068f686..77c35005edd4259171ce6f10c03689926faf1c69 100644 (file)
--- a/cscript
+++ b/cscript
@@ -659,17 +659,19 @@ def build(target, options, for_package):
         target.command('./waf install')
 
 def package_windows(target):
-    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.environment_prefix, 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])
+    for installer in ('all', 'player'):
+        name1 = '%s.%s.nsi' % (installer, target.bits)
+        name2 = '%s2.%s.nsi' % (installer, target.bits)
+        shutil.copyfile('build/platform/windows/%s' % name1, 'build/platform/windows/%s' % name2)
+        target.command('sed -i "s~%%resources%%~%s/platform/windows~g" build/platform/windows/%s' % (os.getcwd(), name2))
+        target.command('sed -i "s~%%graphics%%~%s/graphics~g" build/platform/windows/%s' % (os.getcwd(), name2))
+        target.command('sed -i "s~%%static_deps%%~%s~g" build/platform/windows/%s' % (target.windows_prefix, name2))
+        target.command('sed -i "s~%%cdist_deps%%~%s~g" build/platform/windows/%s' % (target.directory, name2))
+        target.command('sed -i "s~%%mingw%%~%s~g" build/platform/windows/%s' % (target.environment_prefix, name2))
+        target.command('sed -i "s~%%binaries%%~%s/build~g" build/platform/windows/%s' % (os.getcwd(), name2))
+        target.command('sed -i "s~%%bits%%~32~g" build/platform/windows/%s' % name2)
+        target.command('makensis build/platform/windows/%s' % name2)
+    return [os.path.abspath(exe) for exe in glob.glob('build/platform/windows/*%s*.exe' % target.bits)]
 
 def package_debian(target, cpu, version, options):
     make_control(target.version, target.bits, 'debian/control', target.debug, options['gui'])
index e2dd4646b0fe330efe780520ee79d4e9cf34f579..0486dcd68a9189e00a6acdb49e3120ca9b1ab8b5 100644 (file)
@@ -1,7 +1,7 @@
 from __future__ import print_function
 import os
 
-def write_installer(tools, bits, dcpomatic_version, debug):
+def write_installer(tools, bits, nsi_prefix, extra_name, dcpomatic_version, debug):
 
     def name_with_underscore(name):
         return '' if name == 'main' else '_%s' % name
@@ -9,13 +9,18 @@ def write_installer(tools, bits, dcpomatic_version, debug):
     def name_with_space(name):
         return '' if name == 'main' else ' %s' % name
 
+    if extra_name is not None:
+        extra_name = ' %s' % extra_name
+    else:
+        extra_name = ''
+
     # 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
+    filename = 'build/platform/windows/%s.%d.nsi' % (nsi_prefix, bits)
 
     f = open(filename, 'w')
     print('!include "MUI2.nsh"', file=f)
@@ -29,7 +34,7 @@ def write_installer(tools, bits, dcpomatic_version, debug):
 
     print('RequestExecutionLevel admin', file=f)
 
-    outfile = 'DCP-o-matic '
+    outfile = 'DCP-o-matic%s ' % extra_name
     if debug:
         outfile += 'Debug '
     outfile += '%s %d-bit Installer.exe' % (dcpomatic_version, bits)
@@ -450,7 +455,10 @@ def build(bld):
         ('editor', 'Editor'),
         ('map', 'Map'),
         ('disk', 'Disk Writer'),
+        ('server', 'Encode Server'),
+        ('server_cli', 'Encode Server CLI'),
     ]
 
     for bits in (32, 64):
-        write_installer(all_tools, bits, bld.env.VERSION, bld.env.DEBUG)
+        write_installer(all_tools, bits, "all", None, bld.env.VERSION, bld.env.DEBUG)
+        write_installer([('player', 'Player')], bits, "player", "Player", bld.env.VERSION, bld.env.DEBUG)