It would appear that iconv is no longer required; certainly quickmail isn't.
[dcpomatic.git] / cscript
diff --git a/cscript b/cscript
index 04929e2ffdfd142c36f70af8b6a6227a41ffd842..feb46ae1f12b1a768df8ef67e5fda3bc3d1f18ff 100644 (file)
--- a/cscript
+++ b/cscript
@@ -2,19 +2,20 @@
 #
 #    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
 #
-#    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 <http://www.gnu.org/licenses/>.
 #
 
 from __future__ import print_function
@@ -23,11 +24,27 @@ 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']
+
+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['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_base = ['libc6', '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',
@@ -37,7 +54,9 @@ deb_depends['12.04'].extend(['libboost-filesystem1.48.0',
                              'libxml++2.6-2',
                              'libboost-date-time1.48.0',
                              'libzip2',
-                             'libicu48'])
+                             'libicu48',
+                             'libnettle4',
+                             'libssh-4'])
 
 deb_depends['14.04'] = copy.deepcopy(deb_depends_base)
 deb_depends['14.04'].extend(['libboost-filesystem1.54.0',
@@ -49,10 +68,12 @@ deb_depends['14.04'].extend(['libboost-filesystem1.54.0',
                              'libzip2',
                              'libcairomm-1.0-1',
                              'libpangomm-1.4-1',
-                             'libicu52'])
+                             'libicu52',
+                             'libnettle4',
+                             'libssh-4'])
 
-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',
@@ -60,18 +81,22 @@ deb_depends['15.10'].extend(['libboost-filesystem1.58.0',
                              'libboost-date-time1.58.0',
                              'libzip4',
                              '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'])
+
+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'])
 
 deb_depends['7'] = copy.deepcopy(deb_depends_base)
 deb_depends['7'].extend(['libboost-filesystem1.49.0',
@@ -83,7 +108,9 @@ deb_depends['7'].extend(['libboost-filesystem1.49.0',
                              'libzip2',
                              'libcairomm-1.0-1',
                              'libpangomm-1.4-1',
-                             'libicu48'])
+                             'libicu48',
+                             'libnettle4',
+                             'libnotify4'])
 
 deb_depends['8'] = copy.deepcopy(deb_depends_base)
 deb_depends['8'].extend(['libboost-filesystem1.55.0',
@@ -96,7 +123,9 @@ deb_depends['8'].extend(['libboost-filesystem1.55.0',
                          'libwxgtk3.0-0',
                          'libxcb-xfixes0',
                          'libxcb-shape0',
-                         'libicu52'])
+                         'libicu52',
+                         'libnettle4',
+                         'libssh-4'])
 
 deb_depends['unstable'] = copy.deepcopy(deb_depends_base)
 deb_depends['unstable'].extend(['libboost-filesystem1.58.0',
@@ -107,7 +136,8 @@ deb_depends['unstable'].extend(['libboost-filesystem1.58.0',
                                 'libgtk2.0-0',
                                 'libboost-date-time1.58.0',
                                 'libzip2',
-                                'libicu52'])
+                                'libicu52',
+                                'libnettle6'])
 
 def packages(name, packages, f):
     s = '%s: ' % name
@@ -121,7 +151,7 @@ def make_control(debian_version, bits, filename, debug):
     print('Section: video', file=f)
     print('Priority: extra', file=f)
     print('Maintainer: Carl Hetherington <carl@dcpomatic.com>', 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 +232,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 +265,9 @@ def dependencies(target):
     else:
         ffmpeg_options = {}
 
-    return (('ffmpeg-cdist', 'cd922b8', ffmpeg_options),
-            ('libdcp', '4e6b78d'),
-            ('libsub', 'b082fb6'))
+    return (('ffmpeg-cdist', 'c7df8d5', ffmpeg_options),
+            ('libdcp', '71f5d09'),
+            ('libsub', 'v1.2.4'))
 
 def configure_options(target):
     opt = ''
@@ -254,6 +284,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 +298,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 +333,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', '8', 'unstable']:
         target.set('CDIST_LOCALE_PREFIX', '/usr/share/locale')
     else:
         target.set('CDIST_LOCALE_PREFIX', '/usr/local/share/locale')
@@ -325,14 +363,17 @@ def package_rpm(target, cpu, version):
     make_spec('build/platform/linux/dcpomatic2.spec', version, target)
     cmd = 'rpmbuild --define \'_topdir %s\' -bb build/platform/linux/dcpomatic2.spec' % topdir
     if target.distro == 'centos' and target.version == '5':
-        cmd += ' --buildroot %s/BUILD/%s/BUILDROOT' % (topdir, version)
+        cmd += ' --buildroot %s/BUILD/dcpomatic-%s/BUILDROOT' % (topdir, version)
     target.command(cmd)
     rpms = []
 
     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 +397,7 @@ 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')]
 
 def make_pot(target):
     target.command('./waf pot')
@@ -370,7 +411,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)