[Mesa-dev] [PATCH] scons: do not include headers when parsing the sources lists

Jose Fonseca jfonseca at vmware.com
Wed Aug 13 06:08:34 PDT 2014


On 13/08/14 13:38, Emil Velikov wrote:
> Modify oour custom function/method SourceListParser to avoid including
> headers to the sources list. The SCons documentation is not explicit on
> the topic yet building mesa with SCons and MSVC is known to have
> problems when headers are listed. So be safe just drop them for now.
>
> Bugzilla: https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D82534&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=bSAxUvr%2BkZFQrdOVPzHXFpuKRlYsjbOdppwDtQwMYV4%3D%0A&s=eafc5db76341cca1e444f46c18e5d3a29e51cac22ff52f018621406a72291954
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>   scons/source_list.py | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/scons/source_list.py b/scons/source_list.py
> index e16d1f9..5a1bd96 100644
> --- a/scons/source_list.py
> +++ b/scons/source_list.py
> @@ -85,6 +85,9 @@ class SourceListParser(object):
>           """Parse a source list line."""
>           # more lines to come
>           if line and line[-1] == '\\':
> +            # do not include any headers
> +            if line[:-1].rstrip().endswith('.h'):
> +                return 0;
>               # spaces around "\\\n" are replaced by a single space
>               if self.line_cont:
>                   self.line_cont += line[:-1].strip() + ' '
> @@ -94,7 +97,11 @@ class SourceListParser(object):
>
>           # combine with previous lines
>           if self.line_cont:
> -            line = self.line_cont + line.lstrip()
> +            # do not include any headers
> +            if line and line.rstrip().endswith('.h'):
> +                line = self.line_cont
> +            else:
> +                line = self.line_cont + line.lstrip()
>               self.line_cont = ''
>
>           if line:
>

I think that scons/custom.py is a better place for this manipulation. 
There are a bunch of similarly natured maniuplations there already:


diff --git a/scons/custom.py b/scons/custom.py
index 09c937e..88a0d34 100644
--- a/scons/custom.py
+++ b/scons/custom.py
@@ -276,6 +276,9 @@ def parse_source_list(env, filename, names=None):
                      # Prefer relative source paths, as absolute files 
tend to
                      # cause duplicate actions.
                      f = f[len(cur_srcdir + '/'):]
+                # do not include any headers
+                if f.endswith('.h'):
+                    continue
                  srcs.append(f)

          src_lists[sym] = srcs


Jose


More information about the mesa-dev mailing list