Add Copy headers support for RTEMS-libbsd(Christian Mauderer's work)

When i import some files from FreeBSD to RTEMS-libbsd, there are a issues: 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.
So for this bug, my mentor Christian Mauderer fix it by copy these files in a temporary catalog.


1. Add a temporary catalog in builder.py


def includes():
      return ['-Irtemsbsd/include',
 +            '-Ilibbsd_build/include',
              '-Ifreebsd/sys',
              '-Ifreebsd/sys/contrib/pf',
              '-Ifreebsd/sys/net',


2. Add the copy method in waf_generator.py


#
# 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')
headerPaths = builder.headerPaths()
self.add(' header_build_copy_paths = [')
for hp in 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("libbsd_build/include", headers[2])')
self.add(' start_dir = bld.path.find_dir(headers[0])')
self.add(' for header in start_dir.ant_glob("**/" + headers[1]):')
self.add(' relsourcepath = os.path.relpath(str(header), start=str(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('')


So if the imported files installed into a directory with a different name then it's source directory, then this files will be copied into build/arm-rtems4.12-beagleboneblack/libbsd_build/include folder.


评论

此博客中的热门博文

RTEMS Network Transplantation - rtems system initialization process analysis

RTEMS-libbsd generates drive device firmware

Add wpa_supplicant_fork command on RTEMS-libbsd