Fix build on Debian unstable.
authorCarl Hetherington <cth@carlh.net>
Thu, 1 Oct 2015 11:53:07 +0000 (12:53 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 1 Oct 2015 11:58:04 +0000 (12:58 +0100)
cscript
src/cxml.cc
wscript

diff --git a/cscript b/cscript
index 3970427c42427257b3a3fc53bea447a7859e30ba..e4b83c6d1ae137963192519d52da564fb9a360dd 100644 (file)
--- a/cscript
+++ b/cscript
@@ -8,6 +8,8 @@ def build(target, options):
             # Centos builds using static boost, which means tests don't
             # build as test/tests.cc defines BOOST_TEST_DYN_LINK
             cmd += ' --disable-tests'
+        if target.distro == 'debian' and target.version == 'unstable':
+            target.append_with_space('CXXFLAGS', '-std=c++11')
     elif target.platform == 'windows':
         cmd += ' --target-windows'
     target.command(cmd)
index a9ab7697a97c0cac7c29cd6160e5c3ac19aa354b..fb8ca2d42637f9f61275b60c61522fbfa28e03fb 100644 (file)
 #include <libxml++/libxml++.h>
 #include "cxml.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::istream;
+using std::list;
+using boost::shared_ptr;
+using boost::optional;
 
 cxml::Node::Node ()
        : _node (0)
@@ -55,7 +59,7 @@ cxml::Node::node_child (string name) const
        } else if (n.empty ()) {
                throw cxml::Error ("missing XML tag " + name + " in " + _node->get_name());
        }
-       
+
        return n.front ();
 }
 
@@ -68,7 +72,7 @@ cxml::Node::optional_node_child (string name) const
        } else if (n.empty ()) {
                return shared_ptr<cxml::Node> ();
        }
-       
+
        return n.front ();
 }
 
@@ -80,14 +84,14 @@ cxml::Node::node_children (string name) const
        */
 
        xmlpp::Node::NodeList c = _node->get_children ();
-       
+
        list<shared_ptr<cxml::Node> > n;
        for (xmlpp::Node::NodeList::iterator i = c.begin (); i != c.end(); ++i) {
                if ((*i)->get_name() == name) {
                        n.push_back (shared_ptr<Node> (new Node (*i)));
                }
        }
-       
+
        _taken.push_back (name);
        return n;
 }
@@ -127,7 +131,7 @@ cxml::Node::optional_bool_child (string c) const
        if (!s) {
                return optional<bool> ();
        }
-       
+
        return (s.get() == "1" || s.get() == "yes");
 }
 
@@ -144,7 +148,7 @@ cxml::Node::string_attribute (string name) const
        if (!e) {
                throw cxml::Error ("missing attribute " + name);
        }
-       
+
        xmlpp::Attribute* a = e->get_attribute (name);
        if (!a) {
                throw cxml::Error ("missing attribute " + name);
@@ -160,7 +164,7 @@ cxml::Node::optional_string_attribute (string name) const
        if (!e) {
                return optional<string> ();
        }
-       
+
        xmlpp::Attribute* a = e->get_attribute (name);
        if (!a) {
                return optional<string> ();
@@ -202,7 +206,7 @@ string
 cxml::Node::content () const
 {
        string content;
-       
+
         xmlpp::Node::NodeList c = _node->get_children ();
        for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) {
                xmlpp::ContentNode const * v = dynamic_cast<xmlpp::ContentNode const *> (*i);
@@ -250,12 +254,12 @@ cxml::Document::~Document ()
 }
 
 void
-cxml::Document::read_file (filesystem::path file)
+cxml::Document::read_file (boost::filesystem::path file)
 {
-       if (!filesystem::exists (file)) {
+       if (!boost::filesystem::exists (file)) {
                throw cxml::Error ("XML file " + file.string() + " does not exist");
        }
-       
+
        _parser->parse_file (file.string ());
        take_root_node ();
 }
@@ -289,4 +293,3 @@ cxml::Document::take_root_node ()
                _root_name = _node->get_name ();
        }
 }
-
diff --git a/wscript b/wscript
index 0d91d698dbdc20fa561bc555ee1cb4f291ef8b87..f6b1210fe1cd694a7383950d62a2fa981258e6f6 100644 (file)
--- a/wscript
+++ b/wscript
@@ -11,6 +11,7 @@ def options(opt):
 def configure(conf):
     conf.load('compiler_cxx')
     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-O2'])
+    print conf.env['CXXFLAGS']
 
     conf.env.TARGET_WINDOWS = conf.options.target_windows
     conf.env.STATIC = conf.options.static