summaryrefslogtreecommitdiffstats
path: root/waf_generator.py
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2017-08-11 07:27:12 +0200
committerChris Johns <chrisj@rtems.org>2017-08-20 08:35:04 +1000
commit307b324a4268f8e9fec19ac96b810d76912cf132 (patch)
treee8d251392b7d372e624401b14da4ccb6ca325b35 /waf_generator.py
parentEnable the WEP encrypted WiFi. (diff)
downloadrtems-libbsd-307b324a4268f8e9fec19ac96b810d76912cf132.tar.bz2
waf_generator: Copy headers if necessary.
There are some cases, where a header is installed into a directory with a different name then it's source directory. In that case, the build might fail because the header is not found. One example would be the <openssl/opensslv.h>. The source for this file is in freebsd/crypto/openssl/crypto/opensslv.h. To allow the build to work in such cases too, copy such files into a temporary location in the build tree.
Diffstat (limited to 'waf_generator.py')
-rwxr-xr-xwaf_generator.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/waf_generator.py b/waf_generator.py
index 35fe35f4..fdc2210f 100755
--- a/waf_generator.py
+++ b/waf_generator.py
@@ -392,7 +392,7 @@ class ModuleManager(builder.ModuleManager):
self.add(' if bld.get_env()["RTEMS_ARCH"] == "i386":')
self.add(' for i in %r:' % (builder.cpuIncludes()))
self.add(' includes += ["%s" % (i[2:].replace("@CPU@", "x86"))]')
- for i in builder.includes():
+ for i in builder.includes() + ['-I' + builder.buildInclude()]:
self.add(' includes += ["%s"]' % (i[2:]))
self.add('')
self.add(' # Collect the libbsd uses')
@@ -445,6 +445,28 @@ class ModuleManager(builder.ModuleManager):
self.add('')
#
+ # Add a copy rule for all headers where the install path and the source
+ # path are not the same.
+ #
+ self.add(' # copy headers if necessary')
+ self.add(' header_build_copy_paths = [')
+ for hp in builder.headerPaths():
+ if hp[2] != '' and not hp[0].endswith(hp[2]):
+ self.add(' %s,' % (str(hp)))
+ self.add(' ]')
+ 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(' relsourcepath = header.path_from(start_dir)')
+ self.add(' targetheader = os.path.join(target, relsourcepath)')
+ self.add(' bld(features = \'subst\',')
+ self.add(' target = targetheader,')
+ self.add(' source = header,')
+ self.add(' is_copy = True)')
+ self.add('')
+
+ #
# Add the specific rule based builders for generating files.
#
if 'KVMSymbols' in data: