commit 939cf5427120ec6b0e857e67e955db8b36adb217
Author: Eric Cronin <ecronin@macports.org>
Date:   Sat Aug 24 19:45:35 2013 -0400

    mkvtoolnix: WIP compiling with clang
---
 dports/devel/boost/Portfile                        |  5 ++-
 dports/multimedia/mkvtoolnix/Portfile              | 32 +++++++++--------
 .../mkvtoolnix/files/patch-clang_errors.diff       | 31 ++++++++++++++++
 .../multimedia/mkvtoolnix/files/patch-df750c2.diff | 41 ++++++++++++++++++++++
 .../mkvtoolnix/files/patch-src-common-logger.cpp   | 41 ----------------------
 5 files changed, 93 insertions(+), 57 deletions(-)

diff --git a/dports/devel/boost/Portfile b/dports/devel/boost/Portfile
index 70433e8..872e5c5 100644
--- a/dports/devel/boost/Portfile
+++ b/dports/devel/boost/Portfile
@@ -6,6 +6,7 @@ PortGroup       compiler_blacklist_versions 1.0
 
 name            boost
 version         1.54.0
+revision        1
 license         Boost-1
 categories      devel
 platforms       darwin
@@ -118,7 +119,9 @@ build.args      -d2 \
                 -sICU_PATH=${prefix} \
                 variant=release \
                 threading=single,multi \
-                link=static,shared
+                link=static,shared \
+                cxxflags="-std=c++11 -stdlib=libc++" \
+                linkflags="-stdlib=libc++"
 
 destroot.cmd            ${worksrcpath}/bjam
 destroot.post_args
diff --git a/dports/multimedia/mkvtoolnix/Portfile b/dports/multimedia/mkvtoolnix/Portfile
index 891c10d..000ea22 100644
--- a/dports/multimedia/mkvtoolnix/Portfile
+++ b/dports/multimedia/mkvtoolnix/Portfile
@@ -2,10 +2,12 @@
 # $Id$
 
 PortSystem          1.0
+PortGroup           compiler_blacklist_versions 1.0
 PortGroup           muniversal 1.0
 
 name                mkvtoolnix
 version             6.3.0
+revision            1
 categories          multimedia
 maintainers         nomaintainer
 license             GPL-2+ LGPL-2.1+
@@ -41,23 +43,21 @@ depends_lib         port:boost \
                     port:ruby \
                     port:zlib
 
-# http://lists.freebsd.org/pipermail/freebsd-multimedia/2013-July/014157.html
-patchfiles          patch-src-common-logger.cpp
+patch.pre_args      -p1
+patchfiles          patch-clang_errors.diff
+# Remove when version > 6.3.0 is released
+patchfiles-append   patch-df750c2.diff
 
-# configure complains about gcc < 4.6 and clang
-compiler.whitelist macports-gcc-4.7 macports-gcc-4.8 macports-gcc-4.9
+# Only recent versions of Clang support C++11 fully
+# TODO: start by trying to get it working with the latest, then try
+# older compilers
+compiler.whitelist macports-clang-3.4
+
+# Blacklist compilers that don't have the needed C++11 features
+#compiler.blacklist  {clang < 421} macports-clang-2.9 macports-clang-3.0 \
+#                    apple-gcc-4.0 apple-gcc-4.2 gcc-3.3 gcc-4.0 gcc-4.2 llvm-gcc-4.2 macports-llvm-gcc-4.2 \
+#                    macports-gcc-4.2 macports-gcc-4.3 macports-gcc-4.4 macports-gcc-4.5
 
-platform darwin {
-    if {${os.major} >= 13} {
-        # This project needs to be updated to build with clang++ against libc++
-        depends_lib
-        depends_run
-        pre-fetch {
-            ui_error "$name does not build on Mavericks or later."
-            error "unsupported platform"
-        }
-    }
-}
 
 build.cmd           ./drake
 build.target        default
@@ -69,6 +69,8 @@ configure.args      --mandir=${prefix}/share/man \
                     --with-extra-includes=${prefix}/include \
                     --disable-gui \
                     --disable-wxwidgets
+configure.cxxflags-append -stdlib=libc++ -std=c++0x
+configure.ldflags-append -stdlib=libc++
 
 variant wxwidgets description {Build with the wxWidgets GUI} {
     depends_lib-append port:wxWidgets30
diff --git a/dports/multimedia/mkvtoolnix/files/patch-clang_errors.diff b/dports/multimedia/mkvtoolnix/files/patch-clang_errors.diff
new file mode 100644
index 0000000..25c111a
--- /dev/null
+++ b/dports/multimedia/mkvtoolnix/files/patch-clang_errors.diff
@@ -0,0 +1,31 @@
+diff -pur mkvtoolnix-6.3.0.orig/src/common/command_line.cpp mkvtoolnix-6.3.0/src/common/command_line.cpp
+--- mkvtoolnix-6.3.0.orig/src/common/command_line.cpp	2013-08-24 18:35:22.000000000 -0400
++++ mkvtoolnix-6.3.0/src/common/command_line.cpp	2013-08-24 18:36:30.000000000 -0400
+@@ -285,6 +285,7 @@ handle_common_cli_args(std::vector<std::
+     } else if ((args[i] == "-h") || (args[i] == "-?") || (args[i] == "--help"))
+       usage();
+ 
++#if 0
+ #if defined(HAVE_CURL_EASY_H)
+     else if (args[i] == "--check-for-updates") {
+       mtx_release_version_t rel = get_latest_release_version();
+@@ -304,6 +305,7 @@ handle_common_cli_args(std::vector<std::
+       mxexit(rel.current_version < rel.latest_source ? 1 : 0);
+     }
+ #endif  // defined(HAVE_CURL_EASY_H)
++#endif
+ 
+     else
+       ++i;
+diff -pur mkvtoolnix-6.3.0.orig/src/common/version.cpp mkvtoolnix-6.3.0/src/common/version.cpp
+--- mkvtoolnix-6.3.0.orig/src/common/version.cpp	2013-08-24 18:35:22.000000000 -0400
++++ mkvtoolnix-6.3.0/src/common/version.cpp	2013-08-24 18:35:43.000000000 -0400
+@@ -220,7 +220,7 @@ get_latest_release_version() {
+     std::stringstream urls;
+     brng::for_each(release.urls, [&](std::pair<std::string, std::string> const &kv) { urls << " " << kv.first << ":" << kv.second; });
+     mxdebug(boost::format("update check: current %1% latest source %2% latest winpre %3% URLs%4%\n")
+-            % release.current_version.to_string() % release.latest_source.to_string() % release.latest_windows_build.to_string() % urls);
++            % release.current_version.to_string() % release.latest_source.to_string() % release.latest_windows_build.to_string() % urls.str());
+   }
+ 
+   return release;
diff --git a/dports/multimedia/mkvtoolnix/files/patch-df750c2.diff b/dports/multimedia/mkvtoolnix/files/patch-df750c2.diff
new file mode 100644
index 0000000..c92b012
--- /dev/null
+++ b/dports/multimedia/mkvtoolnix/files/patch-df750c2.diff
@@ -0,0 +1,41 @@
+From df750c28b6f7258dd4c3037e1132c81300b8cdfa Mon Sep 17 00:00:00 2001
+From: Moritz Bunkus <moritz@bunkus.org>
+Date: Sun, 14 Jul 2013 17:25:42 +0200
+Subject: [PATCH] Fix compilation with clang/libc++ on FreeBSD
+
+On FreeBSD the high_resolution_clock is an alias for the steady_clock
+-- which doesn't support converting into time_t. As we only need a
+precision of seconds for outputting timestamps using system_clock
+instead is enough.
+---
+ src/common/logger.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/common/logger.cpp b/src/common/logger.cpp
+index 7f6e5f2..04251d2 100644
+--- a/src/common/logger.cpp
++++ b/src/common/logger.cpp
+@@ -20,7 +20,7 @@
+ 
+ logger_cptr logger_c::s_default_logger;
+ 
+-static auto s_program_start_time = std::chrono::high_resolution_clock::now();
++static auto s_program_start_time = std::chrono::system_clock::now();
+ 
+ logger_c::logger_c(bfs::path const &file_name)
+   : m_file_name(file_name)
+@@ -41,9 +41,9 @@
+     mm_text_io_c out(new mm_file_io_c(m_file_name.string(), bfs::exists(m_file_name) ? MODE_WRITE : MODE_CREATE));
+     out.setFilePointer(0, seek_end);
+ 
+-    auto now  = std::chrono::high_resolution_clock::now();
++    auto now  = std::chrono::system_clock::now();
+     auto diff = now - s_program_start_time;
+-    auto tnow = std::chrono::high_resolution_clock::to_time_t(now);
++    auto tnow = std::chrono::system_clock::to_time_t(now);
+ 
+     // 2013-03-02 15:42:32
+     char timestamp[30];
+-- 
+1.8.1.6
+
diff --git a/dports/multimedia/mkvtoolnix/files/patch-src-common-logger.cpp b/dports/multimedia/mkvtoolnix/files/patch-src-common-logger.cpp
deleted file mode 100644
index 20bb085..0000000
--- a/dports/multimedia/mkvtoolnix/files/patch-src-common-logger.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
---- src/common/logger.cpp.orig	2013-06-27 23:02:44.000000000 +0300
-+++ src/common/logger.cpp	2013-07-14 10:13:25.026646733 +0300
-@@ -12,6 +12,7 @@
- 
- #include <chrono>
- #include <ctime>
-+#include <ciso646>
- 
- #include "common/logger.h"
- #include "common/fs_sys_helpers.h"
-@@ -20,7 +21,11 @@
- 
- logger_cptr logger_c::s_default_logger;
- 
-+#if defined( _LIBCPP_VERSION )
-+static auto s_program_start_time = std::chrono::system_clock::now();
-+#else
- static auto s_program_start_time = std::chrono::high_resolution_clock::now();
-+#endif
- 
- logger_c::logger_c(bfs::path const &file_name)
-   : m_file_name(file_name)
-@@ -41,9 +46,17 @@
-     mm_text_io_c out(new mm_file_io_c(m_file_name.string(), bfs::exists(m_file_name) ? MODE_WRITE : MODE_CREATE));
-     out.setFilePointer(0, seek_end);
- 
--    auto now  = std::chrono::high_resolution_clock::now();
-+    #if defined( _LIBCPP_VERSION )
-+    auto now  = std::chrono::system_clock::now();
-+    #else
-+    auto now  = std::chrono::high_resolution_clock::now();
-+    #endif
-     auto diff = now - s_program_start_time;
-+    #if defined( _LIBCPP_VERSION )
-+    auto tnow = std::chrono::system_clock::to_time_t(now);
-+    #else
-     auto tnow = std::chrono::high_resolution_clock::to_time_t(now);
-+    #endif
- 
-     // 2013-03-02 15:42:32
-     char timestamp[30];
\ No newline at end of file
