Skip to content

Instantly share code, notes, and snippets.

@vedranmiletic
Last active July 23, 2017 19:08
Show Gist options
  • Save vedranmiletic/6b50239c2ede59e91d991fcdaed507ef to your computer and use it in GitHub Desktop.
Save vedranmiletic/6b50239c2ede59e91d991fcdaed507ef to your computer and use it in GitHub Desktop.
ns-3 waf 1.9 upgrade patch
diff --git a/contrib/wscript b/contrib/wscript
--- a/contrib/wscript
+++ b/contrib/wscript
@@ -287,7 +287,7 @@
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:
@@ -627,7 +627,7 @@
return 0
-class gen_ns3_module_header_task(Task.Task):
+class gen_ns3_module_header(Task.Task):
before = 'cxx'
after = 'ns3header'
color = 'BLUE'
@@ -639,7 +639,7 @@
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"
diff --git a/src/core/wscript b/src/core/wscript
--- a/src/core/wscript
+++ b/src/core/wscript
@@ -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 = {
@@ -78,7 +78,7 @@
# Check for POSIX threads
test_env = conf.env.derive()
- if Options.platform != 'darwin' and Options.platform != 'cygwin':
+ if Utils.unversioned_sys_platform() not in ['cygwin', 'darwin']:
test_env.append_value('LINKFLAGS', '-pthread')
test_env.append_value('CXXFLAGS', '-pthread')
test_env.append_value('CCFLAGS', '-pthread')
@@ -102,7 +102,7 @@
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() not in ['cygwin', 'darwin']:
conf.env['CXXFLAGS_PTHREAD'] = '-pthread'
conf.env['CCFLAGS_PTHREAD'] = '-pthread'
conf.env['LINKFLAGS_PTHREAD'] = '-pthread'
diff --git a/src/internet/wscript b/src/internet/wscript
--- a/src/internet/wscript
+++ b/src/internet/wscript
@@ -67,7 +67,7 @@
"NSC not found (see option --with-nsc)")
return
- if Options.platform in ['linux', 'freebsd']:
+ if Utils.unversioned_sys_platform() in ['linux', 'freebsd']:
arch = os.uname()[4]
else:
arch = None
diff --git a/src/lte/model/epc-mme.cc b/src/lte/model/epc-mme.cc
--- a/src/lte/model/epc-mme.cc
+++ b/src/lte/model/epc-mme.cc
@@ -130,7 +130,7 @@
std::map<uint64_t, Ptr<UeInfo> >::iterator it = m_ueInfoMap.find (imsi);
NS_ASSERT_MSG (it != m_ueInfoMap.end (), "could not find any UE with IMSI " << imsi);
it->second->cellId = gci;
- EpcS11SapSgw::CreateSessionRequestMessage msg;
+ EpcS11SapSgw::CreateSessionRequestMessage msg {};
msg.imsi = imsi;
msg. uli.gci = gci;
for (std::list<BearerInfo>::iterator bit = it->second->bearersToBeActivated.begin ();
diff --git a/src/wscript b/src/wscript
--- a/src/wscript
+++ b/src/wscript
@@ -263,7 +263,7 @@
bindgen.env['FEATURES'] = ','.join(features)
bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"]
bindgen.before = 'cxx'
- bindgen.after = 'gen_ns3_module_header'
+ bindgen.after = 'ns3moduleheader'
bindgen.name = "pybindgen(ns3 module %s)" % module
bindgen.install_path = None
@@ -287,7 +287,7 @@
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:
@@ -330,7 +330,7 @@
modheader = bld(features='ns3moduleheader')
modheader.module = module.split('/')[-1]
-class ns3pcfile_task(Task.Task):
+class ns3pcfile(Task.Task):
after = 'cxx'
def __str__(self):
@@ -339,7 +339,7 @@
return 'pcfile: %s\n' % (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']:
@@ -466,7 +466,7 @@
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'
@@ -506,7 +506,7 @@
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':
@@ -627,7 +627,7 @@
return 0
-class gen_ns3_module_header_task(Task.Task):
+class gen_ns3_module_header(Task.Task):
before = 'cxx'
after = 'ns3header'
color = 'BLUE'
@@ -639,7 +639,7 @@
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"
diff --git a/waf-tools/command.py b/waf-tools/command.py
--- a/waf-tools/command.py
+++ b/waf-tools/command.py
@@ -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)
diff --git a/wscript b/wscript
--- a/wscript
+++ b/wscript
@@ -412,13 +412,13 @@
if libstdcxx_location:
conf.env.append_value('NS3_MODULE_PATH', libstdcxx_location)
- if Options.platform in ['linux']:
+ if Utils.unversioned_sys_platform() == 'linux':
if conf.check_compilation_flag('-Wl,--soname=foo'):
env['WL_SONAME_SUPPORTED'] = True
# bug 2181 on clang warning suppressions
if conf.env['CXX_NAME'] in ['clang']:
- if Options.platform == 'darwin':
+ if Utils.unversioned_sys_platform() == 'darwin':
if conf.env['CC_VERSION'] >= darwin_clang_version_warn_unused_local_typedefs:
env.append_value('CXXFLAGS', '-Wno-unused-local-typedefs')
if conf.env['CC_VERSION'] >= darwin_clang_version_warn_potentially_evaluated:
@@ -430,7 +430,7 @@
env.append_value('CXXFLAGS', '-Wno-potentially-evaluated-expression')
env['ENABLE_STATIC_NS3'] = False
if Options.options.enable_static:
- if Options.platform == 'darwin':
+ if Utils.unversioned_sys_platform() == 'darwin':
if conf.check_compilation_flag(flag=[], linkflags=['-Wl,-all_load']):
conf.report_optional_feature("static", "Static build", True, '')
env['ENABLE_STATIC_NS3'] = True
@@ -655,12 +655,12 @@
print_config(env)
-class SuidBuild_task(Task.Task):
+class SuidBuild(Task.Task):
"""task that makes a binary Suid
"""
after = 'link'
def __init__(self, *args, **kwargs):
- super(SuidBuild_task, self).__init__(*args, **kwargs)
+ super(SuidBuild, self).__init__(*args, **kwargs)
self.m_display = 'build-suid'
try:
program_obj = wutils.find_program(self.generator.name, self.generator.env)
@@ -1125,13 +1125,13 @@
wutils.run_python_program("test.py -n -c core", bld.env)
-class print_introspected_doxygen_task(Task.TaskBase):
+class print_introspected_doxygen(Task.TaskBase):
after = 'cxx link'
color = 'BLUE'
def __init__(self, bld):
self.bld = bld
- super(print_introspected_doxygen_task, self).__init__(generator=self)
+ super(print_introspected_doxygen, self).__init__(generator=self)
def __str__(self):
return 'print-introspected-doxygen\n'
@@ -1164,13 +1164,13 @@
raise SystemExit(1)
text_out.close()
-class run_python_unit_tests_task(Task.TaskBase):
+class run_python_unit_tests(Task.TaskBase):
after = 'cxx link'
color = 'BLUE'
def __init__(self, bld):
self.bld = bld
- super(run_python_unit_tests_task, self).__init__(generator=self)
+ super(run_python_unit_tests, self).__init__(generator=self)
def __str__(self):
return 'run-python-unit-tests\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment