Subject: bug#49815: [PATCH] build-system/scons: Set $CPPPATH

From: Thiago Jung Bauermann <[email-masked]>
Date: Fri, 6 Aug 2021 19:55:17 -0300

The SCons build system sets the compiler include path from the $CPPPATH
environment variable while GCC and Guix use $C_INCLUDE_PATH, so set the
former with the value of the latter.

* guix/build/scons-build-system.scm (build): Set $CPPPATH from
$C_INCLUDE_PATH.
---

Hi Leo,

I was able to build your patch using this one.

Thanks,
Thiago

 guix/build/scons-build-system.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/guix/build/scons-build-system.scm b/guix/build/scons-build-system.scm
index 17a0b7b877e6..fa422c41a172 100644
--- a/guix/build/scons-build-system.scm
+++ b/guix/build/scons-build-system.scm
@@ -20,6 +20,7 @@
 (define-module (guix build scons-build-system)
   #:use-module ((guix build gnu-build-system) #:prefix gnu:)
   #:use-module (guix build utils)
+  #:use-module (srfi srfi-26)
   #:export (%standard-phases
             scons-build))
 
@@ -32,6 +33,10 @@
 (define* (build #:key outputs (build-targets '()) (scons-flags '()) (parallel-build? #t) #:allow-other-keys)
   (let ((out (assoc-ref outputs "out")))
     (mkdir-p out)
+    ;; SCons expects the include path in $CPPPATH, so copy from
+    ;; $C_INCLUDE_PATH.
+    (let ((c-include-path (getenv "C_INCLUDE_PATH")))
+      (and=> c-include-path (cut setenv "CPPPATH" <>)))
     (apply invoke "scons"
            (append (if parallel-build?
                        (list "-j" (number->string