[PATCH v2 2/4] waf: Move glob operator ** to builder.py

Sichen Zhao 1473996754 at qq.com
Fri Aug 11 10:39:12 UTC 2017


From: Christian Mauderer <oss at c-mauderer.de>

This allows a finer decision which headers should be installed.
---
 builder.py       | 26 +++++++++++++-------------
 libbsd_waf.py    | 30 +++++++++++++++---------------
 waf_generator.py |  4 ++--
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/builder.py b/builder.py
index 1be1ced..04a5e49 100755
--- a/builder.py
+++ b/builder.py
@@ -220,20 +220,20 @@ def headerPaths():
     normal installation path. """
 
     #         local path                      wildcard             dest path
-    return [('rtemsbsd/include',              '*.h',               ''),
+    return [('rtemsbsd/include',              '**/*.h',            ''),
             ('rtemsbsd/mghttpd',              'mongoose.h',        'mghttpd'),
-            ('freebsd/include',               '*.h',               ''),
-            ('freebsd/sys/bsm',               '*.h',               'bsm'),
-            ('freebsd/sys/cam',               '*.h',               'cam'),
-            ('freebsd/sys/net',               '*.h',               'net'),
-            ('freebsd/sys/net80211',          '*.h',               'net80211'),
-            ('freebsd/sys/netinet',           '*.h',               'netinet'),
-            ('freebsd/sys/netinet6',          '*.h',               'netinet6'),
-            ('freebsd/sys/netipsec',          '*.h',               'netipsec'),
-            ('freebsd/sys/rpc',               '*.h',               'rpc'),
-            ('freebsd/sys/sys',               '*.h',               'sys'),
-            ('freebsd/sys/vm',                '*.h',               'vm'),
-            ('freebsd/sys/dev/mii',           '*.h',               'dev/mii'),
+            ('freebsd/include',               '**/*.h',            ''),
+            ('freebsd/sys/bsm',               '**/*.h',            'bsm'),
+            ('freebsd/sys/cam',               '**/*.h',            'cam'),
+            ('freebsd/sys/net',               '**/*.h',            'net'),
+            ('freebsd/sys/net80211',          '**/*.h',            'net80211'),
+            ('freebsd/sys/netinet',           '**/*.h',            'netinet'),
+            ('freebsd/sys/netinet6',          '**/*.h',            'netinet6'),
+            ('freebsd/sys/netipsec',          '**/*.h',            'netipsec'),
+            ('freebsd/sys/rpc',               '**/*.h',            'rpc'),
+            ('freebsd/sys/sys',               '**/*.h',            'sys'),
+            ('freebsd/sys/vm',                '**/*.h',            'vm'),
+            ('freebsd/sys/dev/mii',           '**/*.h',            'dev/mii'),
             ('mDNSResponder/mDNSCore',        'mDNSDebug.h',       ''),
             ('mDNSResponder/mDNSCore',        'mDNSEmbeddedAPI.h', ''),
             ('mDNSResponder/mDNSShared',      'dns_sd.h',          ''),
diff --git a/libbsd_waf.py b/libbsd_waf.py
index 8bc2b34..b681d7f 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -130,7 +130,7 @@ def build(bld):
     for headers in header_build_copy_paths:
         target = os.path.join("build-include", headers[2])
         start_dir = bld.path.find_dir(headers[0])
-        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):
+        for header in start_dir.ant_glob(headers[1]):
             relsourcepath = header.path_from(start_dir)
             targetheader = os.path.join(target, relsourcepath)
             bld(features = 'subst',
@@ -1481,20 +1481,20 @@ def build(bld):
 
     # Installs.    
     bld.install_files("${PREFIX}/" + rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION, bld.env.RTEMS_ARCH_BSP), ["libbsd.a"])
-    header_paths = [('rtemsbsd/include', '*.h', ''),
+    header_paths = [('rtemsbsd/include', '**/*.h', ''),
                      ('rtemsbsd/mghttpd', 'mongoose.h', 'mghttpd'),
-                     ('freebsd/include', '*.h', ''),
-                     ('freebsd/sys/bsm', '*.h', 'bsm'),
-                     ('freebsd/sys/cam', '*.h', 'cam'),
-                     ('freebsd/sys/net', '*.h', 'net'),
-                     ('freebsd/sys/net80211', '*.h', 'net80211'),
-                     ('freebsd/sys/netinet', '*.h', 'netinet'),
-                     ('freebsd/sys/netinet6', '*.h', 'netinet6'),
-                     ('freebsd/sys/netipsec', '*.h', 'netipsec'),
-                     ('freebsd/sys/rpc', '*.h', 'rpc'),
-                     ('freebsd/sys/sys', '*.h', 'sys'),
-                     ('freebsd/sys/vm', '*.h', 'vm'),
-                     ('freebsd/sys/dev/mii', '*.h', 'dev/mii'),
+                     ('freebsd/include', '**/*.h', ''),
+                     ('freebsd/sys/bsm', '**/*.h', 'bsm'),
+                     ('freebsd/sys/cam', '**/*.h', 'cam'),
+                     ('freebsd/sys/net', '**/*.h', 'net'),
+                     ('freebsd/sys/net80211', '**/*.h', 'net80211'),
+                     ('freebsd/sys/netinet', '**/*.h', 'netinet'),
+                     ('freebsd/sys/netinet6', '**/*.h', 'netinet6'),
+                     ('freebsd/sys/netipsec', '**/*.h', 'netipsec'),
+                     ('freebsd/sys/rpc', '**/*.h', 'rpc'),
+                     ('freebsd/sys/sys', '**/*.h', 'sys'),
+                     ('freebsd/sys/vm', '**/*.h', 'vm'),
+                     ('freebsd/sys/dev/mii', '**/*.h', 'dev/mii'),
                      ('mDNSResponder/mDNSCore', 'mDNSDebug.h', ''),
                      ('mDNSResponder/mDNSCore', 'mDNSEmbeddedAPI.h', ''),
                      ('mDNSResponder/mDNSShared', 'dns_sd.h', ''),
@@ -1503,7 +1503,7 @@ def build(bld):
         ipath = os.path.join(rtems.arch_bsp_include_path(bld.env.RTEMS_VERSION, bld.env.RTEMS_ARCH_BSP), headers[2])
         start_dir = bld.path.find_dir(headers[0])
         bld.install_files("${PREFIX}/" + ipath,
-                          start_dir.ant_glob("**/" + headers[1]),
+                          start_dir.ant_glob(headers[1]),
                           cwd = start_dir,
                           relative_trick = True)
 
diff --git a/waf_generator.py b/waf_generator.py
index fdc2210..8aa2e29 100755
--- a/waf_generator.py
+++ b/waf_generator.py
@@ -457,7 +457,7 @@ class ModuleManager(builder.ModuleManager):
         self.add('    for headers in header_build_copy_paths:')
         self.add('        target = os.path.join("%s", headers[2])' % (builder.buildInclude()))
         self.add('        start_dir = bld.path.find_dir(headers[0])')
-        self.add('        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):')
+        self.add('        for header in start_dir.ant_glob(headers[1]):')
         self.add('            relsourcepath = header.path_from(start_dir)')
         self.add('            targetheader = os.path.join(target, relsourcepath)')
         self.add('            bld(features = \'subst\',')
@@ -648,7 +648,7 @@ class ModuleManager(builder.ModuleManager):
         self.add('        ipath = os.path.join(rtems.arch_bsp_include_path(bld.env.RTEMS_VERSION, bld.env.RTEMS_ARCH_BSP), headers[2])')
         self.add('        start_dir = bld.path.find_dir(headers[0])')
         self.add('        bld.install_files("${PREFIX}/" + ipath,')
-        self.add('                          start_dir.ant_glob("**/" + headers[1]),')
+        self.add('                          start_dir.ant_glob(headers[1]),')
         self.add('                          cwd = start_dir,')
         self.add('                          relative_trick = True)')
         self.add('')
-- 
2.7.4






More information about the devel mailing list