Support building of cli-only .deb packages (#2066).
authorCarl Hetherington <cth@carlh.net>
Sun, 1 Aug 2021 22:05:37 +0000 (00:05 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Sep 2021 23:22:00 +0000 (01:22 +0200)
cscript
debian/rules
graphics/wscript
platform/linux/wscript
src/tools/wscript

diff --git a/cscript b/cscript
index db676c3..d713c38 100644 (file)
--- a/cscript
+++ b/cscript
@@ -266,7 +266,8 @@ def make_control(debian_version, bits, filename, debug, gui):
     print('Standards-Version: 3.9.3', file=f)
     print('Homepage: https://dcpomatic.com/', file=f)
     print('', file=f)
-    print('Package: dcpomatic', file=f)
+    suffix = '' if gui else '-cli'
+    print(f'Package: dcpomatic{suffix}', file=f)
     if bits == 32:
         print('Architecture: i386', file=f)
     else:
@@ -282,10 +283,12 @@ def make_control(debian_version, bits, filename, debug, gui):
     print('  DCP-o-matic generates Digital Cinema Packages (DCPs) from videos, images,', file=f)
     print('  sound and subtitle files.  You can use it to make content for playback on DCI-compliant', file=f)
     print('  cinema projectors.', file=f)
+    if not gui:
+        print('  This package contains the command-line tools only.', file=f)
 
     if debug:
         print('', file=f)
-        print('Package: dcpomatic-dbg', file=f)
+        print(f'Package: dcpomatic{suffix}-dbg', file=f)
         if bits == 32:
             print('Architecture: i386', file=f)
         else:
@@ -610,14 +613,15 @@ def package_windows(target):
 
 def package_debian(target, cpu, version, options):
     make_control(target.version, target.bits, 'debian/control', target.debug, options['gui'])
-    if target.version != '9' and target.version != '16.04':
+    if target.version != '9' and target.version != '16.04' and options['gui']:
         with open('debian/postinst', 'w') as f:
             print('#!/bin/sh', file=f)
             # Get the required capability to write to disks
             print('setcap "cap_dac_override+ep cap_sys_admin+ep" /usr/bin/dcpomatic2_disk_writer', file=f)
     target.command('./waf dist')
     f = open('debian/files', 'w')
-    print('dcpomatic_%s-1_%s.deb video extra' % (version, cpu), file=f)
+    suffix = '' if options['gui'] else '-cli'
+    print(f'dcpomatic{suffix}_{version}-1_{cpu}.deb video extra', file=f)
     shutil.rmtree('build/deb', ignore_errors=True)
 
     os.makedirs('build/deb')
@@ -633,8 +637,9 @@ def package_debian(target, cpu, version, options):
     target.set('CDIST_DIRECTORY', target.directory)
 
     target.set('CDIST_CONFIGURE', '"' + configure_options(target, options) + '"')
+    target.set('CDIST_PACKAGE', f'dcpomatic{suffix}')
     if target.debug:
-        target.set('CDIST_DEBUG_PACKAGE', '--dbg-package=dcpomatic-dbg')
+        target.set('CDIST_DEBUG_PACKAGE_FLAG', f'--dbg-package=dcpomatic{suffix}-dbg')
 
     target.command('dpkg-buildpackage -uc -us')
 
index aac2dac..e98c391 100755 (executable)
@@ -20,30 +20,30 @@ override_dh_auto_build:
        ./waf build
 
 override_dh_auto_install:
-       ./waf install --destdir=debian/dcpomatic
-       mkdir -p debian/dcpomatic/usr/share/locale/de/LC_MESSAGES/
-       cp -a /usr/share/locale/de/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/de/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/es/LC_MESSAGES/
-       cp -a /usr/share/locale/es/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/es/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/fr/LC_MESSAGES/
-       cp -a /usr/share/locale/fr/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/fr/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/it/LC_MESSAGES/
-       cp -a /usr/share/locale/it/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/it/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/sv/LC_MESSAGES/
-       cp -a /usr/share/locale/sv/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/sv/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/nl/LC_MESSAGES/
-       cp -a /usr/share/locale/nl/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/nl/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/pl/LC_MESSAGES/
-       cp -a /usr/share/locale/pl/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/pl/LC_MESSAGES/dcpomatic2-wxstd.mo
-       mkdir -p debian/dcpomatic/usr/share/locale/ru/LC_MESSAGES/
-       cp -a /usr/share/locale/ru/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/ru/LC_MESSAGES/dcpomatic2-wxstd.mo
-       cp -a $(CDIST_DIRECTORY)/src/openssl/apps/openssl debian/dcpomatic/usr/bin/dcpomatic2_openssl
-       cp -a $(CDIST_DIRECTORY)/src/libdcp/build/tools/dcpverify debian/dcpomatic/usr/bin/dcpomatic2_verify
-       cp -ar $(CDIST_DIRECTORY)/share/libdcp debian/dcpomatic/usr/share
+       ./waf install --destdir=debian/$(CDIST_PACKAGE)
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/de/LC_MESSAGES/
+       cp -a /usr/share/locale/de/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/de/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/es/LC_MESSAGES/
+       cp -a /usr/share/locale/es/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/es/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/fr/LC_MESSAGES/
+       cp -a /usr/share/locale/fr/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/fr/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/it/LC_MESSAGES/
+       cp -a /usr/share/locale/it/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/it/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/sv/LC_MESSAGES/
+       cp -a /usr/share/locale/sv/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/sv/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/nl/LC_MESSAGES/
+       cp -a /usr/share/locale/nl/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/nl/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/pl/LC_MESSAGES/
+       cp -a /usr/share/locale/pl/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/pl/LC_MESSAGES/dcpomatic2-wxstd.mo
+       mkdir -p debian/$(CDIST_PACKAGE)/usr/share/locale/ru/LC_MESSAGES/
+       cp -a /usr/share/locale/ru/LC_MESSAGES/wxstd.mo debian/$(CDIST_PACKAGE)/usr/share/locale/ru/LC_MESSAGES/dcpomatic2-wxstd.mo
+       cp -a $(CDIST_DIRECTORY)/src/openssl/apps/openssl debian/$(CDIST_PACKAGE)/usr/bin/dcpomatic2_openssl
+       cp -a $(CDIST_DIRECTORY)/src/libdcp/build/tools/dcpverify debian/$(CDIST_PACKAGE)/usr/bin/dcpomatic2_verify
+       cp -ar $(CDIST_DIRECTORY)/share/libdcp debian/$(CDIST_PACKAGE)/usr/share
 
 .PHONY: override_dh_strip
 override_dh_strip:
-       dh_strip $(CDIST_DEBUG_PACKAGE)
+       dh_strip $(CDIST_DEBUG_PACKAGE_FLAG)
 
 override_dh_shlibdeps:
        dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
index 157b2c7..68435ea 100644 (file)
@@ -21,13 +21,13 @@ import os
 
 def build(bld):
     # Linux application icons
-    if bld.env.TARGET_LINUX:
+    if bld.env.TARGET_LINUX and not bld.env.DISABLE_GUI:
         for r in [16, 22, 32, 48, 64, 128, 256, 512]:
             for p in ['dcpomatic2', 'dcpomatic2_kdm', 'dcpomatic2_server', 'dcpomatic2_batch', 'dcpomatic2_player', 'dcpomatic2_playlist', 'dcpomatic2_disk', 'dcpomatic2_combiner']:
                 bld.install_files('${PREFIX}/share/icons/hicolor/%dx%d/apps' % (r, r), 'linux/%d/%s.png' % (r, p))
 
     # Install stuff for POSIX systems
-    if not bld.env.TARGET_WINDOWS:
+    if not bld.env.TARGET_WINDOWS and not bld.env.DISABLE_GUI:
         bld.install_as('${PREFIX}/share/dcpomatic2/dcpomatic2_server_small.png', 'linux/16/dcpomatic2.png')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'splash.png')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'zoom.png')
index 587da32..19e87db 100644 (file)
@@ -58,6 +58,6 @@ def build(bld):
     obj.VERSION = bld.env.VERSION
     desktops.append(obj.target)
 
-    bld.install_as('${PREFIX}/share/polkit-1/actions/com.dcpomatic.write-drive.policy', 'com.dcpomatic.write-drive.policy')
-
-    bld.install_files('${PREFIX}/share/applications', desktops)
+    if not bld.env.DISABLE_GUI:
+        bld.install_as('${PREFIX}/share/polkit-1/actions/com.dcpomatic.write-drive.policy', 'com.dcpomatic.write-drive.policy')
+        bld.install_files('${PREFIX}/share/applications', desktops)
index 81575c5..018689e 100644 (file)
@@ -43,7 +43,7 @@ def build(bld):
         uselib += 'DL '
 
     cli_tools = ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm_cli', 'dcpomatic_create']
-    if bld.env.ENABLE_DISK:
+    if bld.env.ENABLE_DISK and not bld.env.DISABLE_GUI:
         cli_tools.append('dcpomatic_disk_writer')
 
     for t in cli_tools: