From 2d8aa104aaf9a2e229e31d13f6cdabf57a2e2e9a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 4 Oct 2023 23:11:03 -0400 Subject: [PATCH] search-paths: Add GCC search paths. * guix/search-paths.scm ($C_INCLUDE_PATH, $CPLUS_INCLUDE_PATH) ($LIBRARY_PATH, %gcc-search-paths): New variables. --- guix/search-paths.scm | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/guix/search-paths.scm b/guix/search-paths.scm index 8dc81861c9..5375fae34b 100644 --- a/guix/search-paths.scm +++ b/guix/search-paths.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2023 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,13 +33,18 @@ search-path-specification-file-type search-path-specification-file-pattern - $PATH + $CPLUS_INCLUDE_PATH + $C_INCLUDE_PATH + $LIBRARY_PATH $GUIX_EXTENSIONS_PATH + $PATH $PKG_CONFIG_PATH $SSL_CERT_DIR $SSL_CERT_FILE $TZDIR + %gcc-search-paths + search-path-specification->sexp sexp->search-path-specification string-tokenize* @@ -69,6 +75,33 @@ (file-pattern search-path-specification-file-pattern ;#f | string (default #f))) +(define $C_INCLUDE_PATH + (search-path-specification + (variable "CPLUS_INCLUDE_PATH") + ;; Add 'include/c++' here so that 's "#include_next + ;; " finds GCC's , not libc's. + (files '("include/c++" "include")))) + +(define $CPLUS_INCLUDE_PATH + (search-path-specification + (variable "C_INCLUDE_PATH") + (files '("include")))) + +(define $LIBRARY_PATH + (search-path-specification + (variable "LIBRARY_PATH") + (files '("lib" "lib64")))) + +(define %gcc-search-paths + ;; Use the language-specific variables rather than 'CPATH' because they + ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'. + ;; The intent is to allow headers that are in the search path to be + ;; treated as "system headers" (headers exempt from warnings) just like + ;; the typical /usr/include headers on an FHS system. + (list $C_INCLUDE_PATH + $CPLUS_INCLUDE_PATH + $LIBRARY_PATH)) + (define $PATH ;; The 'PATH' variable. This variable is a bit special: it is not attached ;; to any package in particular.