Makefile, bin/chroot-maint: Keep `/usr/local/include' mostly empty.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 9 May 2020 16:00:19 +0000 (17:00 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 9 May 2020 16:00:23 +0000 (17:00 +0100)
Oh, this is annoying.  GCC prefers `/usr/local/include/...' over
`/usr/include', so old versions of header files, e.g., from local
package builds, take precedence over system versions of the same headers
installed through APT, which obviously breaks `sbuild' builds.

Fix this by introducing a new `/usr/local/include.aside' directory where
headers actually live, and bind-mounting this into `/usr/local/include'
when we're actually trying to build a local package.

Makefile
bin/chroot-maint

index c9befaf..3b431a2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -604,7 +604,8 @@ $(foreach d,$(LOCAL_COMMON_DIRS) $(LOCAL_EXTRA_DIRS),$(LOCAL)/$d):
        $(V_AT)mkdir -p $(dir $(patsubst %/,%,$@))
        $(call v_tag,MKDIR)mkdir $@
 
-LOCAL_ARCH_DIRS                 = bin/ etc/ games/ include/ lib/ libexec/ sbin/
+LOCAL_ARCH_DIRS                 = bin/ etc/ games/ include/ include.aside/
+LOCAL_ARCH_DIRS                += lib/ libexec/ sbin/
 LOCAL_ARCH_LINKS        = man
 man_LINKDEST            = share/man
 all:: $(foreach a,$(ALL_ARCHS),\
index 4dba315..21e5c21 100755 (executable)
@@ -2669,6 +2669,11 @@ class PackageBuildJob (BaseJob):
       run_schroot_session(session,
                           ["mount", "-oremount,rw", "/usr/local.schroot"],
                           rootp = True, stdin = DISCARD)
+      run_schroot_session(session,
+                          ["mount", "--bind",
+                           "/usr/local.schroot/%s/include.aside" % arch,
+                           "/usr/local.schroot/%s/include" % arch],
+                          rootp = True, stdin = DISCARD)
 
       progress("configure `%s' %s for %s" % (pkg, ver, arch))
       run_schroot_session(session, ["sh", "-e", "-c", """