X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=cscript;h=56c9b048018e34b09d2104624626f59d21754cea;hb=c94d763e07d9e7b029091e1ea64ba4f7758b3d5b;hp=e969a523614b349f9911d4f6fb43564bb2872636;hpb=93d57d46e52e0050efda894fc3089a6410d55754;p=dcpomatic.git diff --git a/cscript b/cscript index e969a5236..56c9b0480 100644 --- a/cscript +++ b/cscript @@ -1,20 +1,21 @@ # -*- mode: python -*- # -# Copyright (C) 2012-2016 Carl Hetherington +# Copyright (C) 2012-2017 Carl Hetherington # -# This program is free software; you can redistribute it and/or modify +# This file is part of DCP-o-matic. +# +# DCP-o-matic is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, +# DCP-o-matic is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# along with DCP-o-matic. If not, see . # from __future__ import print_function @@ -23,21 +24,29 @@ import shutil import os import copy -deb_build_depends = {'debhelper', 'python', 'g++', 'pkg-config', 'libssh-dev', 'libsndfile1-dev', 'libgtk2.0-dev'} +deb_build_depends = dict() + +deb_build_depends_base = ['debhelper', 'python', 'g++', 'pkg-config', 'libsndfile1-dev', 'libgtk2.0-dev', 'libx264-dev'] + +deb_build_depends['12.04'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['12.04'].extend(['libssh-dev']) +deb_build_depends['14.04'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['14.04'].extend(['libssh-dev']) +deb_build_depends['16.04'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['16.04'].extend(['libssh-dev']) +deb_build_depends['16.10'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['16.10'].extend(['libssh-dev']) +deb_build_depends['17.04'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['17.04'].extend(['libssh-dev']) +deb_build_depends['7'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['7'].extend(['libssh-dev']) +deb_build_depends['8'] = copy.deepcopy(deb_build_depends_base) +deb_build_depends['8'].extend(['libssh-dev']) +deb_build_depends['unstable'] = copy.deepcopy(deb_build_depends_base) deb_depends = dict() -deb_depends_base = ['libc6', 'libssh-4', 'libsndfile1', 'libsamplerate0', 'libxmlsec1', 'libxmlsec1-openssl', 'libcurl3', 'libgtk2.0-0'] - -deb_depends['12.04'] = copy.deepcopy(deb_depends_base) -deb_depends['12.04'].extend(['libboost-filesystem1.48.0', - 'libboost-thread1.48.0', - 'libboost-regex1.48.0', - 'libmagick++4', - 'libxml++2.6-2', - 'libboost-date-time1.48.0', - 'libzip2', - 'libicu48']) +deb_depends_base = ['libc6', 'libsndfile1', 'libsamplerate0', 'libxmlsec1', 'libxmlsec1-openssl', 'libcurl3', 'libgtk2.0-0'] deb_depends['14.04'] = copy.deepcopy(deb_depends_base) deb_depends['14.04'].extend(['libboost-filesystem1.54.0', @@ -48,30 +57,55 @@ deb_depends['14.04'].extend(['libboost-filesystem1.54.0', 'libboost-date-time1.54.0', 'libzip2', 'libcairomm-1.0-1', - 'libpangomm-1.4-1', - 'libicu52']) + 'libpangomm-1.4-1,' + 'libicu52', + 'libnettle4', + 'libssh-4', + 'libx264-142']) -deb_depends['15.10'] = copy.deepcopy(deb_depends_base) -deb_depends['15.10'].extend(['libboost-filesystem1.58.0', +deb_depends['16.04'] = copy.deepcopy(deb_depends_base) +deb_depends['16.04'].extend(['libboost-filesystem1.58.0', 'libboost-thread1.58.0', 'libboost-regex1.58.0', 'libmagick++-6.q16-5v5', 'libxml++2.6-2v5', 'libboost-date-time1.58.0', 'libzip4', + 'libcairomm-1.0-1v5', + 'libpangomm-1.4-1v5', 'libwxgtk3.0-0v5', - 'libicu55']) - -deb_depends['16.04'] = copy.deepcopy(deb_depends_base) -deb_depends['16.04'].extend(['libboost-filesystem1.58.0', - 'libboost-thread1.58.0', - 'libboost-regex1.58.0', + 'libicu55', + 'libnettle6', + 'libssh-4', + 'libx264-148']) + +deb_depends['16.10'] = copy.deepcopy(deb_depends_base) +deb_depends['16.10'].extend(['libboost-filesystem1.61.0', + 'libboost-thread1.61.0', + 'libboost-regex1.61.0', 'libmagick++-6.q16-5v5', 'libxml++2.6-2v5', - 'libboost-date-time1.58.0', + 'libboost-date-time1.61.0', 'libzip4', 'libwxgtk3.0-0v5', - 'libicu55']) + 'libicu57', + 'libnettle6', + 'libssh-4', + 'libx264-148']) + +deb_depends['17.04'] = copy.deepcopy(deb_depends_base) +deb_depends['17.04'].extend(['libboost-filesystem1.62.0', + 'libboost-thread1.62.0', + 'libboost-regex1.62.0', + 'libmagick++-6.q16-7', + 'libxml++2.6-2v5', + 'libboost-date-time1.62.0', + 'libzip4', + 'libwxgtk3.0-0v5', + 'libicu57', + 'libnettle6', + 'libssh-4', + 'libx264-148']) deb_depends['7'] = copy.deepcopy(deb_depends_base) deb_depends['7'].extend(['libboost-filesystem1.49.0', @@ -83,7 +117,10 @@ deb_depends['7'].extend(['libboost-filesystem1.49.0', 'libzip2', 'libcairomm-1.0-1', 'libpangomm-1.4-1', - 'libicu48']) + 'libicu48', + 'libnettle4', + 'libnotify4', + 'libx264-123']) deb_depends['8'] = copy.deepcopy(deb_depends_base) deb_depends['8'].extend(['libboost-filesystem1.55.0', @@ -93,10 +130,15 @@ deb_depends['8'].extend(['libboost-filesystem1.55.0', 'libmagick++-6.q16-5', 'libxml++2.6-2', 'libzip2', + 'libcairomm-1.0-1', + 'libpangomm-1.4-1', 'libwxgtk3.0-0', 'libxcb-xfixes0', 'libxcb-shape0', - 'libicu52']) + 'libicu52', + 'libnettle4', + 'libssh-4', + 'libx264-142']) deb_depends['unstable'] = copy.deepcopy(deb_depends_base) deb_depends['unstable'].extend(['libboost-filesystem1.58.0', @@ -107,7 +149,9 @@ deb_depends['unstable'].extend(['libboost-filesystem1.58.0', 'libgtk2.0-0', 'libboost-date-time1.58.0', 'libzip2', - 'libicu52']) + 'libicu52', + 'libnettle6', + 'libx264-148']) def packages(name, packages, f): s = '%s: ' % name @@ -121,7 +165,7 @@ def make_control(debian_version, bits, filename, debug): print('Section: video', file=f) print('Priority: extra', file=f) print('Maintainer: Carl Hetherington ', file=f) - packages('Build-Depends', deb_build_depends, f) + packages('Build-Depends', deb_build_depends[debian_version], f) print('Standards-Version: 3.9.3', file=f) print('Homepage: http://dcpomatic.com/', file=f) print('', file=f) @@ -202,12 +246,12 @@ def make_spec(filename, version, target): print('tar xjf $RPM_SOURCE_DIR/dcpomatic-%s.tar.bz2' % version, file=f) 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' % (target.directory, target.directory), 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) if target.distro == 'centos' and target.version == '5': prefix = 'BUILDROOT/usr' else: - prefix = '%%{buildroot}/usr' + prefix = '%{buildroot}/usr' print('CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%s --install-prefix=/usr %s' % (target.directory, target.directory, prefix, configure_options(target)), file=f) @@ -235,9 +279,10 @@ def dependencies(target): else: ffmpeg_options = {} - return (('ffmpeg-cdist', 'cd922b8', ffmpeg_options), - ('libdcp', '043d382'), - ('libsub', 'b082fb6')) + return (('ffmpeg-cdist', 'd993f38', ffmpeg_options), + ('libdcp', '14fe126'), + ('libsub', '1551cad'), + ('rtaudio-cdist', None)) def configure_options(target): opt = '' @@ -254,6 +299,10 @@ def configure_options(target): elif target.version == '7': opt += ' --workaround-gssapi --static-xmlpp' + # Build Windows debug versions with static linking as I think gdb works better then + if target.debug and target.platform == 'windows': + opt += ' --static-dcpomatic' + return opt def build(target, options): @@ -264,15 +313,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): @@ -295,7 +348,7 @@ def package_debian(target, cpu, version): target.set('CDIST_CONFIGURE', '"' + configure_options(target) + '"') if target.debug: target.set('CDIST_DEBUG_PACKAGE', '--dbg-package=dcpomatic-dbg') - if target.version in ['15.04', '15.10', '16.04', '8']: + if target.version in ['15.04', '15.10', '16.04', '16.10', '17.04', '8', 'unstable']: target.set('CDIST_LOCALE_PREFIX', '/usr/share/locale') else: target.set('CDIST_LOCALE_PREFIX', '/usr/local/share/locale') @@ -332,7 +385,10 @@ def package_rpm(target, cpu, version): if cpu == "amd64": cpu = "x86_64" else: - cpu = "i686" + if target.distro == 'centos' and target.version == '5': + cpu = "i386" + else: + cpu = "i686" print('Looking in %s/RPMS/%s/*.rpm' % (topdir, cpu)) for p in glob.glob('%s/RPMS/%s/*.rpm' % (topdir, cpu)): @@ -356,7 +412,22 @@ def package(target, version): return package_rpm(target, cpu, version) elif target.platform == 'osx': target.command('bash platform/osx/make_dmg.sh %s' % target.directory) - return os.path.abspath(glob.glob('build/platform/osx/DCP-o-matic*.dmg')[0]) + 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') + f = open('build/platform/docker/Dockerfile', 'w') + print('FROM debian:jessie', file=f) + print('MAINTAINER carl@dcpomatic.com', file=f) + print('ADD build/platform/docker/dcpomatic_%s-1_amd64.deb /tmp' % (version, version), file=f) + print('RUN apt-get -o Acquire:http::Timeout="5" update; exit 0', file=f) + print('RUN dpkg -i /tmp/dcpomatic_*.deb; exit 0', file=f) + print('RUN apt-get -y -f install', file=f) + print('RUN apt-get clean', file=f) + print('EXPOSE 6192', file=f) + print('CMD ["/usr/bin/dcpomatic2_server_cli", "--verbose"]', file=f) + f.close() + target.command('docker build build/platform/docker -t dcpomatic-server:%s' % version) + target.command('docker save dcpomatic-server:%s -o dcpomatic-server-%s-docker.tar' % (version, version)) def make_pot(target): target.command('./waf pot') @@ -370,7 +441,12 @@ def make_manual(target): target.command('pdflatex colour.tex') return [os.path.abspath('pdf'), os.path.abspath('html'), os.path.abspath('colour.pdf')] -def test(target): +def test(target, test): if target.platform != 'windows': target.set('LC_ALL', 'C') - target.command('run/tests') + cmd = 'run/tests ' + if target.debug: + cmd += '--backtrace ' + if test is not None: + cmd += '--run_test=%s' % test + target.command(cmd)