Skip to content

Commit

Permalink
build: Updating Waf 1.8.19 to 2.0.9
Browse files Browse the repository at this point in the history
*) Platform was no longer recognized as a attribute of Options.  Used waf
Utils call to obtain unversioned platform name.

*) Task classes renamed from <taskname>_task to <taskname>.

Waf was not finding the classes when named with _task suffix.

*) Waf removed check option for 'type_name' check.

Added explicit embedded code snippet based on previous Waf versions to perform uint128 checks.

*) Waf source attribute is now strings, need to convert to nodes to retrieve parent node.

# Orig 1.8.19 testdir = self.source[-1].parent.path_from(self.bld.srcnode)
testdir = self.to_nodes(self.source[-1])[0].parent.path_from(self.bld.srcnode)
  • Loading branch information
smithsg84 committed Aug 25, 2018
1 parent 36bd576 commit 12a3af0
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGES.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ <h2>Changes to existing API:</h2>
/ul>
<h2>Changes to build system:</h2>
<ul>
<li>Waf upgraded from 1.8.19 to 2.0.9, and ns-3 build scripts aligned to the new API.</li>
<li>The '--no32bit-scan' argument is removed from Waf apiscan; generation of ILP32 bindings is now automated from the LP64 bindings.</li>
<li> When using on newer compilers, new warnings may trigger build failures.
The --disable-werror flag can be passed to Waf at configuration time to turn
Expand Down
9 changes: 4 additions & 5 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ requirements (Note: not all features available on all platforms):
- Apple LLVM version 7.0.2 or later
- clang-3.3 or later

In addition, Python 2.7 (Python 2 series) or Python 3.4-3.6 (Python 3 series)
- Note: Python 3.7 is not yet supported
In addition, Python 2.7 (Python 2 series) or Python 3.4-3.7 (Python 3 series)

This release has been tested on the following platforms:
- Ubuntu 18.04 (64 bit) with g++-7.3.0 and Python 2.7.15
- Ubuntu 16.04 (64 bit) with g++-5.4.0 and Python 2.7.12
- Fedora Core 28 (64 bit) with g++-8.1.1 and Python 2.7.15
- Fedora Core 26 (64 bit) with g++-7.3.1 and g++-7.1.1, and Python 2.7.14
- Ubuntu 16.04 (64 bit) with g++-5.4.0 and Python 2.7.12/3.5.2
- Fedora Core 28 (64 bit) with g++-8.1.1 and Python 2.7.15/3.7.0
- Fedora Core 26 (64 bit) with g++-7.3.1 and Python 2.7.14/3.6.5
- macOS High Sierra 10.13.5 with Xcode 9.4.1, Apple LLVM version 9.1.0, Python 2.7.10

New user-visible features
Expand Down
38 changes: 31 additions & 7 deletions src/core/wscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys

from waflib import Options
from waflib import Options, Utils
import wutils

int64x64 = {
Expand Down Expand Up @@ -46,10 +46,34 @@ def options(opt):
def configure(conf):
int64x64_impl = Options.options.int64x64_impl
if int64x64_impl == 'default' or int64x64_impl == 'int128':
have_uint128 = conf.check_nonfatal(type_name='uint128_t',
define_name='HAVE_UINT128_T')
have__uint128 = conf.check_nonfatal(type_name='__uint128_t',
define_name='HAVE___UINT128_T')

code_snip_type='''
#include <stdint.h>
int main(int argc, char **argv) {
(void)argc; (void)argv;
if ((uint128_t *) 0) return 0;
if (sizeof (uint128_t)) return 0;
return 1;
}
'''
have_uint128 = conf.check_nonfatal(msg='checking for uint128_t',
define_name='HAVE_UINT128_T',
code=code_snip_type)

code_snip_type='''
#include <stdint.h>
int main(int argc, char **argv) {
(void)argc; (void)argv;
if ((__uint128_t *) 0) return 0;
if (sizeof (__uint128_t)) return 0;
return 1;
}
'''
have__uint128 = conf.check_nonfatal(msg='checking for __uint128_t',
define_name='HAVE___UINT128_T',
code=code_snip_type)
if have_uint128 or have__uint128:
int64x64_impl = 'int128'
else:
Expand Down Expand Up @@ -78,7 +102,7 @@ def configure(conf):

# Check for POSIX threads
test_env = conf.env.derive()
if Options.platform != 'darwin' and Options.platform != 'cygwin':
if Utils.unversioned_sys_platform() != 'darwin' and Utils.unversioned_sys_platform() != 'cygwin':
test_env.append_value('LINKFLAGS', '-pthread')
test_env.append_value('CXXFLAGS', '-pthread')
test_env.append_value('CCFLAGS', '-pthread')
Expand All @@ -102,7 +126,7 @@ int main ()
errmsg='Could not find pthread support (build/config.log for details)')
if have_pthread:
# darwin accepts -pthread but prints a warning saying it is ignored
if Options.platform != 'darwin' and Options.platform != 'cygwin':
if Utils.unversioned_sys_platform() != 'darwin' and Utils.unversioned_sys_platform() != 'cygwin':
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
Expand Down
20 changes: 10 additions & 10 deletions src/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def create_ns3_module(bld, name, dependencies=(), test=False):
def apply_incpaths_ns3testlib(self):
if not self.source:
return
testdir = self.source[-1].parent.path_from(self.bld.srcnode)
testdir = self.to_nodes(self.source[-1])[0].parent.path_from(self.bld.srcnode)
self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,))


Expand Down Expand Up @@ -287,7 +287,7 @@ def ns3_python_bindings(bld):
pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive')
defines = list(pymod.env['DEFINES'])
defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H'])
if Options.platform == 'win32':
if Utils.unversioned_sys_platform()== 'win32':
try:
defines.remove('_DEBUG') # causes undefined symbols on win32
except ValueError:
Expand Down Expand Up @@ -330,7 +330,7 @@ def build(bld):
modheader = bld(features='ns3moduleheader')
modheader.module = module.split('/')[-1]

class ns3pcfile_task(Task.Task):
class ns3pcfile(Task.Task):
after = 'cxx'

def __str__(self):
Expand All @@ -339,7 +339,7 @@ class ns3pcfile_task(Task.Task):
return 'pcfile: %s' % (tgt_str)

def runnable_status(self):
return super(ns3pcfile_task, self).runnable_status()
return super(ns3pcfile, self).runnable_status()

def _self_libs(self, env, name, libdir):
if env['ENABLE_STATIC_NS3']:
Expand Down Expand Up @@ -470,7 +470,7 @@ def apply_ns3header(self):
self.source = '' # tell WAF not to process these files further


class ns3header_task(Task.Task):
class ns3header(Task.Task):
before = 'cxx gen_ns3_module_header'
color = 'BLUE'

Expand Down Expand Up @@ -510,7 +510,7 @@ class ns3header_task(Task.Task):
else:
return Task.SKIP_ME
else:
return super(ns3header_task, self).runnable_status()
return super(ns3header, self).runnable_status()

def run(self):
if self.mode == 'install':
Expand Down Expand Up @@ -561,7 +561,7 @@ def apply_ns3privateheader(self):
self.headers = set(self.to_list(self.source))
self.source = '' # tell WAF not to process these files further

class ns3privateheader_task(Task.Task):
class ns3privateheader(Task.Task):
before = 'cxx gen_ns3_module_header'
after = 'ns3header'
color = 'BLUE'
Expand Down Expand Up @@ -602,7 +602,7 @@ class ns3privateheader_task(Task.Task):
else:
return Task.SKIP_ME
else:
return super(ns3privateheader_task, self).runnable_status()
return super(ns3privateheader, self).runnable_status()

def run(self):
if self.mode == 'install':
Expand Down Expand Up @@ -631,7 +631,7 @@ class ns3privateheader_task(Task.Task):
return 0


class gen_ns3_module_header_task(Task.Task):
class gen_ns3_module_header(Task.Task):
before = 'cxx'
after = 'ns3header'
color = 'BLUE'
Expand All @@ -643,7 +643,7 @@ class gen_ns3_module_header_task(Task.Task):
else:
return Task.SKIP_ME
else:
return super(gen_ns3_module_header_task, self).runnable_status()
return super(gen_ns3_module_header, self).runnable_status()

def __str__(self):
"string to display to the user"
Expand Down
21 changes: 10 additions & 11 deletions waf

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion waf-tools/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

arg_rx = re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)

class command_task(Task.Task):
class command(Task.Task):
color = "BLUE"
def __init__(self, env, generator):
Task.Task.__init__(self, env=env, normal=1, generator=generator)
Expand Down
2 changes: 1 addition & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def configure(conf):
if libstdcxx_location:
conf.env.append_value('NS3_MODULE_PATH', libstdcxx_location)

if Options.platform in ['linux']:
if Utils.unversioned_sys_platform() in ['linux']:
if conf.check_compilation_flag('-Wl,--soname=foo'):
env['WL_SONAME_SUPPORTED'] = True

Expand Down

0 comments on commit 12a3af0

Please sign in to comment.