aboutsummaryrefslogtreecommitdiff
path: root/guix/search-paths.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-10-04 23:11:03 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-10-04 23:30:41 -0400
commit2d8aa104aaf9a2e229e31d13f6cdabf57a2e2e9a (patch)
tree08df915aa7641d5961ffad2b0a5636d1dd48ad4a /guix/search-paths.scm
parent20df2ee697bb5057a476a926a363d71cc8944c84 (diff)
downloadguix-2d8aa104aaf9a2e229e31d13f6cdabf57a2e2e9a.tar
guix-2d8aa104aaf9a2e229e31d13f6cdabf57a2e2e9a.tar.gz
search-paths: Add GCC search paths.
* guix/search-paths.scm ($C_INCLUDE_PATH, $CPLUS_INCLUDE_PATH) ($LIBRARY_PATH, %gcc-search-paths): New variables.
Diffstat (limited to 'guix/search-paths.scm')
-rw-r--r--guix/search-paths.scm35
1 files changed, 34 insertions, 1 deletions
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 <ludo@gnu.org>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; 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 <cstdlib>'s "#include_next
+ ;; <stdlib.h>" finds GCC's <stdlib.h>, 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.