Bug 1804 - dce-ns3-1.1/dce-linux-1.1 can't built with ns3-3.18.1
authorHajime Tazaki <tazaki@sfc.wide.ad.jp>
Tue, 03 Dec 2013 08:03:37 +0900
changeset 529 f302f8b792d8
parent 528 c87eed219040
child 530 2faab8722e1b
Bug 1804 - dce-ns3-1.1/dce-linux-1.1 can't built with ns3-3.18.1
RELEASE_NOTES
ns3waf/__init__.py
--- a/RELEASE_NOTES	Thu Nov 21 20:54:26 2013 +0900
+++ b/RELEASE_NOTES	Tue Dec 03 08:03:37 2013 +0900
@@ -5,6 +5,38 @@
 
 Please refer the page http://www.nsnam.org/projects/direct-code-execution/ for detailed instructions
 
+Release dce-1.1.1 (hotfix)
+=========================
+This release includes a hotfix for the combination with ns3-18.1.
+
+Bugs fixed
+----------
+Bug 1804 - dce-ns3-1.1/dce-linux-1.1 can't built with ns3-3.18.1
+
+Availability
+------------
+In order to use DCE, please use bake tool to install DCE.
+The followings are the basic steps to use DCE.
+
+ % bake.py configure -e dce-ns3-1.1.1
+   or
+ % bake.py configure -e dce-linux-1.1.1
+ % bake.py download
+ % bake.py build
+
+For more information, please refer the document.
+
+Tested platforms
+-------------------
+- Ubuntu 10.04 64bit
+- Ubuntu 12.04 32bit/64bit
+- Ubuntu 12.10 64bit
+- Ubuntu 13.04 64bit
+- Fedora 18 32bit
+- CentOS 6.2 64bit
+- CentOS 6.4 64bit
+
+
 Release dce-1.1
 =============
 
--- a/ns3waf/__init__.py	Thu Nov 21 20:54:26 2013 +0900
+++ b/ns3waf/__init__.py	Tue Dec 03 08:03:37 2013 +0900
@@ -1,6 +1,9 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 import waflib
+import glob
+import os
+import re
 
 def options(opt):
     opt.tool_options('compiler_cc')
@@ -142,32 +145,41 @@
                 env['WL_SONAME_SUPPORTED'] = True
 
 
+ns3_versions = ['3-dev', '3.18', '3.17']
 def _check_dependencies(conf, required, mandatory):
     found = []
+    match_pkg = None
     for module in required:
         if module in conf.env['NS3_MODULES_FOUND']:
             continue
         # XXX need better way to find .pc files
-        for ver in ['3-dev', '3.18', '3.17']:
-            try:
-                retval = conf.check_cfg(package = 'libns%s-%s-%s' 
-                                        % (ver, module.lower(), conf.env['LIB_SUFFIX']),
-                                        args='--cflags --libs', mandatory=mandatory,
-                                        msg="Checking for ns3-%s" % module.lower(),
-                                        uselib_store='NS3_%s' % module.upper())
-                if not retval is None:
-                    # XXX pkg-config doesn't give the proper order of whole-archive option..
-                    if conf.env['NS3_ENABLE_STATIC']:
-                        libname = 'STLIB_ST_NS3_%s' % module.upper()
-                        conf.env[libname] = '-lns%s-%s-%s' % (ver, module.lower(), conf.env['LIB_SUFFIX'])
-                        for lib in conf.env['LIB_NS3_%s' % module.upper()]:
-                            if 'ns%s-' % ver in lib:
-                                conf.env.append_value(libname, '-l%s' % lib)
-                    break
-            except conf.errors.ConfigurationError:
-                retval = None
+        for ver in ns3_versions:
+            pcfiles = glob.glob(conf.env['NS3_DIR'] + '/lib/pkgconfig/' + 'libns%s*-%s-%s*'
+                                % (ver, module.lower(), conf.env['LIB_SUFFIX']))
+            if not len(pcfiles) is 0:
+                match_pkg = os.path.basename(pcfiles[0])
+                if match_pkg:
+                    match_pkg = os.path.splitext(match_pkg)[0]
+                break
+
+        retval = conf.check_cfg(package = match_pkg,
+                                args='--cflags --libs', mandatory=mandatory,
+                                msg="Checking for ns3-%s (%s)" % (module.lower(),
+                                                                  re.search("(ns[0-9][\.\-][dev0-9\.]+)",
+                                                                            match_pkg).group(0) if match_pkg else 'None'),
+                                uselib_store='NS3_%s' % module.upper())
+        if not retval is None:
+            # XXX pkg-config doesn't give the proper order of whole-archive option..
+            if conf.env['NS3_ENABLE_STATIC']:
+                libname = 'STLIB_ST_NS3_%s' % module.upper()
+                conf.env[libname] = '-l%s' % (match_pkg.replace('libns3', 'ns3'))
+                for lib in conf.env['LIB_NS3_%s' % module.upper()]:
+                    if 'ns3' in lib:
+                        conf.env.append_value(libname, '-l%s' % lib)
+
         if not retval is None:
             found.append(module)
+
     import copy
     if not 'NS3_MODULES_FOUND' in conf.env:
         conf.env['NS3_MODULES_FOUND'] = []