build+ci: Fixing boost version checking and travis script
Change-Id: I83e2c2b7b7373f00f2a57ffe6adcb9c61db2a260
diff --git a/.travis.yml b/.travis.yml
index cbc3a60..e54f6a3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@
- travis_retry sudo add-apt-repository -y ppa:named-data/ppa
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install -qq ndnx-dev
- - travis_retry sudo apt-get install -qq libboost-all-dev
+ - travis_retry sudo apt-get install -qq libboost1.48-all-dev
- travis_retry sudo apt-get install -qq libcrypto++-dev
- travis_retry sudo apt-get install -qq libsqlite3-dev
- travis_retry git clone git://github.com/named-data/ndn-cpp-dev ndn-cpp
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index 911e7f9..e54f513 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -39,9 +39,9 @@
- boost libraries will try to be smart and use the (pretty but often not useful) auto-linking feature of MSVC
So before calling `conf.check_boost` you might want to disabling by adding:
conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
- Errors:
+ Errors:
- boost might also be compiled with /MT, which links the runtime statically.
- If you have problems with redefined symbols,
+ If you have problems with redefined symbols,
self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
self.env['CXXFLAGS_%s' % var] += ['/MD', '/EHsc']
Passing `--boost-linkage_autodetect` might help ensuring having a correct linkage in some basic cases.
@@ -59,7 +59,7 @@
BOOST_VERSION_CODE = '''
#include <iostream>
#include <boost/version.hpp>
-int main() { std::cout << BOOST_LIB_VERSION << std::endl; }
+int main() { std::cout << BOOST_LIB_VERSION << ":" << BOOST_VERSION << std::endl; }
'''
# toolsets from {boost_dir}/tools/build/v2/tools/common.jam
@@ -93,7 +93,7 @@
def options(opt):
opt = opt.add_option_group('Boost Options')
-
+
opt.add_option('--boost-includes', type='string',
default='', dest='boost_includes',
help='''path to the directory where the boost includes are, e.g., /path/to/boost_1_47_0/stage/include''')
@@ -136,11 +136,16 @@
except (OSError, IOError):
Logs.error("Could not read the file %r" % node.abspath())
else:
- re_but = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"', re.M)
- m = re_but.search(txt)
- if m:
- return m.group(1)
- return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True)
+ re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"', re.M)
+ m1 = re_but1.search(txt)
+
+ re_but2 = re.compile('^#define\\s+BOOST_VERSION\\s+"(.*)"', re.M)
+ m2 = re_but2.search(txt)
+
+ if m1 and m2:
+ return (m1.group(1), m2.group(1))
+
+ return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(":")
@conf
def boost_get_includes(self, *k, **kw):
@@ -280,8 +285,12 @@
self.start_msg('Checking boost includes')
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
- self.env.BOOST_VERSION = self.boost_get_version(inc)
- self.end_msg(self.env.BOOST_VERSION)
+ versions = self.boost_get_version(inc)
+ self.env.BOOST_VERSION = versions[0]
+ self.env.BOOST_VERSION_NUMBER = int(versions[1])
+ self.end_msg("%d.%d.%d" % (int(versions[1]) / 100000,
+ int(versions[1]) / 100 % 1000,
+ int(versions[1]) % 100))
if Logs.verbose:
Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
@@ -365,4 +374,3 @@
self.end_msg("Could not link against boost libraries using supplied options")
self.fatal('The configuration failed')
self.end_msg('ok')
-
diff --git a/wscript b/wscript
index c46c2d0..a66bfc4 100644
--- a/wscript
+++ b/wscript
@@ -52,9 +52,8 @@
conf.check_boost(lib=boost_libs)
- boost_version = conf.env.BOOST_VERSION.split('_')
- if int(boost_version[0]) < 1 or int(boost_version[1]) < 48:
- Logs.error ("Minimum required boost version is 1.48")
+ if conf.env.BOOST_VERSION_NUMBER < 104800:
+ Logs.error ("Minimum required boost version is 1.48.0")
Logs.error ("Please upgrade your distribution or install custom boost libraries" +
" (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
return