Possibly inaccurate port of master; build system cleanups.
authorCarl Hetherington <cth@carlh.net>
Sun, 10 May 2015 00:59:37 +0000 (01:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 10 May 2015 00:59:37 +0000 (01:59 +0100)
12 files changed:
TO_PORT
cscript
debian/rules
platform/linux/dcpomatic.spec.in [deleted file]
platform/linux/wscript
src/lib/wscript
src/tools/wscript
src/wscript
src/wx/wscript
test/image_test.cc
test/wscript
wscript

diff --git a/TO_PORT b/TO_PORT
index b1dcf52161e97db83d9d7c8b23e1af6d1a2add10..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1 +0,0 @@
-wscript/cscript etc. cleanups
diff --git a/cscript b/cscript
index 3864fbaa1731090f3995e4a40a70c54b8a4bcc0a..5a74e8038f4f71f1358a82dfa579de1a8e8b46e3 100644 (file)
--- a/cscript
+++ b/cscript
@@ -1,3 +1,21 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 import glob
 import shutil
 import os
@@ -26,48 +44,6 @@ deb_depends['12.04'] = {'libc6': '2.15',
                         'libcurl3': '7.22.0-3ubuntu4',
                         'libzip2': '0.10-1ubuntu1'}
 
-deb_depends['12.10'] = {'libc6': '2.15',
-                        'libssh-4': '0.5.2',
-                        'libboost-filesystem1.49.0': '1.49.0',
-                        'libboost-thread1.49.0': '1.49.0',
-                        'libsndfile1': '1.0.25',
-                        'libmagick++5': '8:6.7.7.10',
-                        'libxml++2.6-2': '2.34.2',
-                        'libgtk2.0-0': '2.24.13',
-                        'libxmlsec1': '1.2.18-2',
-                        'libxmlsec1-openssl': '1.2.18-2',
-                        'libboost-date-time1.49.0': '1.49.0',
-                        'libcurl3': '7.27.0-1ubuntu1',
-                        'libzip2': '0.10.1-1.1'}
-
-deb_depends['13.04'] = {'libc6': '2.15',
-                        'libssh-4': '0.5.2',
-                        'libboost-filesystem1.49.0': '1.49.0',
-                        'libboost-thread1.49.0': '1.49.0',
-                        'libsndfile1': '1.0.25',
-                        'libmagick++5': '8:6.7.7.10',
-                        'libxml++2.6-2': '2.34.2',
-                        'libgtk2.0-0': '2.24.13',
-                        'libxmlsec1': '1.2.18-2',
-                        'libxmlsec1-openssl': '1.2.18-2',
-                        'libboost-date-time1.49.0': '1.49.0',
-                        'libcurl3': '7.29.0-1ubuntu3',
-                        'libzip2': '0.10.1-1.1'}
-
-deb_depends['13.10'] = {'libc6': '2.17-93',
-                        'libssh-4': '0.5.4',
-                        'libboost-filesystem1.53.0': '1.53.0',
-                        'libboost-thread1.53.0': '1.53.0',
-                        'libsndfile1': '1.0.25',
-                        'libmagick++5': '8:6.7.7.10',
-                        'libxml++2.6-2': '2.36.0',
-                        'libgtk2.0-0': '2.24.20',
-                        'libxmlsec1': '1.2.18-2',
-                        'libxmlsec1-openssl': '1.2.18-2',
-                        'libboost-date-time1.49.0': '1.49.0',
-                        'libcurl3': '7.29.0-1ubuntu3',
-                        'libzip2': '0.10.1-1.1'}
-
 deb_depends['14.04'] = {'libc6': '2.19-0ubuntu6',
                         'libssh-4': '0.6.1-0ubuntu3',
                         'libboost-filesystem1.54.0': '1.54.0-4ubuntu3',
@@ -82,6 +58,20 @@ deb_depends['14.04'] = {'libc6': '2.19-0ubuntu6',
                         'libcurl3': '7.35.0-1ubuntu2',
                         'libzip2': '0.10.1-1.2'}
 
+deb_depends['15.04'] = {'libc6': '2.21-0ubuntu4',
+                        'libssh-4': '0.6.3-3ubuntu3',
+                        'libboost-filesystem1.55.0': '1.55.0+dfsg-3ubuntu2',
+                        'libboost-thread1.55.0': '1.55.0+dfsg-3ubuntu2',
+                        'libsndfile1': '1.0.25-9.1',
+                        'libmagick++-6.q16-5': '8:6.8.9.9-5',
+                        'libxml++2.6-2': '2.36.0-2.1',
+                        'libgtk2.0-0': '2.24.27-0ubuntu1',
+                        'libxmlsec1': '1.2.20-2ubuntu2',
+                        'libxmlsec1-openssl': '1.2.20-2ubuntu2',
+                        'libboost-date-time1.55.0': '1.55.0+dfsg-3ubuntu2',
+                        'libcurl3': '7.38.0-3ubuntu2',
+                        'libzip2': '0.11.2-1.2'}
+
 deb_depends['7'] = {'libc6': '2.13',
                     'libssh-4': '0.5.4',
                     'libboost-filesystem1.49.0': '1.49.0',
@@ -159,24 +149,85 @@ def dependencies(target):
             ('libdcp', '8e7f9e4'),
             ('libsub', 'f66b11f'))
 
-def build(target, options):
-    cmd = './waf configure --prefix=%s' % target.directory
+def configure_options(target):
+    opt = ''
     if target.debug:
-        cmd += ' --enable-debug'
+        opt += ' --enable-debug'
     if target.platform == 'windows':
-        cmd += ' --target-windows'
+        opt += ' --target-windows'
     elif target.platform == 'linux':
-        if target.distro == 'debian' or target.distro == 'ubuntu':
-            cmd += ' --target-debian'
-            if target.version == 'unstable':
-                cmd += ' --debian-unstable'
-        elif target.distro == 'centos':
+        opt += ' --static-dcpomatic --static-openjpeg --static-wxwidgets --static-ffmpeg --static-dcp --static-sub --static-cxml'
+        if target.distro == 'centos':
+            opt += ' --static-xmlsec --static-ssh --disable-tests'
             if target.version == '6.5':
-                cmd += ' --target-centos-6 --disable-tests'
+                opt += ' --static-boost --static-xmlpp'
             elif target.version == '7':
-                cmd += ' --target-centos-7 --disable-tests'
+                opt += ' --workaround-gssapi'
 
-    target.command(cmd)
+    return opt
+
+def make_spec(filename, version, target):
+    """Make a .spec file for a RPM build"""
+    f = open(filename, 'w')
+    print >>f,'Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files'
+    print >>f,'Name:dcpomatic'
+    print >>f,'Version:%s' % version
+    print >>f,'Release:1%{?dist}'
+    print >>f,'License:GPL'
+    print >>f,'Group:Applications/Multimedia'
+    print >>f,'URL:http://dcpomatic.com/'
+    print >>f,'Requires: ImageMagick-c++, glibmm24, libzip'
+    print >>f,''
+    print >>f,'%description'
+    print >>f,'DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio '
+    print >>f,'files (such as those from DVDs or Blu-Rays) for presentation on DCI-compliant '
+    print >>f,'digital projectors.'
+    print >>f,''
+    print >>f,'%files'
+    print >>f,'%{_bindir}/dcpomatic2'
+    print >>f,'%{_bindir}/dcpomatic2_batch'
+    print >>f,'%{_bindir}/dcpomatic2_cli'
+    print >>f,'%{_bindir}/dcpomatic2_create'
+    print >>f,'%{_bindir}/dcpomatic2_kdm'
+    print >>f,'%{_bindir}/dcpomatic2_server'
+    print >>f,'%{_bindir}/dcpomatic2_server_cli'
+    print >>f,'%{_datadir}/applications/dcpomatic2.desktop'
+    print >>f,'%{_datadir}/applications/dcpomatic2_batch.desktop'
+    print >>f,'%{_datadir}/applications/dcpomatic2_server.desktop'
+    print >>f,'%{_datadir}/dcpomatic2/taskbar_icon.png'
+    for r in ['128x128', '22x22', '32x32', '48x48', '64x64']:
+        print >>f,'%%{_datadir}/icons/hicolor/%s/apps/dcpomatic2.png' % r
+    for l in ['de_DE', 'es_ES', 'fr_FR', 'it_IT', 'sv_SE', 'nl_NL', 'ru_RU']:
+        print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/dcpomatic2.mo' % l
+        print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2-wx.mo' % l
+        print >>f,'%%{_datadir}/locale/%s/LC_MESSAGES/libdcpomatic2.mo' % l
+    print >>f,''
+    print >>f,'%prep'
+    print >>f,'rm -rf $RPM_BUILD_DIR/dcpomatic-%s' % version
+    print >>f,'tar xjf $RPM_SOURCE_DIR/dcpomatic-%s.tar.bz2' % version
+    print >>f,'%build'
+    print >>f,'cd dcpomatic-%s' % version
+    print >>f,'export PKG_CONFIG_PATH=%s/lib/pkgconfig:/usr/local/lib/pkgconfig' % target.directory
+    print >>f,'CXXFLAGS="-I%s/include" LDFLAGS="-L%s/lib" ./waf configure --prefix=%%{buildroot}/usr --install-prefix=/usr %s' % (target.directory, target.directory, configure_options(target))
+    print >>f,'./waf'
+    print >>f,'%install'
+    print >>f,'cd dcpomatic-%s' % version
+    print >>f,'./waf install'
+    print >>f,''
+    print >>f,'%post'
+    print >>f,'/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :'
+    print >>f,''
+    print >>f,'%postun'
+    print >>f,'if [ $1 -eq 0 ] ; then'
+    print >>f,'    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null'
+    print >>f,'    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :'
+    print >>f,'fi'
+    print >>f,''
+    print >>f,'%posttrans'
+    print >>f,'/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :'
+
+def build(target, options):
+    target.command('./waf configure --prefix=%s %s' % (target.directory, configure_options(target)))
     target.command('./waf')
 
     if target.platform == 'linux' or target.platform == 'osx':
index b51089f8b59d7160f07ba3f8c7340cf216f03f20..3e75b00900597184667c2f05c5b08382f50a10f9 100755 (executable)
@@ -14,7 +14,7 @@
 
 override_dh_auto_configure:
        LINKFLAGS=$(CDIST_LINKFLAGS) CXXFLAGS="$(CXXFLAGS) $(CDIST_CXXFLAGS)" PKG_CONFIG_PATH=$(CDIST_PKG_CONFIG_PATH) \
-                ./waf configure --prefix=/usr --target-debian --enable-debug $(CDIST_EXTRA_CONFIGURE)
+                ./waf configure --prefix=/usr $(CDIST_CONFIGURE)
 
 override_dh_auto_build:
        ./waf build
@@ -22,17 +22,17 @@ override_dh_auto_build:
 override_dh_auto_install:
        ./waf install --destdir=debian/dcpomatic
        mkdir -p debian/dcpomatic/usr/share/locale/de/LC_MESSAGES/
-       cp -a /usr/local/share/locale/de/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/de/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/de/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/de/LC_MESSAGES/dcpomatic-wxstd.mo
        mkdir -p debian/dcpomatic/usr/share/locale/es/LC_MESSAGES/
-       cp -a /usr/local/share/locale/es/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/es/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/es/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/es/LC_MESSAGES/dcpomatic-wxstd.mo
        mkdir -p debian/dcpomatic/usr/share/locale/fr/LC_MESSAGES/
-       cp -a /usr/local/share/locale/fr/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/fr/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/fr/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/fr/LC_MESSAGES/dcpomatic-wxstd.mo
        mkdir -p debian/dcpomatic/usr/share/locale/it/LC_MESSAGES/
-       cp -a /usr/local/share/locale/it/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/it/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/it/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/it/LC_MESSAGES/dcpomatic-wxstd.mo
        mkdir -p debian/dcpomatic/usr/share/locale/sv/LC_MESSAGES/
-       cp -a /usr/local/share/locale/sv/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/sv/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/sv/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/sv/LC_MESSAGES/dcpomatic-wxstd.mo
        mkdir -p debian/dcpomatic/usr/share/locale/nl/LC_MESSAGES/
-       cp -a /usr/local/share/locale/nl/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/nl/LC_MESSAGES/dcpomatic-wxstd.mo
+       cp -a $(CDIST_LOCALE_PREFIX)/nl/LC_MESSAGES/wxstd.mo debian/dcpomatic/usr/share/locale/nl/LC_MESSAGES/dcpomatic-wxstd.mo
 
 .PHONY: override_dh_strip
 override_dh_strip:
diff --git a/platform/linux/dcpomatic.spec.in b/platform/linux/dcpomatic.spec.in
deleted file mode 100644 (file)
index 7f39716..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files
-Name:dcpomatic2
-Version:@VERSION@
-Release:1%{?dist}
-License:GPL
-Group:Applications/Multimedia
-URL:http://dcpomatic.com/
-Requires: ImageMagick-c++, glibmm24, libzip
-
-%description
-DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio
-files (such as those from DVDs or Blu-Rays) for presentation on DCI-compliant
-digital projectors.
-
-%files
-%{_bindir}/dcpomatic2
-%{_bindir}/dcpomatic2_batch
-%{_bindir}/dcpomatic2_cli
-%{_bindir}/dcpomatic2_create
-%{_bindir}/dcpomatic2_kdm
-%{_bindir}/dcpomatic2_server
-%{_bindir}/dcpomatic2_server_cli
-%{_datadir}/applications/dcpomatic2.desktop
-%{_datadir}/applications/dcpomatic2_batch.desktop
-%{_datadir}/applications/dcpomatic2_server.desktop
-%{_datadir}/dcpomatic2/taskbar_icon.png
-%{_datadir}/dcpomatic2/LiberationSans-Regular.ttf
-%{_datadir}/icons/hicolor/128x128/apps/dcpomatic2.png
-%{_datadir}/icons/hicolor/22x22/apps/dcpomatic2.png
-%{_datadir}/icons/hicolor/32x32/apps/dcpomatic2.png
-%{_datadir}/icons/hicolor/48x48/apps/dcpomatic2.png
-%{_datadir}/icons/hicolor/64x64/apps/dcpomatic2.png
-%{_datadir}/locale/de_DE/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/de_DE/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/de_DE/LC_MESSAGES/libdcpomatic2.mo
-%{_datadir}/locale/es_ES/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/es_ES/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/es_ES/LC_MESSAGES/libdcpomatic2.mo
-%{_datadir}/locale/fr_FR/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/fr_FR/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/fr_FR/LC_MESSAGES/libdcpomatic2.mo
-%{_datadir}/locale/it_IT/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/it_IT/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/it_IT/LC_MESSAGES/libdcpomatic2.mo
-%{_datadir}/locale/sv_SE/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/sv_SE/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/sv_SE/LC_MESSAGES/libdcpomatic2.mo
-%{_datadir}/locale/nl_NL/LC_MESSAGES/dcpomatic2.mo
-%{_datadir}/locale/nl_NL/LC_MESSAGES/libdcpomatic2-wx.mo
-%{_datadir}/locale/nl_NL/LC_MESSAGES/libdcpomatic2.mo
-
-%prep
-rm -rf $RPM_BUILD_DIR/dcpomatic-@VERSION@
-tar xjf $RPM_SOURCE_DIR/dcpomatic-@VERSION@.tar.bz2
-%build
-cd dcpomatic-@VERSION@
-export PKG_CONFIG_PATH=@INSTALL_PREFIX@/lib/pkgconfig:/usr/local/lib/pkgconfig
-CXXFLAGS="-I@INSTALL_PREFIX@/include" LDFLAGS="-L@INSTALL_PREFIX@/lib" ./waf configure --prefix=%{buildroot}/usr --install-prefix=/usr --target-centos-@CENTOS_VERSION@ --disable-tests
-./waf
-%install
-cd dcpomatic-@VERSION@
-./waf install
-
-%post
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-
-%postun
-if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-fi
-
-%posttrans
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
index 336c1bcb002aefee8c18fe4a478832e3cd186336..5f1dc48a243a4601d2d163f82488e48a818f8e4d 100644 (file)
@@ -17,14 +17,4 @@ def build(bld):
     obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX
     obj.VERSION = bld.env.VERSION
 
-    obj = bld(features='subst')
-    obj.source = 'dcpomatic.spec.in'
-    obj.target = 'dcpomatic2.spec'
-    obj.INSTALL_PREFIX = bld.env.INSTALL_PREFIX
-    obj.VERSION = bld.env.VERSION
-    if bld.env.TARGET_CENTOS_6:
-        obj.CENTOS_VERSION = '6'
-    elif bld.env.TARGET_CENTOS_7:
-        obj.CENTOS_VERSION = '7'
-
     bld.install_files('${PREFIX}/share/applications', ['dcpomatic2.desktop', 'dcpomatic2_batch.desktop', 'dcpomatic2_server.desktop'])
index 24aa7c13438461b5295f23979f440640cab86326..68897a4c4ba58755b82fb3df829e5a1206e0a807 100644 (file)
@@ -1,3 +1,21 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 import os
 import i18n
 
@@ -102,7 +120,7 @@ sources = """
           """
 
 def build(bld):
-    if bld.env.BUILD_STATIC:
+    if bld.env.STATIC_DCPOMATIC:
         obj = bld(features = 'cxx cxxstlib')
     else:
         obj = bld(features = 'cxx cxxshlib')
@@ -123,7 +141,7 @@ def build(bld):
 
     if bld.env.TARGET_WINDOWS:
         obj.uselib += ' WINSOCK2 BFD DBGHELP IBERTY SHLWAPI MSWSOCK BOOST_LOCALE'
-    if bld.env.BUILD_STATIC:
+    if bld.env.STATIC_DCPOMATIC:
         obj.uselib += ' XMLPP'
 
     obj.target = 'dcpomatic2'
index 175cebc96993b5a6e1345705bbf6153931744e74..42aea9562b93e2143a48557ca512fc6c728a3934 100644 (file)
@@ -1,3 +1,21 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 import os
 import glob
 from waflib import Logs
@@ -9,9 +27,8 @@ def configure(conf):
         conf.env.append_value('LINKFLAGS', ['-mconsole'])
 
 def build(bld):
-
-    uselib =  'BOOST_THREAD BOOST_DATETIME BOOST_FILESYSTEM OPENJPEG DCP CXML SNDFILE ZIP XMLPP SSH '
-    uselib += 'AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC WXWIDGETS SUB CURL GLIB CAIROMM PANGOMM MAGICK '
+    uselib =  'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP XMLSEC CXML XMLPP AVFORMAT AVFILTER AVCODEC '
+    uselib += 'AVUTIL SWSCALE POSTPROC CURL BOOST_FILESYSTEM SSH WXWIDGETS'
 
     if bld.env.TARGET_WINDOWS:
         uselib += 'WINSOCK2'
index f3a6a8c7beab1d8480273ee29099a99e4fb6888b..8ec39963fd5ad9f503ba3a2860eb9a6cfd4630ff 100644 (file)
@@ -1,3 +1,21 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 def configure(conf):
     conf.recurse('tools')
     if not conf.env.DISABLE_GUI:
index 7b5904b4bcf882b3fc84cb985b58c38eeba616c4..a05774cd2b7b804ba1e954d34284fff4cc71958b 100644 (file)
@@ -1,4 +1,24 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 import os
+import subprocess
+import shlex
 import glob
 from waflib import Logs
 import i18n
@@ -64,34 +84,40 @@ sources = """
           """
 
 def configure(conf):
-    args = '--cppflags --cxxflags'
-    if not conf.env.BUILD_STATIC:
-        args += ' --libs std,richtext'
-
-    conf.check_cfg(msg='Checking for wxWidgets', package='', path=conf.options.wx_config, args=args,
-                   uselib_store='WXWIDGETS', mandatory=True)
+    conf.check_cfg(msg='Checking for wxWidgets',
+                   package='',
+                   path='wx-config',
+                   args='--cppflags --cxxflags --libs std,richtext',
+                   uselib_store='WXWIDGETS',
+                   mandatory=True)
 
-    if conf.env.BUILD_STATIC:
+    if conf.options.static_wxwidgets:
        # wx-config returns its static libraries as full paths, without -l prefixes, which confuses
-        # check_cfg(), so just hard-code it all.
-        conf.env.STLIB_WXWIDGETS = ['wx_gtk2u_richtext-3.0', 'wx_gtk2u_xrc-3.0', 'wx_gtk2u_qa-3.0', 'wx_baseu_net-3.0', 'wx_gtk2u_html-3.0',
-                                    'wx_gtk2u_adv-3.0', 'wx_gtk2u_core-3.0', 'wx_baseu_xml-3.0', 'wx_baseu-3.0']
-        conf.env.LIB_WXWIDGETS = ['tiff', 'SM', 'dl', 'jpeg', 'png', 'X11', 'expat']
-        if conf.env.TARGET_DEBIAN and conf.env.DEBIAN_UNSTABLE:
-            conf.env.LIB_WXWIDGETS.append('Xext')
-            conf.env.LIB_WXWIDGETS.append('X11')
-
-        if conf.env.TARGET_CENTOS_7:
-            conf.env.LIB_WXWIDGETS.append('Xxf86vm')
+        # check_cfg().  It puts the static libraries into LINKFLAGS_WXWIDGETS, so fish them out.
+        stlibs = []
+        new_linkflags = []
+        stlib_paths = []
+        for f in conf.env.LINKFLAGS_WXWIDGETS:
+            if f.startswith('/'):
+                d = os.path.dirname(f)
+                if not d in stlib_paths:
+                    stlib_paths.append(d)
+                stlibs.append(os.path.basename(f)[3:-2])
+            else:
+                new_linkflags.append(f)
+        
+        conf.env.STLIB_WXWIDGETS = stlibs
+        conf.env.LINKFLAGS_WXWIDGETS = new_linkflags
+        conf.env.STLIBPATH_WXWIDGETS = stlib_paths
  
     conf.in_msg = 1
-    wx_version = conf.check_cfg(package='', path=conf.options.wx_config, args='--version').strip()
+    wx_version = conf.check_cfg(package='', path='wx-config', args='--version').strip()
     conf.im_msg = 0
     if not wx_version.startswith('3.0.'):
         conf.fatal('wxwidgets version 3.0.x is required; %s found' % wx_version)
 
 def build(bld):
-    if bld.env.BUILD_STATIC:
+    if bld.env.STATIC_DCPOMATIC:
         obj = bld(features = 'cxx cxxstlib')
     else:
         obj = bld(features = 'cxx cxxshlib')
index 9aca9878d813277c03785159b5a296e48112c9b3..5561f021c5a57afb3c489910a6de6213a9778ce3 100644 (file)
@@ -171,67 +171,6 @@ BOOST_AUTO_TEST_CASE (crop_image_test2)
        }
 }
 
-static
-boost::shared_ptr<Image>
-read_file (string file)
-{
-       Magick::Image magick_image (file.c_str ());
-       dcp::Size size (magick_image.columns(), magick_image.rows());
-
-       boost::shared_ptr<Image> image (new Image (PIX_FMT_RGB24, size, true));
-
-#ifdef DCPOMATIC_IMAGE_MAGICK  
-       using namespace MagickCore;
-#endif 
-       
-       uint8_t* p = image->data()[0];
-       for (int y = 0; y < size.height; ++y) {
-               uint8_t* q = p;
-               for (int x = 0; x < size.width; ++x) {
-                       Magick::Color c = magick_image.pixelColor (x, y);
-#ifdef DCPOMATIC_IMAGE_MAGICK                  
-                       *q++ = c.redQuantum() * 255 / QuantumRange;
-                       *q++ = c.greenQuantum() * 255 / QuantumRange;
-                       *q++ = c.blueQuantum() * 255 / QuantumRange;
-#else                  
-                       *q++ = c.redQuantum() * 255 / MaxRGB;
-                       *q++ = c.greenQuantum() * 255 / MaxRGB;
-                       *q++ = c.blueQuantum() * 255 / MaxRGB;
-#endif                 
-               }
-               p += image->stride()[0];
-       }
-
-       return image;
-}
-
-static
-void
-write_file (shared_ptr<Image> image, string file)
-{
-#ifdef DCPOMATIC_IMAGE_MAGICK  
-       using namespace MagickCore;
-#endif 
-       
-       Magick::Image magick_image (Magick::Geometry (image->size().width, image->size().height), Magick::Color (0, 0, 0));
-       uint8_t*p = image->data()[0];
-       for (int y = 0; y < image->size().height; ++y) {
-               uint8_t* q = p;
-               for (int x = 0; x < image->size().width; ++x) {
-#ifdef DCPOMATIC_IMAGE_MAGICK
-                       Magick::Color c (q[0] * QuantumRange / 256, q[1] * QuantumRange / 256, q[2] * QuantumRange / 256);
-#else                  
-                       Magick::Color c (q[0] * MaxRGB / 256, q[1] * MaxRGB / 256, q[2] * MaxRGB / 256);
-#endif                 
-                       magick_image.pixelColor (x, y, c);
-                       q += 3;
-               }
-               p += image->stride()[0];
-       }
-       
-       magick_image.write (file.c_str ());
-}
-
 static
 void
 crop_scale_window_single (AVPixelFormat in_format, dcp::Size in_size, Crop crop, dcp::Size inter_size, dcp::Size out_size)
index ffc93ea5edce5fee784dea3a01958061d949b34f..a5556e25dd1b14e4c8a899bb4669eed391c65787 100644 (file)
@@ -1,3 +1,21 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 def configure(conf):
     boost_test_suffix=''
     if conf.env.TARGET_WINDOWS:
diff --git a/wscript b/wscript
index 644d69b8d4b228a3f88c8330354858c3d4a7923c..c19c717ce346cd63c2440bf267f0b7d3aa6c2347 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,8 +1,28 @@
+#
+#    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+#
+#    This program 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,
+#    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.
+#
+
 import subprocess
 import os
+import shlex
 import sys
 import distutils
 import distutils.spawn
+from waflib import Logs
 
 APPNAME = 'dcpomatic'
 VERSION = '2.0.43devel'
@@ -14,188 +34,61 @@ def options(opt):
     opt.add_option('--enable-debug',      action='store_true', default=False, help='build with debugging information and without optimisation')
     opt.add_option('--disable-gui',       action='store_true', default=False, help='disable building of GUI tools')
     opt.add_option('--disable-tests',     action='store_true', default=False, help='disable building of tests')
-    opt.add_option('--target-windows',    action='store_true', default=False, help='set up to do a cross-compile to make a Windows package')
-    opt.add_option('--target-debian',     action='store_true', default=False, help='set up to compile for a Debian/Ubuntu package')
-    opt.add_option('--debian-unstable',   action='store_true', default=False, help='add extra libraries to static-build correctly on Debian unstable')
-    opt.add_option('--target-centos-6',   action='store_true', default=False, help='set up to compile for a Centos 6.5 package')
-    opt.add_option('--target-centos-7',   action='store_true', default=False, help='set up to compile for a Centos 7 package')
-    opt.add_option('--magickpp-config',   action='store',      default='Magick++-config', help='path to Magick++-config')
-    opt.add_option('--wx-config',         action='store',      default='wx-config', help='path to wx-config')
-    opt.add_option('--address-sanitizer', action='store_true', default=False, help='build with address sanitizer')
     opt.add_option('--install-prefix',                         default=None,  help='prefix of where DCP-o-matic will be installed')
-
-def static_ffmpeg(conf):
-    conf.check_cfg(package='libavformat', args='--cflags', uselib_store='AVFORMAT', mandatory=True)
-    conf.env.STLIB_AVFORMAT = ['avformat']
-    conf.check_cfg(package='libavfilter', args='--cflags', uselib_store='AVFILTER', mandatory=True)
-    conf.env.STLIB_AVFILTER = ['avfilter', 'swresample']
-    conf.check_cfg(package='libavcodec', args='--cflags', uselib_store='AVCODEC', mandatory=True)
-    # lzma link is needed by Centos 7, at least
-    conf.env.STLIB_AVCODEC = ['avcodec']
-    conf.env.LIB_AVCODEC = ['z', 'lzma']
-    conf.check_cfg(package='libavutil', args='--cflags', uselib_store='AVUTIL', mandatory=True)
-    conf.env.STLIB_AVUTIL = ['avutil']
-    conf.check_cfg(package='libswscale', args='--cflags', uselib_store='SWSCALE', mandatory=True)
-    conf.env.STLIB_SWSCALE = ['swscale']
-    conf.check_cfg(package='libswresample', args='--cflags', uselib_store='SWRESAMPLE', mandatory=True)
-    conf.env.STLIB_SWRESAMPLE = ['swresample']
-    conf.check_cfg(package='libpostproc', args='--cflags', uselib_store='POSTPROC', mandatory=True)
-    conf.env.STLIB_POSTPROC = ['postproc']
-
-def dynamic_ffmpeg(conf):
-    conf.check_cfg(package='libavformat', args='--cflags --libs', uselib_store='AVFORMAT', mandatory=True)
-    conf.check_cfg(package='libavfilter', args='--cflags --libs', uselib_store='AVFILTER', mandatory=True)
-    conf.check_cfg(package='libavcodec', args='--cflags --libs', uselib_store='AVCODEC', mandatory=True)
-    conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='AVUTIL', mandatory=True)
-    conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='SWSCALE', mandatory=True)
-    conf.check_cfg(package='libswresample', args='--cflags --libs', uselib_store='SWRESAMPLE', mandatory=True)
-    conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='POSTPROC', mandatory=True)
-
-def static_openjpeg(conf):
-    conf.check_cfg(package='libopenjpeg', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
-    conf.check_cfg(package='libopenjpeg', args='--cflags', max_version='1.5.2', mandatory=True)
-    conf.env.STLIB_OPENJPEG = ['openjpeg']
-
-def dynamic_openjpeg(conf):
-    conf.check_cfg(package='libopenjpeg', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
-    conf.check_cfg(package='libopenjpeg', args='--cflags --libs', max_version='1.5.2', mandatory=True)
-
-def static_sub(conf):
-    conf.check_cfg(package='libsub-1.0', atleast_version='1.0.0', args='--cflags', uselib_store='SUB', mandatory=True)
-    conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
-    conf.env.STLIB_SUB = ['sub-1.0']
-
-def static_dcp(conf, static_boost, static_xmlpp, static_xmlsec, static_ssh):
-    conf.check_cfg(package='libdcp-1.0', atleast_version='1.0', args='--cflags', uselib_store='DCP', mandatory=True)
-    conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
-    conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-libdcp-1.0', 'kumu-libdcp-1.0']
-    conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt']
-
-    if static_boost:
-        conf.env.STLIB_DCP.append('boost_system')
-
-    if static_xmlpp:
-        conf.env.STLIB_DCP.append('xml++-2.6')
-    else:
-        conf.env.LIB_DCP.append('xml++-2.6')
-
-    if static_xmlsec:
-        conf.env.STLIB_DCP.append('xmlsec1-openssl')
-        conf.env.STLIB_DCP.append('xmlsec1')
-    else:
-        conf.env.LIB_DCP.append('xmlsec1-openssl')
-        conf.env.LIB_DCP.append('xmlsec1')
-
-    if static_ssh:
-        conf.env.STLIB_DCP.append('ssh')
-    else:
-        conf.env.LIB_DCP.append('ssh')
-
-def dynamic_dcp(conf):
-    conf.check_cfg(package='libdcp-1.0', atleast_version='0.92', args='--cflags --libs', uselib_store='DCP', mandatory=True)
-    conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
-
-def dynamic_sub(conf):
-    conf.check_cfg(package='libsub-1.0', atleast_version='1.0.0', args='--cflags --libs', uselib_store='SUB', mandatory=True)
-    conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
-
-def dynamic_ssh(conf):
-    conf.check_cc(fragment="""
-                           #include <libssh/libssh.h>\n
-                           int main () {\n
-                           ssh_session s = ssh_new ();\n
-                           return 0;\n
-                           }
-                           """, msg='Checking for library libssh', mandatory=True, lib='ssh', uselib_store='SSH')
-
-def dynamic_boost(conf, lib_suffix, thread):
-    conf.check_cxx(fragment="""
-                            #include <boost/version.hpp>\n
-                            #if BOOST_VERSION < 104500\n
-                            #error boost too old\n
-                            #endif\n
-                            int main(void) { return 0; }\n
-                            """,
-                   mandatory=True,
-                   msg='Checking for boost library >= 1.45',
-                   okmsg='yes',
-                   errmsg='too old\nPlease install boost version 1.45 or higher.')
-
-    conf.check_cxx(fragment="""
-                           #include <boost/thread.hpp>\n
-                           int main() { boost::thread t (); }\n
-                           """, msg='Checking for boost threading library',
-                           libpath='/usr/local/lib',
-                            lib=[thread, 'boost_system%s' % lib_suffix],
-                            uselib_store='BOOST_THREAD')
-
-    conf.check_cxx(fragment="""
-                           #include <boost/filesystem.hpp>\n
-                           int main() { boost::filesystem::copy_file ("a", "b"); }\n
-                           """, msg='Checking for boost filesystem library',
-                            libpath='/usr/local/lib',
-                            lib=['boost_filesystem%s' % lib_suffix, 'boost_system%s' % lib_suffix],
-                            uselib_store='BOOST_FILESYSTEM')
-
-    conf.check_cxx(fragment="""
-                           #include <boost/date_time.hpp>\n
-                           int main() { boost::gregorian::day_clock::local_day(); }\n
-                           """, msg='Checking for boost datetime library',
-                            libpath='/usr/local/lib',
-                            lib=['boost_date_time%s' % lib_suffix, 'boost_system%s' % lib_suffix],
-                            uselib_store='BOOST_DATETIME')
-
-    conf.check_cxx(fragment="""
-                           #include <boost/signals2.hpp>\n
-                           int main() { boost::signals2::signal<void (int)> x; }\n
-                           """,
-                            msg='Checking for boost signals2 library',
-                            uselib_store='BOOST_SIGNALS2')
-
-def static_boost(conf, lib_suffix):
-    conf.env.STLIB_BOOST_THREAD = ['boost_thread']
-    conf.env.STLIB_BOOST_FILESYSTEM = ['boost_filesystem%s' % lib_suffix]
-    conf.env.STLIB_BOOST_DATETIME = ['boost_date_time%s' % lib_suffix, 'boost_system%s' % lib_suffix]
-    conf.env.STLIB_BOOST_SIGNALS2 = ['boost_signals2']
+    opt.add_option('--target-windows',    action='store_true', default=False, help='set up to do a cross-compile to make a Windows package')
+    opt.add_option('--static-dcpomatic',  action='store_true', default=False, help='link to components of DCP-o-matic statically')
+    opt.add_option('--static-boost',      action='store_true', default=False, help='link statically to Boost')
+    opt.add_option('--static-openjpeg',   action='store_true', default=False, help='link statically to OpenJPEG')
+    opt.add_option('--static-wxwidgets',  action='store_true', default=False, help='link statically to wxWidgets')
+    opt.add_option('--static-ffmpeg',     action='store_true', default=False, help='link statically to FFmpeg')
+    opt.add_option('--static-xmlpp',      action='store_true', default=False, help='link statically to libxml++')
+    opt.add_option('--static-xmlsec',     action='store_true', default=False, help='link statically to xmlsec')
+    opt.add_option('--static-ssh',        action='store_true', default=False, help='link statically to libssh')
+    opt.add_option('--static-cxml',       action='store_true', default=False, help='link statically to libcxml')
+    opt.add_option('--static-dcp',        action='store_true', default=False, help='link statically to libdcp')
+    opt.add_option('--static-sub',        action='store_true', default=False, help='link statically to libsub')
+    opt.add_option('--static-curl',       action='store_true', default=False, help='link statically to libcurl')
+    opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5')
 
 def configure(conf):
     conf.load('compiler_cxx')
     if conf.options.target_windows:
         conf.load('winres')
 
-    # conf.options -> conf.env
-    conf.env.TARGET_WINDOWS = conf.options.target_windows
+    # Save conf.options that we need elsewhere in conf.env
     conf.env.DISABLE_GUI = conf.options.disable_gui
     conf.env.DISABLE_TESTS = conf.options.disable_tests
-    conf.env.TARGET_DEBIAN = conf.options.target_debian
-    conf.env.DEBIAN_UNSTABLE = conf.options.debian_unstable
-    conf.env.TARGET_CENTOS_6 = conf.options.target_centos_6
-    conf.env.TARGET_CENTOS_7 = conf.options.target_centos_7
-    conf.env.VERSION = VERSION
+    conf.env.TARGET_WINDOWS = conf.options.target_windows
     conf.env.TARGET_OSX = sys.platform == 'darwin'
     conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
-    # true if we should build dcpomatic/libdcpomatic/libdcpomatic-wx statically
-    conf.env.BUILD_STATIC = conf.options.target_debian or conf.options.target_centos_6 or conf.options.target_centos_7
+    conf.env.VERSION = VERSION
+    conf.env.DEBUG = conf.options.enable_debug
+    conf.env.STATIC_DCPOMATIC = conf.options.static_dcpomatic
     if conf.options.install_prefix is None:
         conf.env.INSTALL_PREFIX = conf.env.PREFIX
     else:
         conf.env.INSTALL_PREFIX = conf.options.install_prefix
 
     # Common CXXFLAGS
-    conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-ffast-math', '-fno-strict-aliasing',
-                                       '-Wall', '-Wno-attributes', '-Wextra', '-Wno-unused-result', '-D_FILE_OFFSET_BITS=64'])
+    conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS',
+                                       '-D__STDC_LIMIT_MACROS',
+                                       '-D__STDC_FORMAT_MACROS',
+                                       '-msse',
+                                       '-ffast-math',
+                                       '-fno-strict-aliasing',
+                                       '-Wall',
+                                       '-Wno-attributes',
+                                       '-Wextra',
+                                       '-Wno-unused-result',
+                                       '-D_FILE_OFFSET_BITS=64'])
 
     if conf.options.enable_debug:
         conf.env.append_value('CXXFLAGS', ['-g', '-DDCPOMATIC_DEBUG'])
     else:
         conf.env.append_value('CXXFLAGS', '-O2')
 
-    if conf.options.address_sanitizer:
-        conf.env.append_value('CXXFLAGS', ['-fsanitize=address', '-fno-omit-frame-pointer'])
-        conf.env.append_value('LINKFLAGS', ['-fsanitize=address'])
-
     #
-    # Platform-specific CFLAGS hacks and other tinkering
+    # Windows/Linux/OS X specific
     #
 
     # Windows
@@ -220,6 +113,14 @@ def configure(conf):
         conf.check(lib='mswsock', uselib_store='MSWSOCK', msg="Checking for library mswsock")
         boost_lib_suffix = '-mt'
         boost_thread = 'boost_thread_win32-mt'
+        conf.check_cxx(fragment="""
+                               #include <boost/locale.hpp>\n
+                               int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
+                               """,
+                               msg='Checking for boost locale library',
+                               libpath='/usr/local/lib',
+                               lib=['boost_locale%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
+                               uselib_store='BOOST_LOCALE')
 
     # POSIX
     if conf.env.TARGET_LINUX or conf.env.TARGET_OSX:
@@ -235,15 +136,7 @@ def configure(conf):
         conf.env.append_value('CXXFLAGS', '-DLINUX_SHARE_PREFIX="%s/share/dcpomatic2"' % conf.env['INSTALL_PREFIX'])
         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_LINUX')
 
-    if conf.env.TARGET_DEBIAN:
-        # libxml2 seems to be linked against this on Ubuntu but it doesn't mention it in its .pc file
-        conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
-
-    if conf.env.TARGET_CENTOS_6 or conf.env.TARGET_CENTOS_7:
-        # libavcodec seems to be linked against this on Centos
-        conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
-        
-    if not conf.env.DISABLE_GUI and conf.env.TARGET_LINUX:
+    if not conf.env.DISABLE_GUI:
         conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='GTK', mandatory=True)
 
     # OSX
@@ -253,97 +146,203 @@ def configure(conf):
 
     #
     # Dependencies.
-    # There's probably a neater way of expressing these, but I've gone for brute force for now.
     #
 
-    if conf.env.TARGET_DEBIAN:
-        conf.check_cfg(package='libcxml', atleast_version='0.11', args='--cflags', uselib_store='CXML', mandatory=True)
-        conf.env.STLIB_CXML = ['cxml']
-        conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
-        conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        static_ffmpeg(conf)
-        static_openjpeg(conf)
-        static_sub(conf)
-        static_dcp(conf, False, False, False, False)
-        dynamic_boost(conf, boost_lib_suffix, boost_thread)
-
-    if conf.env.TARGET_CENTOS_6:
-        # Centos 6.5's boost is too old, so we build a new version statically in the chroot
-        conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs-only-L', uselib_store='CXML', mandatory=True)
-        conf.env.STLIB_CXML = ['cxml', 'boost_filesystem']
-        conf.check_cfg(package='libcurl', args='--cflags --libs-only-L', uselib_store='CURL', mandatory=True)
+    # It should be possible to use check_cfg for both dynamic and static linking, but
+    # e.g. pkg-config --libs --static foo returns some libraries that should be statically
+    # linked and others that should be dynamic.  This doesn't work too well with waf
+    # as it wants them separate.
+
+    # libcurl
+    if conf.options.static_curl:
         conf.env.STLIB_CURL = ['curl']
         conf.env.LIB_CURL = ['ssh2', 'idn']
-        static_ffmpeg(conf)
-        static_openjpeg(conf)
-        static_sub(conf)
-        static_dcp(conf, True, True, True, True)
-        static_boost(conf, boost_lib_suffix)
-
-    if conf.env.TARGET_CENTOS_7:
-        # Centos 7's boost is ok so we link it dynamically
-        conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags', uselib_store='CXML', mandatory=True)
-        conf.env.STLIB_CXML = ['cxml']
+    else:
         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        conf.env.LIB_SSH = ['gssapi_krb5']
-        conf.env.LIB_XMLPP = ['xml2']
-        conf.env.LIB_XMLSEC = ['ltdl']
-        static_ffmpeg(conf)
-        static_openjpeg(conf)
-        static_sub(conf)
-        static_dcp(conf, False, True, True, True)
-        dynamic_boost(conf, boost_lib_suffix, boost_thread)
 
-    if conf.env.TARGET_WINDOWS:
-        conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
-        conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        conf.check_cxx(fragment="""
-                               #include <boost/locale.hpp>\n
-                               int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
-                               """, msg='Checking for boost locale library',
-                                libpath='/usr/local/lib',
-                                lib=['boost_locale%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
-                                uselib_store='BOOST_LOCALE')
-        dynamic_boost(conf, boost_lib_suffix, boost_thread)
-        dynamic_ffmpeg(conf)
-        dynamic_openjpeg(conf)
-        dynamic_dcp(conf)
-        dynamic_sub(conf)
-        dynamic_ssh(conf)
-
-    # Not packaging; just a straight build
-    if not conf.env.TARGET_WINDOWS and not conf.env.TARGET_DEBIAN and not conf.env.TARGET_CENTOS_6 and not conf.env.TARGET_CENTOS_7:
-        conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
-        conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
-        conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        dynamic_boost(conf, boost_lib_suffix, boost_thread)
-        dynamic_ffmpeg(conf)
-        dynamic_dcp(conf)
-        dynamic_sub(conf)
-        dynamic_openjpeg(conf)
-        dynamic_ssh(conf)
-
-    # Dependencies which are always dynamically linked
+
+    # libsndfile
     conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
+
+    # glib
     conf.check_cfg(package='glib-2.0', args='--cflags --libs', uselib_store='GLIB', mandatory=True)
-    if distutils.spawn.find_executable(conf.options.magickpp_config):
-        conf.check_cfg(package='', path=conf.options.magickpp_config, args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
+
+    # ImageMagick / GraphicsMagick
+    if distutils.spawn.find_executable('Magick++-config'):
+        conf.check_cfg(package='', path='Magick++-config', args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_IMAGE_MAGICK')
     else:
-        conf.check_cfg(package='GraphicsMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=True)
-        conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_GRAPHICS_MAGICK')
+        image = conf.check_cfg(package='ImageMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False)
+        graphics = conf.check_cfg(package='GraphicsMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False)
+        if image is None and graphics is None:
+            Logs.pprint('RED', 'Neither ImageMagick++ nor GraphicsMagick++ found: one or the other is required')
+        if image is not None:
+            conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_IMAGE_MAGICK')
+        if graphics is not None:
+            conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_GRAPHICS_MAGICK')
         
+    # libzip
     conf.check_cfg(package='libzip', args='--cflags --libs', uselib_store='ZIP', mandatory=True)
+
+    # pangomm
     conf.check_cfg(package='pangomm-1.4', args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
+
+    # cairomm
     conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
 
-    conf.check_cc(fragment="""
-                           #include <glib.h>
-                           int main() { g_format_size (1); }
-                           """, msg='Checking for g_format_size ()',
-                           uselib='GLIB',
-                           define_name='HAVE_G_FORMAT_SIZE',
-                           mandatory=False)
+    # libcxml
+    if conf.options.static_cxml:
+        conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags', uselib_store='CXML', mandatory=True)
+        conf.env.STLIB_CXML = ['cxml']
+    else:
+        conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
+
+    # libssh
+    if conf.options.static_ssh:
+        conf.env.STLIB_SSH = ['ssh']
+        if conf.options.workaround_gssapi:
+            conf.env.LIB_SSH = ['gssapi_krb5']
+    else:
+        conf.check_cc(fragment="""
+                               #include <libssh/libssh.h>\n
+                               int main () {\n
+                               ssh_session s = ssh_new ();\n
+                               return 0;\n
+                               }
+                               """,
+                      msg='Checking for library libssh',
+                      mandatory=True,
+                      lib='ssh',
+                      uselib_store='SSH')
+
+    # libdcp
+    if conf.options.static_dcp:
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.00.0', args='--cflags', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
+        conf.env.STLIB_DCP = ['dcp', 'asdcp-libdcp', 'kumu-libdcp']
+        conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt']
+    else:
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.00.0', args='--cflags --libs', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
+
+    # libsub
+    if conf.options.static_sub:
+        conf.check_cfg(package='libsub-1.0', atleast_version='1.00.0', args='--cflags', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
+        conf.env.STLIB_SUB = ['sub']
+    else:
+        conf.check_cfg(package='libsub-1.0', atleast_version='1.00.0', args='--cflags --libs', uselib_store='DCP', mandatory=True)
+        conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
+
+    # libxml++
+    if conf.options.static_xmlpp:
+        conf.env.STLIB_XMLPP = ['xml++-2.6']
+    else:
+        conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
+
+    # libxmlsec
+    if conf.options.static_xmlsec:
+        conf.env.STLIB_XMLSEC = ['xmlsec1-openssl', 'xmlsec1']
+    else:
+        conf.env.LIB_XMLSEC = ['xmlsec1-openssl', 'xmlsec1']
+
+    # OpenJPEG
+    if conf.options.static_openjpeg:
+        conf.check_cfg(package='libopenjpeg', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
+        conf.check_cfg(package='libopenjpeg', args='--cflags', max_version='1.5.2', mandatory=True)
+        conf.env.STLIB_OPENJPEG = ['openjpeg']
+    else:
+        conf.check_cfg(package='libopenjpeg', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
+        conf.check_cfg(package='libopenjpeg', args='--cflags --libs', max_version='1.5.2', mandatory=True)
+
+    # FFmpeg
+    if conf.options.static_ffmpeg:
+        names = ['avformat', 'avfilter', 'avcodec', 'avutil', 'swscale', 'swresample', 'postproc']
+        for name in names:
+            static = subprocess.Popen(shlex.split('pkg-config --static --libs lib%s' % name), stdout=subprocess.PIPE).communicate()[0]
+            libs = []
+            stlibs = []
+            include = []
+            libpath = []
+            for s in static.split():
+                if s.startswith('-L'):
+                    libpath.append(s[2:])
+                elif s.startswith('-I'):
+                    include.append(s[2:])
+                elif s.startswith('-l'):
+                    if s[2:] not in names:
+                        libs.append(s[2:])
+                    else:
+                        stlibs.append(s[2:])
+
+            conf.env['LIB_%s' % name.upper()] = libs
+            conf.env['STLIB_%s' % name.upper()] = stlibs
+            conf.env['INCLUDE_%s' % name.upper()] = include
+            conf.env['LIBPATH_%s' % name.upper()] = libpath
+    else:
+        conf.check_cfg(package='libavformat', args='--cflags --libs', uselib_store='AVFORMAT', mandatory=True)
+        conf.check_cfg(package='libavfilter', args='--cflags --libs', uselib_store='AVFILTER', mandatory=True)
+        conf.check_cfg(package='libavcodec', args='--cflags --libs', uselib_store='AVCODEC', mandatory=True)
+        conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='AVUTIL', mandatory=True)
+        conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='SWSCALE', mandatory=True)
+        conf.check_cfg(package='libswresample', args='--cflags --libs', uselib_store='SWRESAMPLE', mandatory=True)
+        conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='POSTPROC', mandatory=True)
+
+    # Boost
+    if conf.options.static_boost:
+        conf.env.STLIB_BOOST_THREAD = ['boost_thread']
+        conf.env.STLIB_BOOST_FILESYSTEM = ['boost_filesystem%s' % boost_lib_suffix]
+        conf.env.STLIB_BOOST_DATETIME = ['boost_date_time%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix]
+        conf.env.STLIB_BOOST_SIGNALS2 = ['boost_signals2']
+        conf.env.STLIB_BOOST_SYSTEM = ['boost_system']
+    else:
+        conf.check_cxx(fragment="""
+                            #include <boost/version.hpp>\n
+                            #if BOOST_VERSION < 104500\n
+                            #error boost too old\n
+                            #endif\n
+                            int main(void) { return 0; }\n
+                            """,
+                       mandatory=True,
+                       msg='Checking for boost library >= 1.45',
+                       okmsg='yes',
+                       errmsg='too old\nPlease install boost version 1.45 or higher.')
+
+        conf.check_cxx(fragment="""
+                           #include <boost/thread.hpp>\n
+                           int main() { boost::thread t (); }\n
+                           """,
+                       msg='Checking for boost threading library',
+                       libpath='/usr/local/lib',
+                       lib=[boost_thread, 'boost_system%s' % boost_lib_suffix],
+                       uselib_store='BOOST_THREAD')
+
+        conf.check_cxx(fragment="""
+                           #include <boost/filesystem.hpp>\n
+                           int main() { boost::filesystem::copy_file ("a", "b"); }\n
+                           """,
+                       msg='Checking for boost filesystem library',
+                       libpath='/usr/local/lib',
+                       lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
+                       uselib_store='BOOST_FILESYSTEM')
+
+        conf.check_cxx(fragment="""
+                           #include <boost/date_time.hpp>\n
+                           int main() { boost::gregorian::day_clock::local_day(); }\n
+                           """,
+                       msg='Checking for boost datetime library',
+                       libpath='/usr/local/lib',
+                       lib=['boost_date_time%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
+                       uselib_store='BOOST_DATETIME')
+
+        conf.check_cxx(fragment="""
+                           #include <boost/signals2.hpp>\n
+                           int main() { boost::signals2::signal<void (int)> x; }\n
+                           """,
+                       msg='Checking for boost signals2 library',
+                       uselib_store='BOOST_SIGNALS2')
+
+    # Other stuff
 
     conf.find_program('msgfmt', var='MSGFMT')
     
@@ -358,6 +357,36 @@ def configure(conf):
     if not conf.env.DISABLE_TESTS:
         conf.recurse('test')
 
+    Logs.pprint('YELLOW', '')
+    if conf.env.TARGET_WINDOWS:
+        Logs.pprint('YELLOW', '\t' + 'Target'.ljust(25) + ': Windows')
+    elif conf.env.TARGET_LINUX:
+        Logs.pprint('YELLOW', '\t' + 'Target'.ljust(25) + ': Linux')
+    elif conf.env.TARGET_OSX:
+        Logs.pprint('YELLOW', '\t' + 'Target'.ljust(25) + ': OS X')
+
+    def report(name, variable):
+        linkage = ''
+        if variable:
+            linkage = 'static'
+        else:
+            linkage = 'dynamic'
+        Logs.pprint('YELLOW', '\t%s: %s' % (name.ljust(25), linkage))
+
+    report('DCP-o-matic libraries', conf.options.static_dcpomatic)
+    report('Boost', conf.options.static_boost)
+    report('OpenJPEG', conf.options.static_openjpeg)
+    report('wxWidgets', conf.options.static_wxwidgets)
+    report('FFmpeg', conf.options.static_ffmpeg)
+    report('libxml++', conf.options.static_xmlpp)
+    report('xmlsec', conf.options.static_xmlsec)
+    report('libssh', conf.options.static_ssh)
+    report('libcxml', conf.options.static_cxml)
+    report('libdcp', conf.options.static_dcp)
+    report('libcurl', conf.options.static_curl)
+
+    Logs.pprint('YELLOW', '')
+
 def build(bld):
     create_version_cc(VERSION, bld.env.CXXFLAGS)
 
@@ -372,11 +401,10 @@ def build(bld):
         bld.recurse('platform/osx')
 
     for r in ['22x22', '32x32', '48x48', '64x64', '128x128']:
-        bld.install_files('${PREFIX}/share/icons/hicolor/%s/apps' % r, 'icons/%s/dcpomatic2.png' % r)
+        bld.install_files('${PREFIX}/share/icons/hicolor/%s/apps' % r, 'icons/%s/dcpomatic.png' % r)
 
-    if bld.env.TARGET_LINUX:
-        bld.install_files('${PREFIX}/share/dcpomatic2', 'icons/taskbar_icon.png')
-        bld.install_files('${PREFIX}/share/dcpomatic2', 'LiberationSans-Regular.ttf')
+    if not bld.env.TARGET_WINDOWS:
+        bld.install_files('${PREFIX}/share/dcpomatic', 'icons/taskbar_icon.png')
 
     bld.add_post_fun(post)
 
@@ -402,7 +430,6 @@ def dist(ctx):
                GRSYMS GRTAGS GSYMS GTAGS
                """
 
-
 def create_version_cc(version, cxx_flags):
     commit = git_revision()
     if commit is None and os.path.exists('.git_revision'):
@@ -442,4 +469,4 @@ def pot_merge(bld):
     bld.recurse('src')
 
 def tags(bld):
-    os.system('etags src/lib/*.cc src/lib/*.h src/wx/*.cc src/wx/*.h src/tools/*.cc src/tools/*.h test/*.cc')
+    os.system('etags src/lib/*.cc src/lib/*.h src/wx/*.cc src/wx/*.h src/tools/*.cc src/tools/*.h')