]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
webkitgtk: fix compile error when len(TMPDIR) == 410
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 20 Nov 2017 07:05:26 +0000 (15:05 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Thu, 30 Nov 2017 01:27:27 +0000 (09:27 +0800)
One of the gcc command line was too long (longer than 160,000 characters) when
len(TMPDIR) == 410, so there was an "Argument list too long" error:
$ bitbake webkitgtk
i586-poky-linux-g++: error trying to exec [snip] execv: Argument list too long

The cmake doesn't support relative path, so we have to edit flags.make to fix
the problem:
- Replace -I${RECIPE_SYSROOT} with -I=
- Replace "-I${S}/path1/in/S -I ${S}/path2/in/S" with
  "-iprefix ${S} -iwithprefixbefore /path1/in/S -iwithprefixbefore /path2/in/S"

Now the length is less than 25,000.

[YOCTO #12362]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
meta/recipes-sato/webkit/webkitgtk_2.16.6.bb

index 0f126cba81347f28703c47c9e9015bbd1df1d8d4..3ff5425d61b067f10c45cbf0d3005ecb2ebeaf95 100644 (file)
@@ -117,3 +117,30 @@ ARM_INSTRUCTION_SET_armv7ve = "thumb"
 # Segmentation fault
 GI_DATA_ENABLED_armv7a = "False"
 GI_DATA_ENABLED_armv7ve = "False"
+
+do_configure[postfuncs] += 'shorter_flags_make'
+
+python shorter_flags_make() {
+    recipe_sysroot = d.getVar('RECIPE_SYSROOT')
+    for root, dirs, files in os.walk(d.getVar('B')):
+        for flags_make in files:
+            if flags_make == 'flags.make':
+                # To fix build error when len(TMPDIR) == 410:
+                # - Replace -I${RECIPE_SYSROOT} with -I=
+                # - Replace "-I${S}/path1/in/S -I ${S}/path2/in/S" with
+                #   "-iprefix ${S} -iwithprefixbefore /path1/in/S -iwithprefixbefore /path2/in/S"
+                flags_make = os.path.join(root, flags_make)
+                new_lines = []
+                with open(flags_make, 'r') as f:
+                    for line in f.readlines():
+                        if line.startswith('CXX_INCLUDES = ') or line.startswith('C_INCLUDES = '):
+                            line = line.replace('-I%s' % recipe_sysroot, '-I=')
+                            line = line.replace('CXX_INCLUDES =', 'CXX_INCLUDES = -iprefix %s/ ' % d.getVar('S'))
+                            line = line.replace('C_INCLUDES =', 'C_INCLUDES = -iprefix %s/ ' % d.getVar('S'))
+                            line = line.replace('-I%s' % d.getVar('S'), '-iwithprefixbefore ')
+                        new_lines.append(line)
+
+                with open(flags_make, 'w') as f:
+                        for line in new_lines:
+                            f.write(line)
+}