X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=cscript;h=b10a7fc829e120c190b981dfb088cea156730213;hb=142f7dee139074294d35c630ecee67b85e8a98fc;hp=09695b85461005e3eb9dc6432e8016684dd55aed;hpb=b2743153dde1355d13d9c3ab3a7e85cd76ea61f7;p=dcpomatic.git diff --git a/cscript b/cscript index 09695b854..b10a7fc82 100644 --- a/cscript +++ b/cscript @@ -1,6 +1,6 @@ # -*- mode: python -*- # -# Copyright (C) 2012-2019 Carl Hetherington +# Copyright (C) 2012-2020 Carl Hetherington # # This file is part of DCP-o-matic. # @@ -196,6 +196,15 @@ deb_depends['unstable'].extend(['libboost-filesystem1.67.0', 'libx264-155', 'libcurl4']) +def can_build_disk(target): + # We can build dcpomatic2_disk on platforms that have Boost process and can build the lwext4 + # library. For now, just whitelist good ones here. + # + # - Lots of Linux distros don't have a new enough boost (1.64 or above) + # - On Centos 6 we can't build lwext4 because it needs a new CMake which Centos 6's g++ is not new enough to build. + # - On Centos 7 there is a build error in lwext4 related to __unused + return target.platform == 'windows' or target.platform == 'osx' or (target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['18.04', '18.10', '19.04']) + def packages(name, packages, f): s = '%s: ' % name for p in packages: @@ -245,6 +254,7 @@ def make_control(debian_version, bits, filename, debug, gui): def make_spec(filename, version, target, options, requires=None): """Make a .spec file for a RPM build""" + tools = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(filename))), "src/tools") f = open(filename, 'w') print('Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files', file=f) print('Name:dcpomatic2', file=f) @@ -271,9 +281,13 @@ def make_spec(filename, version, target, options, requires=None): print('%{_bindir}/dcpomatic2_kdm_cli', file=f) print('%{_bindir}/dcpomatic2_player', file=f) print('%{_bindir}/dcpomatic2_playlist', file=f) + print('%{_bindir}/dcpomatic2_openssl', file=f) if options['variant'] == 'swaroop-studio': print('%{_bindir}/dcpomatic2_ecinema', file=f) print('%{_bindir}/dcpomatic2_uuid', file=f) + if os.path.exists(os.path.join(tools, "dcpomatic2_disk")): + print('%{_bindir}/dcpomatic2_disk', file=f) + print('%{_bindir}/dcpomatic2_disk_writer', file=f) print('%{_datadir}/applications/dcpomatic2.desktop', file=f) print('%{_datadir}/applications/dcpomatic2_batch.desktop', file=f) print('%{_datadir}/applications/dcpomatic2_server.desktop', file=f) @@ -312,13 +326,13 @@ def make_spec(filename, version, target, options, requires=None): print('%build', file=f) print('cd dcpomatic-%s' % version, file=f) print('export PKG_CONFIG_PATH=%s/lib/pkgconfig:%s/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig' % (target.directory, target.directory), file=f) - print('CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%%{buildroot}/usr --install-prefix=/usr %s' % (target.directory, target.directory, configure_options(target, options)), file=f) print('./waf', file=f) print('%install', file=f) print('cd dcpomatic-%s' % version, file=f) print('./waf install', file=f) + print('/bin/cp %s/src/openssl/apps/openssl %%{buildroot}/usr/bin/dcpomatic2_openssl' % target.directory, file=f) print('', file=f) print('%post', file=f) print('/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :', file=f) @@ -332,7 +346,7 @@ def make_spec(filename, version, target, options, requires=None): print('%posttrans', file=f) print('/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :', file=f) -def dependencies(target): +def dependencies(target, options): if target.platform == 'linux': ffmpeg_options = { 'shared': False } @@ -347,14 +361,26 @@ def dependencies(target): # Use distro-provided FFmpeg on Arch deps = [] - deps.append(('libdcp', None)) - deps.append(('libsub', None)) + # Let's use C++11 mode if we can + cpp_lib_options = {'force-cpp11': True} if ( + (target.platform == 'osx' and target.bits == 64) or + (target.platform == 'windows')) else {} + + deps.append(('libdcp', None, cpp_lib_options)) + deps.append(('libsub', None, cpp_lib_options)) + deps.append(('leqm-nrt', 'carl')) deps.append(('rtaudio', 'carl')) + # We get our OpenSSL libraries from the environment, but we + # also need a patched openssl binary to make certificates. + # This dependency is to get that binary, which is added into + # the appropriate place later + deps.append(('openssl', 'carl')) + if can_build_disk(target): + deps.append(('lwext4', 'carl2')) return deps -def option_defaults(): - return { "gui": True, "variant": None } +option_defaults = { "gui": True, "variant": None, "disk": False } def configure_options(target, options): opt = '' @@ -379,6 +405,8 @@ def configure_options(target, options): # I worry that this will cause ABI problems but I don't have # a better solution. opt += ' --force-cpp11' + elif target.platform == 'osx' and target.bits == 64: + opt += ' --force-cpp11' if not options['gui']: opt += ' --disable-gui' @@ -390,6 +418,9 @@ def configure_options(target, options): if target.debug and target.platform == 'windows': opt += ' --static-dcpomatic' + if can_build_disk(target) and options['disk']: + opt += ' --enable-disk' + return opt def build(target, options): @@ -546,6 +577,7 @@ def package_debian(target, cpu, version, options): target.set('CDIST_LINKFLAGS', target.get('LINKFLAGS')) target.set('CDIST_CXXFLAGS', target.get('CXXFLAGS')) target.set('CDIST_PKG_CONFIG_PATH', target.get('PKG_CONFIG_PATH')) + target.set('CDIST_DIRECTORY', target.directory) target.set('CDIST_CONFIGURE', '"' + configure_options(target, options) + '"') if target.debug: @@ -596,6 +628,9 @@ def make_appimage(target, nice_name, internal_name, version): nice_filename = nice_name.replace(' ', '_') os.makedirs('build/%s.AppDir/usr/bin' % nice_filename) target.command('cp %s/bin/%s build/%s.AppDir/usr/bin' % (target.directory, internal_name, nice_filename)) + target.command('cp %s/src/openssl/apps/openssl build/%s.AppDir/usr/bin/dcpomatic2_openssl' % (target.directory, nice_filename)) + target.command('mkdir -p build/%s.AppDir/usr/share/libdcp' % nice_filename) + target.command('cp -r %s/share/libdcp/xsd build/%s.AppDir/usr/share/libdcp/' % (target.directory, nice_filename)) with open('build/%s.AppDir/AppRun' % nice_filename, 'w') as f: print('#!/bin/bash', file=f) print('export APPDIR="$(dirname "$(readlink -f "$0")")"', file=f) @@ -640,10 +675,10 @@ def package(target, version, options): elif target.distro == 'centos' or target.distro == 'fedora' or target.distro == 'mageia': return package_rpm(target, cpu, version, options) elif target.platform == 'osx' and target.bits is None: - target.command('bash platform/osx/make_dmg.sh %s %s universal %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password)) + target.command('bash platform/osx/make_dmg.sh %s %s universal no %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password)) return [os.path.abspath(x) for x in glob.glob('build/platform/osx/DCP-o-matic*.dmg')] elif target.platform == 'osx' and target.bits == 64: - target.command('bash platform/osx/make_dmg.sh %s %s thin %s %s' % (target.environment_prefix, target.directory, target.apple_id, target.apple_password)) + target.command('bash platform/osx/make_dmg.sh %s %s thin %s %s %s' % (target.environment_prefix, target.directory, "yes" if options['disk'] else "no", target.apple_id, target.apple_password)) return [os.path.abspath(x) for x in glob.glob('build/platform/osx/DCP-o-matic*.dmg')] elif target.platform == 'docker': shutil.copyfile(target.deb, 'build/platform/docker')