Re: [PATCH v2 1/4] waf_generator: Copy headers if necessary.

2017-08-11 Thread Chris Johns
On 12/08/2017 13:30, Sichen Zhao wrote:
>>> +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])):
>> Remove the '/':
>>
>> for header in start_dir.ant_glob(os.path.join("**", headers[1])):
>>
>> OK to push once fixed.
>>
>> Chris
> This already done in the PATCH v2 2/4.
> -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]):')

Excellent. These patches look good. Christian let me know if you want me to do 
this?

Thanks for your hard work.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v2 1/4] waf_generator: Copy headers if necessary.

2017-08-11 Thread Sichen Zhao
> On 11/8/17 8:39 pm, Sichen Zhao wrote:
>> From: Christian Mauderer 
>>
>> 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
>> . 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.
>> ---
>>   builder.py   | 14 ++
>>   libbsd_waf.py| 15 +++
>>   waf_generator.py | 24 +++-
>>   3 files changed, 52 insertions(+), 1 deletion(-)
>>
>> diff --git a/builder.py b/builder.py
>> index bb633cb..1be1ced 100755
>> --- a/builder.py
>> +++ b/builder.py
>> @@ -194,6 +194,10 @@ def includes():
>>   '-ImDNSResponder/mDNSPosix',
>>   '-Itestsuite/include']
>>   
>> +def buildInclude():
>> +""" Returns the path where headers will be copied during build. """
>> +return 'build-include'
>> +
>>   def cpuIncludes():
>>   return ['-Irtemsbsd/@CPU@/include',
>>   '-Ifreebsd/sys/@CPU@/include']
>> @@ -205,6 +209,16 @@ def cxxflags():
>>   return []
>>   
>>   def headerPaths():
>> +""" Returns a list of information about what header files should be
>> +installed.
>> +
>> +The list is also used to find headers with a local path that doesn't 
>> match
>> +it's dest path. Due to the difference in the path name such files are
>> +problematic during the build if they are included using their later
>> +installation path (dest path) name. Therefore they are copied into a
>> +sub-directory of the build path so that they can be included with their
>> +normal installation path. """
>> +
>>   # local path  wildcard dest 
>> path
>>   return [('rtemsbsd/include',  '*.h',   ''),
>>   ('rtemsbsd/mghttpd',  'mongoose.h',
>> 'mghttpd'),
>> diff --git a/libbsd_waf.py b/libbsd_waf.py
>> index aee2e7a..8bc2b34 100644
>> --- a/libbsd_waf.py
>> +++ b/libbsd_waf.py
>> @@ -83,6 +83,7 @@ def build(bld):
>>   includes += ["mDNSResponder/mDNSShared"]
>>   includes += ["mDNSResponder/mDNSPosix"]
>>   includes += ["testsuite/include"]
>> +includes += ["build-include"]
>>   
>>   # Collect the libbsd uses
>>   libbsd_use = []
>> @@ -123,6 +124,20 @@ def build(bld):
>>   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),
>>   update_outputs = True)
>>   
>> +# copy headers if necessary
>> +header_build_copy_paths = [
>> +  ]
>> +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])):
> Remove the '/':
>
> for header in start_dir.ant_glob(os.path.join("**", headers[1])):
>
> OK to push once fixed.
>
> Chris
This already done in the PATCH v2 2/4.
-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]):')
>
>> +relsourcepath = header.path_from(start_dir)
>> +targetheader = os.path.join(target, relsourcepath)
>> +bld(features = 'subst',
>> +target = targetheader,
>> +source = header,
>> +is_copy = True)
>> +
>>   # KVM Symbols
>>   bld(target = "rtemsbsd/rtems/rtems-kernel-kvm-symbols.c",
>>   source = "rtemsbsd/rtems/generate_kvm_symbols",
>> diff --git a/waf_generator.py b/waf_generator.py
>> index 35fe35f..fdc2210 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')
>> 

Re: [PATCH v2 1/4] waf_generator: Copy headers if necessary.

2017-08-11 Thread Chris Johns
On 11/8/17 8:39 pm, Sichen Zhao wrote:
> From: Christian Mauderer 
> 
> 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
> . 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.
> ---
>  builder.py   | 14 ++
>  libbsd_waf.py| 15 +++
>  waf_generator.py | 24 +++-
>  3 files changed, 52 insertions(+), 1 deletion(-)
> 
> diff --git a/builder.py b/builder.py
> index bb633cb..1be1ced 100755
> --- a/builder.py
> +++ b/builder.py
> @@ -194,6 +194,10 @@ def includes():
>  '-ImDNSResponder/mDNSPosix',
>  '-Itestsuite/include']
>  
> +def buildInclude():
> +""" Returns the path where headers will be copied during build. """
> +return 'build-include'
> +
>  def cpuIncludes():
>  return ['-Irtemsbsd/@CPU@/include',
>  '-Ifreebsd/sys/@CPU@/include']
> @@ -205,6 +209,16 @@ def cxxflags():
>  return []
>  
>  def headerPaths():
> +""" Returns a list of information about what header files should be
> +installed.
> +
> +The list is also used to find headers with a local path that doesn't 
> match
> +it's dest path. Due to the difference in the path name such files are
> +problematic during the build if they are included using their later
> +installation path (dest path) name. Therefore they are copied into a
> +sub-directory of the build path so that they can be included with their
> +normal installation path. """
> +
>  # local path  wildcard dest path
>  return [('rtemsbsd/include',  '*.h',   ''),
>  ('rtemsbsd/mghttpd',  'mongoose.h',
> 'mghttpd'),
> diff --git a/libbsd_waf.py b/libbsd_waf.py
> index aee2e7a..8bc2b34 100644
> --- a/libbsd_waf.py
> +++ b/libbsd_waf.py
> @@ -83,6 +83,7 @@ def build(bld):
>  includes += ["mDNSResponder/mDNSShared"]
>  includes += ["mDNSResponder/mDNSPosix"]
>  includes += ["testsuite/include"]
> +includes += ["build-include"]
>  
>  # Collect the libbsd uses
>  libbsd_use = []
> @@ -123,6 +124,20 @@ def build(bld):
>  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),
>  update_outputs = True)
>  
> +# copy headers if necessary
> +header_build_copy_paths = [
> +  ]
> +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])):

Remove the '/':

   for header in start_dir.ant_glob(os.path.join("**", headers[1])):

OK to push once fixed.

Chris

> +relsourcepath = header.path_from(start_dir)
> +targetheader = os.path.join(target, relsourcepath)
> +bld(features = 'subst',
> +target = targetheader,
> +source = header,
> +is_copy = True)
> +
>  # KVM Symbols
>  bld(target = "rtemsbsd/rtems/rtems-kernel-kvm-symbols.c",
>  source = "rtemsbsd/rtems/generate_kvm_symbols",
> diff --git a/waf_generator.py b/waf_generator.py
> index 35fe35f..fdc2210 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:')
> +

Re: Patch preparation for GSoC evaluation

2017-08-11 Thread Christian Mauderer
Am 11.08.2017 um 17:24 schrieb Denis Obrezkov:
> 2017-08-11 17:17 GMT+02:00 Christian Mauderer  >:
> 
> Am 11.08.2017 um 12:14 schrieb Denis Obrezkov:
> > 2017-08-11 11:53 GMT+02:00 Sebastian Huber
> >  
> >  >>:
> >
> > On 11/08/17 11:44, Denis Obrezkov wrote:
> >
> > during our last meeting I didn't completely understand what to 
> do
> > with my commits.
> >
> > I have a set of commits made during the GSoC, they are, of 
> course,
> > a bit chaotic. And the only last few commits make my code look
> > better.
> > So, I have a question: should I take all my commits,
> > merge them into one big commit which changes the state of the 
> code
> > from the initial to the current state? Or how should I clean my
> > commit history?
> >
> >
> > Ideally, there should be a patch set, that can be integrated into
> > RTEMS with clean, self-contained, well described and easy to review
> > patches.
> >
> > --
> > Sebastian Huber, embedded brains GmbH
> >
> > Address : Dornierstr. 4, D-82178 Puchheim, Germany
> > Phone   : +49 89 189 47 41-16
>  
> > Fax : +49 89 189 47 41-09
>  
> > E-Mail  : sebastian.hu...@embedded-brains.de
> 
> >  >
> > PGP : Public key available on request.
> >
> > Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des 
> EHUG.
> >
> >
> > Would it be appropriate to provide a set of patches, for example,
> > for uart, clock and linkcmd related code, but without saving a commit
> > history?
> > I mean - to make a git reset --mixed and then make new commits with
> > relatively
> > clean code.
> > > --
> > Regards, Denis Obrezkov
> >
> 
> Hello Denis,
> 
> if I understood you correct, that would be the right form for your
> patches. Just remember that you must never change a commit that is
> already in the public master branch. So as long as you are in your own
> development repository you can merge patches. Like Sebastian said, the
> final patches should be compilable, readable and contain only one
> feature.
> 
> It's good practice to do the rework of the patches on an extra branch or
> rename the old branch so that it is still there for reference.
> 
> Let me shortly describe my typical workflow. Maybe that makes it clear:
> 
> If I implement a new feature, the first for me is to create a branch. If
> you haven't done that, that is no problem. Then your branch is just your
> local "master".
> 
> I then make a lot of intermediate commits. Most of the time, the commit
> message is just a rough note for myself, what I have done. Often it's
> quite short. Something like "FIXME: Partial function xyz()." If you
> would check out any of them, a lot wouldn't even compile.
> 
> As soon as my feature is done, I create a new branch from that (so I can
> keep the old for backup) and then I start to reorder and squash the
> commits on this new branch together. My preferred method for that is a
> "git rebase origin/master" (or on top of the commit before I branched
> the feature). If something goes wrong during the rebase (which happens
> more often then I would like) I just check out my old backup branch and
> do the rebase again.
> 
> Most of the time, I check the result of the rebase with a "git diff
> my-old-branch" to make sure I didn't loose any changes.
> 
> After the rebase, I have only very few (often only one or two) commits
> left. All of these commits should be compilable. Every commit contains a
> set of changes that belongs together. It's quite possible that it is
> only one patch that adds exactly one driver without the whole history
> how I developed that driver. That patch will be sent to the mailing
> list.
> 
> That works quite well for a feature that is developed by a single
> person. There are some other cases too:
> 
> If you imported some files from other sources, you should check in these
> sources unchanged in one commit (ideally don't add them to a Makefile or
> similar so that the whole tree is still compilable) and then add your
> changes and enable the compile process in a separate one. So it is easy
> to see what 

[PATCH v2 4/4] Port openssl to RTEMS.

2017-08-11 Thread Sichen Zhao
---
 builder.py   |  58 
 libbsd.py| 952 +++
 libbsd_waf.py| 901 +++-
 waf_generator.py |   3 +
 4 files changed, 1898 insertions(+), 16 deletions(-)

diff --git a/builder.py b/builder.py
index 04a5e49..b62f79d 100755
--- a/builder.py
+++ b/builder.py
@@ -230,6 +230,64 @@ def headerPaths():
 ('freebsd/sys/netinet',   '**/*.h','netinet'),
 ('freebsd/sys/netinet6',  '**/*.h','netinet6'),
 ('freebsd/sys/netipsec',  '**/*.h','netipsec'),
+('freebsd/crypto/openssl','*.h',   'openssl'),
+('freebsd/crypto/openssl/crypto', '*.h',   'openssl'),
+('freebsd/crypto/openssl/ssl','(ssl|kssl|ssl2).h', 'openssl'),
+('freebsd/crypto/openssl/crypto/aes', 'aes.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/err', 'err.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/bio', '*.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/dsa', '*.h',   'openssl'),
+('freebsd/crypto/openssl/ssl','*.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/bn',  'bn.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/x509',  'x509.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/cast',  'cast.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/lhash', 'lhash.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/ecdh',  'ecdh.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/ecdsa', 'ecdsa.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/idea',  'idea.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/mdc2',  'mdc2.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/md4',   'md4.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/md5',   'md5.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/rc2',   'rc2.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/rc4',   'rc4.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/ripemd','ripemd.h','openssl'),
+('freebsd/crypto/openssl/crypto/seed',  'seed.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/sha',   'sha.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/x509v3','x509v3.h','openssl'),
+('freebsd/crypto/openssl/crypto/x509',  'x509_vfy.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/buffer','buffer.h','openssl'),
+('freebsd/crypto/openssl/crypto/comp',  'comp.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/asn1',  'asn1_mac.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/pem',  '(pem|pem2).h', 'openssl'),
+('freebsd/crypto/openssl/crypto/rsa',   'rsa.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/evp',   'evp.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/ec','ec.h','openssl'),
+('freebsd/crypto/openssl/crypto/engine', 'engine.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/pkcs7', 'pkcs7.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/hmac',  'hmac.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/pqueue', 'pqueue.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/ocsp',  'ocsp.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/rand',  'rand.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/srp',   'srp.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/dh','dh.h','openssl'),
+('freebsd/crypto/openssl/crypto/dso',   'dso.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/krb5',  'krb5_asn.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/cms',   'cms.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/txt_db', 'txt_db.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/ts','ts.h','openssl'),
+('freebsd/crypto/openssl/crypto/modes', 'modes.h', 'openssl'),
+('freebsd/crypto/openssl/crypto/pkcs12', 'pkcs12.h',   'openssl'),
+('freebsd/crypto/openssl/crypto/bf','blowfish.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/cmac',  'cmac.h',  'openssl'),
+('freebsd/crypto/openssl/crypto/asn1',  '(asn1|asn1t).h',  
  'openssl'),
+('freebsd/crypto/openssl/crypto/camellia', 'camellia.h',   
  'openssl'),
+('freebsd/crypto/openssl/crypto/objects',  '(objects|obj_mac).h',  
  'openssl'),
+('freebsd/crypto/openssl/crypto/conf', '(conf|conf_api).h',
  'openssl'),
+

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

2017-08-11 Thread Sichen Zhao
From: Christian Mauderer 

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'),
+ 

[PATCH v2 1/4] waf_generator: Copy headers if necessary.

2017-08-11 Thread Sichen Zhao
From: Christian Mauderer 

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
. 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.
---
 builder.py   | 14 ++
 libbsd_waf.py| 15 +++
 waf_generator.py | 24 +++-
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/builder.py b/builder.py
index bb633cb..1be1ced 100755
--- a/builder.py
+++ b/builder.py
@@ -194,6 +194,10 @@ def includes():
 '-ImDNSResponder/mDNSPosix',
 '-Itestsuite/include']
 
+def buildInclude():
+""" Returns the path where headers will be copied during build. """
+return 'build-include'
+
 def cpuIncludes():
 return ['-Irtemsbsd/@CPU@/include',
 '-Ifreebsd/sys/@CPU@/include']
@@ -205,6 +209,16 @@ def cxxflags():
 return []
 
 def headerPaths():
+""" Returns a list of information about what header files should be
+installed.
+
+The list is also used to find headers with a local path that doesn't match
+it's dest path. Due to the difference in the path name such files are
+problematic during the build if they are included using their later
+installation path (dest path) name. Therefore they are copied into a
+sub-directory of the build path so that they can be included with their
+normal installation path. """
+
 # local path  wildcard dest path
 return [('rtemsbsd/include',  '*.h',   ''),
 ('rtemsbsd/mghttpd',  'mongoose.h','mghttpd'),
diff --git a/libbsd_waf.py b/libbsd_waf.py
index aee2e7a..8bc2b34 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -83,6 +83,7 @@ def build(bld):
 includes += ["mDNSResponder/mDNSShared"]
 includes += ["mDNSResponder/mDNSPosix"]
 includes += ["testsuite/include"]
+includes += ["build-include"]
 
 # Collect the libbsd uses
 libbsd_use = []
@@ -123,6 +124,20 @@ def build(bld):
 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),
 update_outputs = True)
 
+# copy headers if necessary
+header_build_copy_paths = [
+  ]
+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])):
+relsourcepath = header.path_from(start_dir)
+targetheader = os.path.join(target, relsourcepath)
+bld(features = 'subst',
+target = targetheader,
+source = header,
+is_copy = True)
+
 # KVM Symbols
 bld(target = "rtemsbsd/rtems/rtems-kernel-kvm-symbols.c",
 source = "rtemsbsd/rtems/generate_kvm_symbols",
diff --git a/waf_generator.py b/waf_generator.py
index 35fe35f..fdc2210 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, 

Re: Patch preparation for GSoC evaluation

2017-08-11 Thread Denis Obrezkov
2017-08-11 11:53 GMT+02:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

> On 11/08/17 11:44, Denis Obrezkov wrote:
>
> during our last meeting I didn't completely understand what to do
>> with my commits.
>>
>> I have a set of commits made during the GSoC, they are, of course,
>> a bit chaotic. And the only last few commits make my code look better.
>> So, I have a question: should I take all my commits,
>> merge them into one big commit which changes the state of the code
>> from the initial to the current state? Or how should I clean my commit
>> history?
>>
>
> Ideally, there should be a patch set, that can be integrated into RTEMS
> with clean, self-contained, well described and easy to review patches.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
Would it be appropriate to provide a set of patches, for example,
for uart, clock and linkcmd related code, but without saving a commit
history?
I mean - to make a git reset --mixed and then make new commits with
relatively
clean code.

-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Patch preparation for GSoC evaluation

2017-08-11 Thread Sebastian Huber

On 11/08/17 11:44, Denis Obrezkov wrote:


during our last meeting I didn't completely understand what to do
with my commits.

I have a set of commits made during the GSoC, they are, of course,
a bit chaotic. And the only last few commits make my code look better.
So, I have a question: should I take all my commits,
merge them into one big commit which changes the state of the code
from the initial to the current state? Or how should I clean my commit 
history?


Ideally, there should be a patch set, that can be integrated into RTEMS 
with clean, self-contained, well described and easy to review patches.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Patch preparation for GSoC evaluation

2017-08-11 Thread Denis Obrezkov
Hello all,

during our last meeting I didn't completely understand what to do
with my commits.

I have a set of commits made during the GSoC, they are, of course,
a bit chaotic. And the only last few commits make my code look better.
So, I have a question: should I take all my commits,
merge them into one big commit which changes the state of the code
from the initial to the current state? Or how should I clean my commit
history?

-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel