--- /dev/null
+--- libsub-9999/test/dcp_reader_test.cc
++++ libsub-9999/test/dcp_reader_test.cc
+@@ -19,6 +19,7 @@
+
+ #include "interop_dcp_reader.h"
+ #include "collect.h"
++#include <boost/optional/optional_io.hpp>
+ #include <boost/test/unit_test.hpp>
+ #include <fstream>
+ #include <iostream>
+--- libsub-9999/test/wscript
++++ libsub-9999/test/wscript
+@@ -17,7 +17,7 @@
+ def build(bld):
+ obj = bld(features='cxx cxxprogram')
+ obj.name = 'tests'
+- obj.uselib = 'BOOST_TEST DCP CXML'
++ obj.uselib = 'BOOST_TEST BOOST_FILESYSTEM DCP CXML'
+ obj.use = 'libsub-1.0'
+ obj.source = """
+ dcp_reader_test.cc
+--- libsub-9999/tools/wscript
++++ libsub-9999/tools/wscript
+@@ -1,6 +1,6 @@
+ def build(bld):
+ obj = bld(features = 'cxx cxxprogram')
+ obj.use = ['libsub-1.0']
+- obj.uselib = 'OPENJPEG DCP CXML'
++ obj.uselib = 'OPENJPEG DCP CXML BOOST_FILESYSTEM'
+ obj.source = 'dumpsubs.cc'
+ obj.target = 'dumpsubs'
--- /dev/null
+--- libsub-1.9999/src/stl_text_reader.cc
++++ libsub-1.9999/src/stl_text_reader.cc
+@@ -22,6 +22,7 @@
+ #include <boost/algorithm/string.hpp>
+ #include <boost/lexical_cast.hpp>
+ #include <vector>
++#include <iostream>
+
+ using std::list;
+ using std::ostream;
+--- libsub-9999/src/dcp_reader.cc
++++ libsub-9999/src/dcp_reader.cc
+@@ -26,6 +26,7 @@
+ #include "dcp/subtitle.h"
+ #include <libcxml/cxml.h>
+ #include <libxml++/libxml++.h>
++#include <iostream>
+
+ using std::list;
+ using std::cout;
+--- libsub-9999/src/sub_time.cc
++++ libsub-9999/src/sub_time.cc
+@@ -21,6 +21,7 @@
+ #include "exceptions.h"
+ #include <cmath>
+ #include <iomanip>
++#include <iostream>
+
+ using std::ostream;
+ using std::cout;
+--- libsub-9999/test/dcp_reader_test.cc
++++ libsub-9999/test/dcp_reader_test.cc
+@@ -21,6 +21,7 @@
+ #include "collect.h"
+ #include <boost/test/unit_test.hpp>
+ #include <fstream>
++#include <iostream>
+
+ using std::list;
+ using std::cout;
+--- libsub-9999/test/stl_binary_reader_test.cc
++++ libsub-9999/test/stl_binary_reader_test.cc
+@@ -24,7 +24,6 @@
+ #include "test.h"
+
+ using std::list;
+-using std::cout;
+ using std::ifstream;
+
+ /* Test reading of a binary STL file */
+--- libsub-9999/test/subrip_reader_test.cc
++++ libsub-9999/test/subrip_reader_test.cc
+@@ -24,6 +24,7 @@
+ #include <boost/test/unit_test.hpp>
+ #include <boost/filesystem.hpp>
+ #include <fstream>
++#include <iostream>
+
+ using std::list;
+ using std::cerr;
+--- libsub-9999/test/test.cc
++++ libsub-9999/test/test.cc
+@@ -22,6 +22,7 @@
+ #include <boost/test/unit_test.hpp>
+ #include <boost/filesystem.hpp>
+ #include <fstream>
++#include <iostream>
+ #include <string>
+ #include "iso6937_tables.h"
+
+--- libsub-9999/tools/dumpsubs.cc
++++ libsub-9999/tools/dumpsubs.cc
+@@ -23,6 +23,7 @@
+ #include <getopt.h>
+ #include <boost/filesystem.hpp>
+ #include <map>
++#include <iostream>
+
+ using std::string;
+ using std::cerr;
+--- libsub-9999/asdcplib/src/h__Writer.cpp
++++ libsub-9999/asdcplib/src/h__Writer.cpp
+@@ -32,7 +32,6 @@
+ #include "AS_DCP_internal.h"
+ #include "KLV.h"
+
+-using std::cout;
+ using namespace ASDCP;
+ using namespace ASDCP::MXF;
+
--- /dev/null
+--- libsub-9999/src/smpte_dcp_reader.cc
++++ libsub-9999/src/smpte_dcp_reader.cc
+@@ -29,7 +29,6 @@
+
+ using std::string;
+ using std::list;
+-using std::stringstream;
+ using boost::shared_ptr;
+ using namespace sub;
+
+@@ -46,9 +45,7 @@
+
+ string s;
+ reader.ReadTimedTextResource (s, 0, 0);
+- stringstream t;
+- t << s;
+- xml->read_stream (t);
++ xml->read_string (s);
+
+ ASDCP::WriterInfo info;
+ reader.FillWriterInfo (info);
--- /dev/null
+--- libsub-1.9999/wscript
++++ libsub-1.9999/wscript
+@@ -128,5 +128,4 @@
+ sys.exit(-1)
+
+ def post(ctx):
+- if ctx.cmd == 'install':
+- ctx.exec_command('/sbin/ldconfig')
++ pass
--- /dev/null
+--- libsub-9999/wscript
++++ libsub-9999/wscript
+@@ -23,10 +23,6 @@
+ conf.env.DISABLE_TESTS = conf.options.disable_tests
+ conf.env.API_VERSION = API_VERSION
+
+- if conf.options.enable_debug:
+- conf.env.append_value('CXXFLAGS', '-g')
+- else:
+- conf.env.append_value('CXXFLAGS', '-O3')
+
+ conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True)
+
--- /dev/null
+--- libsub-9999/test/wscript
++++ libsub-9999/test/wscript
+@@ -6,10 +6,11 @@
+ conf.check_cxx(fragment="""
+ #define BOOST_TEST_MODULE Config test\n
+ #include <boost/test/unit_test.hpp>\n
++ #include <boost/filesystem.hpp>\n
+ int main() {}
+ """,
+ msg='Checking for boost unit testing library',
+- lib='boost_unit_test_framework%s' % boost_lib_suffix,
++ lib='boost_unit_test_framework%s boost_filesystem%s' % (boost_lib_suffix, boost_lib_suffix),
+ uselib_store='BOOST_TEST')
+
+ conf.env.prepend_value('LINKFLAGS', '-Lsrc')
--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_4 python3_5 python3_6 )
+PYTHON_REQ_USE="threads(+)"
+inherit git-r3 python-any-r1 waf-utils
+
+DESCRIPTION="read and write subtitles in a few different formats"
+HOMEPAGE="http://carlh.net/libsub"
+EGIT_REPO_URI="https://github.com/cth103/${PN}.git"
+EGIT_BRANCH="1.0"
+
+LICENSE="GPL-2"
+SLOT="1.0"
+KEYWORDS=""
+IUSE=""
+
+RDEPEND="dev-cpp/glibmm:2
+ dev-cpp/libxmlpp:2.6
+ dev-libs/boost:=
+ >=dev-libs/libcxml-0.15.4
+ dev-libs/openssl:0
+ >=media-libs/libasdcp-cth-0.1.3"
+DEPEND="${RDEPEND}
+ dev-util/waf
+ virtual/pkgconfig
+ ${PYTHON_DEPS}"
+
+PATCHES=( "${FILESDIR}"/${P}-no-ldconfig.patch
+ "${FILESDIR}"/${P}-respect-cxxflags.patch
+ "${FILESDIR}"/${P}-iostream.patch
+ "${FILESDIR}"/${P}-libcxml-9999.patch
+ "${FILESDIR}"/${P}-boost.patch )
+
+src_prepare() {
+ rm -v waf || die
+ export WAF_BINARY=${EROOT}usr/bin/waf
+
+ ewarn "Some tests failing due missing files/certs are disabled."
+ sed -e '/ssa_reader_test.cc/d' \
+ -e '/dcp_to_stl_binary_test.cc/d' \
+ -i test/wscript || die
+
+ default
+}
+
+src_test() {
+ ./run/tests || die
+}