Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
authorCarl Hetherington <cth@carlh.net>
Wed, 21 Mar 2018 09:12:55 +0000 (09:12 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 21 Mar 2018 09:12:55 +0000 (09:12 +0000)
compile_commands.json [new symlink]
cscript
platform/osx/make_dmg.sh
src/lib/cinema_kdms.cc
src/lib/util.cc
src/lib/verify_dcp_job.cc
src/wx/film_viewer.cc
src/wx/verify_dcp_dialog.cc
waf-tools/clang_compilation_database.py [new file with mode: 0644]
wscript

diff --git a/compile_commands.json b/compile_commands.json
new file mode 120000 (symlink)
index 0000000..25eb4b2
--- /dev/null
@@ -0,0 +1 @@
+build/compile_commands.json
\ No newline at end of file
diff --git a/cscript b/cscript
index 8120e8284b3767d6c2300c3747025145ea181dde..2c999540e49d9acc73bbcec281906c97afd591f9 100644 (file)
--- a/cscript
+++ b/cscript
@@ -220,7 +220,7 @@ def make_control(debian_version, bits, filename, debug):
         print('  This package contains the debugging symbols for dcpomatic.', file=f)
         print('', file=f)
 
-def make_spec(filename, version, target):
+def make_spec(filename, version, target, requires=None):
     """Make a .spec file for a RPM build"""
     f = open(filename, 'w')
     print('Summary:A program that generates Digital Cinema Packages (DCPs) from video and audio files', file=f)
@@ -230,6 +230,8 @@ def make_spec(filename, version, target):
     print('License:GPL', file=f)
     print('Group:Applications/Multimedia', file=f)
     print('URL:http://dcpomatic.com/', file=f)
+    if requires is not None:
+        print('Requires:%s' % requires, file=f)
     print('', file=f)
     print('%description', file=f)
     print('DCP-o-matic generates Digital Cinema Packages (DCPs) from video and audio ', file=f)
@@ -300,8 +302,8 @@ def dependencies(target):
         ffmpeg_options = {}
 
     return (('ffmpeg-cdist', '5fce90f', ffmpeg_options),
-            ('libdcp', '623e197'),
-            ('libsub', 'debe9fb'),
+            ('libdcp', '1215fe2'),
+            ('libsub', '1899ddd'),
             ('rtaudio-cdist', '739969e'))
 
 def configure_options(target):
@@ -401,7 +403,11 @@ def package_rpm(target, cpu, version):
         "%s/SOURCES/dcpomatic-%s.tar.bz2" % (topdir, version)
         )
 
-    make_spec('build/platform/linux/dcpomatic2.spec', version, target)
+    requires = None
+    if target.distro == 'mageia':
+        requires = "lib64xmlsec1-devel"
+
+    make_spec('build/platform/linux/dcpomatic2.spec', version, target, requires)
     cmd = 'rpmbuild --define "_topdir %s" -bb build/platform/linux/dcpomatic2.spec' % topdir
     target.command(cmd)
     rpms = []
index 43d0a472ae3dc7dad93e9dbe7f523b23e4aa5785..82237f988ccd61c418364d3eced636e58bf57926 100644 (file)
@@ -11,7 +11,7 @@ version=`cat wscript | egrep ^VERSION | awk '{print $3}' | sed -e "s/'//g"`
 
 # DMG size in megabytes
 DMG_SIZE=256
-ENV=/Users/carl/Environments/osx/10.6
+ENV=/Users/carl/Environments/dcpomatic
 ROOT=$1
 
 # This is our work area for making up the .dmgs
@@ -157,10 +157,10 @@ function relink {
            base=`basename $dep`
            # $dep will be a path within 64/; make a 32/ path too
            dep32=`echo $dep | sed -e "s/\/64\//\/32\//g"`
-           changes="$changes -change $dep @executable_path/../lib/$base -change $dep32 @executable_path/../lib/$base"
+           changes="$changes -change $dep @executable_path/../Frameworks/$base -change $dep32 @executable_path/../Frameworks/$base"
        done
        if test "x$changes" != "x"; then
-           install_name_tool $changes "$obj"
+           install_name_tool $changes -id `basename "$obj"` "$obj"
        fi
     done
 }
@@ -174,7 +174,7 @@ function make_dmg {
     dmg="$full_name $version.dmg"
     vol_name=DCP-o-matic-$version
 
-    codesign --deep --force --verify --verbose --sign "3rd Party Mac Developer Application: Carl Hetherington (R82DXSR997)" "$appdir"
+    codesign --deep --force --verify --verbose --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$appdir"
     if [ "$?" != "0" ]; then
        echo "Failed to sign .app"
        exit 1
@@ -183,6 +183,11 @@ function make_dmg {
     mkdir -p $vol_name
     cp -a "$appdir" $vol_name
     ln -s /Applications "$vol_name/Applications"
+    cat<<EOF > "$vol_name/READ ME.txt"
+Welcome to DCP-o-matic!  The first time you run the program there may be
+a long (several-minute) delay while OS X checks the code for viruses and
+other malware.  Please be patient!
+EOF
 
     rm -f $tmp_dmg "$dmg"
     hdiutil create -srcfolder $vol_name -volname $vol_name -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size $DMG_SIZE $tmp_dmg
@@ -192,17 +197,18 @@ function make_dmg {
 
     echo '
   tell application "Finder"
-    tell disk "'$vol_name'"
+    tell disk "$vol_name"
            open
            set current view of container window to icon view
            set toolbar visible of container window to false
            set statusbar visible of container window to false
-           set the bounds of container window to {400, 200, 650, 370}
+           set the bounds of container window to {400, 200, 940, 300}
            set theViewOptions to the icon view options of container window
            set arrangement of theViewOptions to not arranged
            set icon size of theViewOptions to 64
-           set position of item "'$appdir'" of container window to {90, 80}
-           set position of item "Applications" of container window to {220, 80}
+           set position of item "$appdir" of container window to {90, 80}
+           set position of item "Applications" of container window to {265, 80}
+           set position of item "READ ME.txt" of container window to {430, 80}
            close
            open
            update without registering applications
@@ -220,6 +226,11 @@ function make_dmg {
     DeRez -only icns "$appdir/Contents/Resources/dcpomatic2.icns" > "$appdir/Contents/Resources/DCP-o-matic.rsrc"
     Rez -append "$appdir/Contents/Resources/DCP-o-matic.rsrc" -o "$dmg"
     SetFile -a C "$dmg"
+    codesign --verify --verbose --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$dmg"
+    if [ "$?" != "0" ]; then
+       echo "Failed to sign .dmg"
+       exit 1
+    fi
     rm $tmp_dmg
     rm -rf $vol_name
 }
@@ -230,11 +241,11 @@ function setup {
     approot="$appdir/Contents"
     rm -rf "$appdir"
     mkdir -p "$approot/MacOS"
-    mkdir -p "$approot/lib"
+    mkdir -p "$approot/Frameworks"
     mkdir -p "$approot/Resources"
 
     to_relink="dcpomatic"
-    copy_libs "$approot/lib"
+    copy_libs "$approot/Frameworks"
     copy_resources "$approot/Resources"
 }
 
@@ -245,7 +256,7 @@ universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_cli "$approot/MacO
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_create "$approot/MacOS"
 universal_copy $ROOT bin/ffprobe "$approot/MacOS"
 cp $ROOT/32/src/dcpomatic/build/platform/osx/dcpomatic2.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2" "$approot/MacOS/dcpomatic2_cli" "$approot/MacOS/ffprobe" "$approot/lib/"*.dylib)
+rl=("$approot/MacOS/dcpomatic2" "$approot/MacOS/dcpomatic2_cli" "$approot/MacOS/dcpomatic2_create" "$approot/MacOS/ffprobe" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
 make_dmg "$appdir" "DCP-o-matic"
 
@@ -254,7 +265,7 @@ setup "DCP-o-matic 2 KDM Creator.app"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_kdm "$approot/MacOS"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_kdm_cli "$approot/MacOS"
 cp $ROOT/32/src/dcpomatic/build/platform/osx/dcpomatic2_kdm.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2_kdm" "$approot/MacOS/dcpomatic2_kdm_cli" "$approot/lib/"*.dylib)
+rl=("$approot/MacOS/dcpomatic2_kdm" "$approot/MacOS/dcpomatic2_kdm_cli" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
 make_dmg "$appdir" "DCP-o-matic KDM Creator"
 
@@ -263,7 +274,7 @@ setup "DCP-o-matic 2 Encode Server.app"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_server "$approot/MacOS"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_server_cli "$approot/MacOS"
 cp $ROOT/32/src/dcpomatic/build/platform/osx/dcpomatic2_server.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2_server" "$approot/MacOS/dcpomatic2_server_cli" "$approot/lib/"*.dylib)
+rl=("$approot/MacOS/dcpomatic2_server" "$approot/MacOS/dcpomatic2_server_cli" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
 make_dmg "$appdir" "DCP-o-matic Encode Server"
 
@@ -271,7 +282,7 @@ make_dmg "$appdir" "DCP-o-matic Encode Server"
 setup "DCP-o-matic 2 Batch converter.app"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_batch "$approot/MacOS"
 cp $ROOT/32/src/dcpomatic/build/platform/osx/dcpomatic2_batch.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2_batch" "$approot/lib/"*.dylib)
+rl=("$approot/MacOS/dcpomatic2_batch" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
 make_dmg "$appdir" "DCP-o-matic Batch Converter"
 
@@ -279,6 +290,6 @@ make_dmg "$appdir" "DCP-o-matic Batch Converter"
 setup "DCP-o-matic 2 Player.app"
 universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_player "$approot/MacOS"
 cp $ROOT/32/src/dcpomatic/build/platform/osx/dcpomatic2_player.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2_player" "$approot/lib/"*.dylib)
+rl=("$approot/MacOS/dcpomatic2_player" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
 make_dmg "$appdir" "DCP-o-matic Player"
index d4c1017bb6bcb1846332be77ba7559ba0af6f8d5..aaeb0d9056f3f89b94b9c62c731b4a8edd7912ef 100644 (file)
@@ -131,15 +131,14 @@ CinemaKDMs::write_directories (
 
        int written = 0;
 
-       if (!boost::filesystem::exists (directory)) {
-               boost::filesystem::create_directories (directory);
-       }
-
        BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
                boost::filesystem::path path = directory;
                name_values['c'] = i.cinema->name;
                path /= container_name_format.get(name_values, "");
-               ScreenKDM::write_files (i.screen_kdms, path, filename_format, name_values, confirm_overwrite);
+               if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
+                       boost::filesystem::create_directories (path);
+                       ScreenKDM::write_files (i.screen_kdms, path, filename_format, name_values, confirm_overwrite);
+               }
                written += i.screen_kdms.size();
        }
 
@@ -162,10 +161,6 @@ CinemaKDMs::write_zip_files (
 
        int written = 0;
 
-       if (!boost::filesystem::exists (directory)) {
-               boost::filesystem::create_directories (directory);
-       }
-
        BOOST_FOREACH (CinemaKDMs const & i, cinema_kdms) {
                boost::filesystem::path path = directory;
                name_values['c'] = i.cinema->name;
index 68cded2a348bee17bee9afcffe4cc749291d5105..abfdd2767c31a50f6a3342c684cc9fcea9a9c960 100644 (file)
@@ -346,11 +346,11 @@ dcpomatic_setup ()
        avfilter_register_all ();
 
 #ifdef DCPOMATIC_OSX
-       /* Add our lib directory to the libltdl search path so that
+       /* Add our library directory to the libltdl search path so that
           xmlsec can find xmlsec1-openssl.
        */
        boost::filesystem::path lib = app_contents ();
-       lib /= "lib";
+       lib /= "Frameworks";
        setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
 #endif
 
index 0a54cabd03f9c5ff24f014d8fe7fad9f052fab73..8ac41d2a4b9f70fc4edea9cb957c4825e0056d48 100644 (file)
@@ -53,7 +53,7 @@ VerifyDCPJob::run ()
 
        bool failed = false;
        BOOST_FOREACH (dcp::VerificationNote i, _notes) {
-               if (i.type() == dcp::VerificationNote::ERROR) {
+               if (i.type() == dcp::VerificationNote::VERIFY_ERROR) {
                        failed = true;
                }
        }
index ade45d766879ab4030f5dfcdc80fc9ea6b462535..1103db159f5a5c2bdd1a98d8339c86cd4d056509 100644 (file)
@@ -373,7 +373,7 @@ FilmViewer::paint_panel ()
 {
        wxPaintDC dc (_panel);
 
-       if (!_frame || !_film || !_out_size.width || !_out_size.height) {
+       if (!_frame || !_film || !_out_size.width || !_out_size.height || _out_size != _frame->size()) {
                dc.Clear ();
                return;
        }
index b1eea0fd253b71aa50a4431b55b0982831cc1768..aff4a92f05b55372b15624670faf25df37eab5ac 100644 (file)
@@ -53,13 +53,13 @@ VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, list<dcp::VerificationNote>
 
        BOOST_FOREACH (dcp::VerificationNote i, notes) {
                switch (i.type()) {
-               case dcp::VerificationNote::NOTE:
+               case dcp::VerificationNote::VERIFY_NOTE:
                        _text->BeginStandardBullet (N_("standard/circle"), 1, 50);
                        break;
-               case dcp::VerificationNote::WARNING:
+               case dcp::VerificationNote::VERIFY_WARNING:
                        _text->BeginStandardBullet (N_("standard/diamond"), 1, 50);
                        break;
-               case dcp::VerificationNote::ERROR:
+               case dcp::VerificationNote::VERIFY_ERROR:
                        _text->BeginSymbolBullet (N_("!"), 1, 50);
                        break;
                }
@@ -68,11 +68,11 @@ VerifyDCPDialog::VerifyDCPDialog (wxWindow* parent, list<dcp::VerificationNote>
                _text->Newline ();
 
                switch (i.type()) {
-               case dcp::VerificationNote::NOTE:
-               case dcp::VerificationNote::WARNING:
+               case dcp::VerificationNote::VERIFY_NOTE:
+               case dcp::VerificationNote::VERIFY_WARNING:
                        _text->EndStandardBullet ();
                        break;
-               case dcp::VerificationNote::ERROR:
+               case dcp::VerificationNote::VERIFY_ERROR:
                        _text->EndSymbolBullet ();
                        break;
                }
diff --git a/waf-tools/clang_compilation_database.py b/waf-tools/clang_compilation_database.py
new file mode 100644 (file)
index 0000000..4d9b5e2
--- /dev/null
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# encoding: utf-8
+# Christoph Koke, 2013
+
+"""
+Writes the c and cpp compile commands into build/compile_commands.json
+see http://clang.llvm.org/docs/JSONCompilationDatabase.html
+
+Usage:
+
+    def configure(conf):
+        conf.load('compiler_cxx')
+        ...
+        conf.load('clang_compilation_database')
+"""
+
+import sys, os, json, shlex, pipes
+from waflib import Logs, TaskGen, Task
+
+Task.Task.keep_last_cmd = True
+
+@TaskGen.feature('c', 'cxx')
+@TaskGen.after_method('process_use')
+def collect_compilation_db_tasks(self):
+       "Add a compilation database entry for compiled tasks"
+       try:
+               clang_db = self.bld.clang_compilation_database_tasks
+       except AttributeError:
+               clang_db = self.bld.clang_compilation_database_tasks = []
+               self.bld.add_post_fun(write_compilation_database)
+
+       tup = tuple(y for y in [Task.classes.get(x) for x in ('c', 'cxx')] if y)
+       for task in getattr(self, 'compiled_tasks', []):
+               if isinstance(task, tup):
+                       clang_db.append(task)
+
+def write_compilation_database(ctx):
+       "Write the clang compilation database as JSON"
+       database_file = ctx.bldnode.make_node('compile_commands.json')
+       Logs.info('Build commands will be stored in %s', database_file.path_from(ctx.path))
+       try:
+               root = json.load(database_file)
+       except IOError:
+               root = []
+       clang_db = dict((x['file'], x) for x in root)
+       for task in getattr(ctx, 'clang_compilation_database_tasks', []):
+               try:
+                       cmd = task.last_cmd
+               except AttributeError:
+                       continue
+               directory = getattr(task, 'cwd', ctx.variant_dir)
+               f_node = task.inputs[0]
+               filename = os.path.relpath(f_node.abspath(), directory)
+               entry = {
+                       "directory": directory,
+                       "arguments": cmd,
+                       "file": filename,
+               }
+               clang_db[filename] = entry
+       root = list(clang_db.values())
+       database_file.write(json.dumps(root, indent=2))
+
+# Override the runnable_status function to do a dummy/dry run when the file doesn't need to be compiled.
+# This will make sure compile_commands.json is always fully up to date.
+# Previously you could end up with a partial compile_commands.json if the build failed.
+for x in ('c', 'cxx'):
+       if x not in Task.classes:
+               continue
+
+       t = Task.classes[x]
+
+       def runnable_status(self):
+               def exec_command(cmd, **kw):
+                       pass
+
+               run_status = self.old_runnable_status()
+               if run_status == Task.SKIP_ME:
+                       setattr(self, 'old_exec_command', getattr(self, 'exec_command', None))
+                       setattr(self, 'exec_command', exec_command)
+                       self.run()
+                       setattr(self, 'exec_command', getattr(self, 'old_exec_command', None))
+               return run_status
+
+       setattr(t, 'old_runnable_status', getattr(t, 'runnable_status', None))
+       setattr(t, 'runnable_status', runnable_status)
diff --git a/wscript b/wscript
index dce57b29b1b64c271970c56ce7051771da29012f..6ea7dedcb337434c7ef3bcc4873ef92a859dd868 100644 (file)
--- a/wscript
+++ b/wscript
@@ -41,7 +41,7 @@ print('Version: %s' % VERSION)
 def options(opt):
     opt.load('compiler_cxx')
     opt.load('winres')
-
+    
     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')
@@ -63,6 +63,7 @@ def options(opt):
 
 def configure(conf):
     conf.load('compiler_cxx')
+    conf.load('clang_compilation_database', tooldir=['waf-tools'])
     if conf.options.target_windows:
         conf.load('winres')