Changeset 307b324 in rtems-libbsd


Ignore:
Timestamp:
Aug 11, 2017, 5:27:12 AM (2 years ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
5283630d2c9d40deb0183696d278e02644fe4326, bc2ba9a9cdc7381c2a4f2ae6ee303be636f31368
Children:
8d2dbd3
Parents:
097ccba
git-author:
Christian Mauderer <christian.mauderer@…> (08/11/17 05:27:12)
git-committer:
Chris Johns <chrisj@…> (08/19/17 22:35:04)
Message:

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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • builder.py

    r097ccba r307b324  
    195195            '-Itestsuite/include']
    196196
     197def buildInclude():
     198    """ Returns the path where headers will be copied during build. """
     199    return 'build-include'
     200
    197201def cpuIncludes():
    198202    return ['-Irtemsbsd/@CPU@/include',
     
    206210
    207211def headerPaths():
     212    """ Returns a list of information about what header files should be
     213    installed.
     214
     215    The list is also used to find headers with a local path that doesn't match
     216    it's dest path. Due to the difference in the path name such files are
     217    problematic during the build if they are included using their later
     218    installation path (dest path) name. Therefore they are copied into a
     219    sub-directory of the build path so that they can be included with their
     220    normal installation path. """
     221
    208222    #         local path                      wildcard             dest path
    209223    return [('rtemsbsd/include',              '*.h',               ''),
  • libbsd_waf.py

    r097ccba r307b324  
    8484    includes += ["mDNSResponder/mDNSPosix"]
    8585    includes += ["testsuite/include"]
     86    includes += ["build-include"]
    8687
    8788    # Collect the libbsd uses
     
    123124        rule = "sed -e 's/@NET_CFG_SELF_IP@/%s/' -e 's/@NET_CFG_NETMASK@/%s/' -e 's/@NET_CFG_PEER_IP@/%s/' -e 's/@NET_CFG_GATEWAY_IP@/%s/' < ${SRC} > ${TGT}" % (net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_gateway_ip),
    124125        update_outputs = True)
     126
     127    # copy headers if necessary
     128    header_build_copy_paths = [
     129                              ]
     130    for headers in header_build_copy_paths:
     131        target = os.path.join("build-include", headers[2])
     132        start_dir = bld.path.find_dir(headers[0])
     133        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):
     134            relsourcepath = header.path_from(start_dir)
     135            targetheader = os.path.join(target, relsourcepath)
     136            bld(features = 'subst',
     137                target = targetheader,
     138                source = header,
     139                is_copy = True)
    125140
    126141    # KVM Symbols
  • waf_generator.py

    r097ccba r307b324  
    393393        self.add('        for i in %r:' % (builder.cpuIncludes()))
    394394        self.add('            includes += ["%s" % (i[2:].replace("@CPU@", "x86"))]')
    395         for i in builder.includes():
     395        for i in builder.includes() + ['-I' + builder.buildInclude()]:
    396396            self.add('    includes += ["%s"]' % (i[2:]))
    397397        self.add('')
     
    446446
    447447        #
     448        # Add a copy rule for all headers where the install path and the source
     449        # path are not the same.
     450        #
     451        self.add('    # copy headers if necessary')
     452        self.add('    header_build_copy_paths = [')
     453        for hp in builder.headerPaths():
     454            if hp[2] != '' and not hp[0].endswith(hp[2]):
     455                self.add('                               %s,' % (str(hp)))
     456        self.add('                              ]')
     457        self.add('    for headers in header_build_copy_paths:')
     458        self.add('        target = os.path.join("%s", headers[2])' % (builder.buildInclude()))
     459        self.add('        start_dir = bld.path.find_dir(headers[0])')
     460        self.add('        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):')
     461        self.add('            relsourcepath = header.path_from(start_dir)')
     462        self.add('            targetheader = os.path.join(target, relsourcepath)')
     463        self.add('            bld(features = \'subst\',')
     464        self.add('                target = targetheader,')
     465        self.add('                source = header,')
     466        self.add('                is_copy = True)')
     467        self.add('')
     468
     469        #
    448470        # Add the specific rule based builders for generating files.
    449471        #
Note: See TracChangeset for help on using the changeset viewer.