summaryrefslogtreecommitdiff
path: root/gnu/packages/gcc.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-07-18 16:05:21 +0200
committerLudovic Courtès <ludo@gnu.org>2021-07-18 19:50:01 +0200
commit0e47fcced442d8e7c1b05184fdc1c14f10ed04ec (patch)
tree4ae844bc0ec3c670f8697bdc24362c122fa718ad /gnu/packages/gcc.scm
parente4b70bc55a538569465bcedee19d1f2607308e65 (diff)
parent8b1bde7bb3936a64244824500ffe60f123704437 (diff)
downloadguix-patches-0e47fcced442d8e7c1b05184fdc1c14f10ed04ec.tar
guix-patches-0e47fcced442d8e7c1b05184fdc1c14f10ed04ec.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r--gnu/packages/gcc.scm77
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 35f7d9a2e5..79994cc191 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -737,6 +738,42 @@ as the 'native-search-paths' field."
(find-files (string-append (assoc-ref outputs "out") "/bin")
".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|lto)(-.*)?$"))))))))))
+(define* (custom-gcc-gccgo gcc name languages
+ #:optional
+ (search-paths (package-native-search-paths gcc))
+ #:key (separate-lib-output? #t))
+ ;; TODO: remove CUSTOM-GCC-GCCGO when regex changes for CUSTOM-GCC are
+ ;; merged into master <https://issues.guix.gnu.org/49010>
+ "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
+as the 'native-search-paths' field."
+ (package (inherit gcc)
+ (name name)
+ (outputs (if separate-lib-output?
+ (package-outputs gcc)
+ (delete "lib" (package-outputs gcc))))
+ (native-search-paths search-paths)
+ (properties (alist-delete 'hidden? (package-properties gcc)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments gcc)
+ ((#:modules modules %gnu-build-system-modules)
+ `(,@modules
+ (srfi srfi-1)
+ (srfi srfi-26)
+ (ice-9 regex)))
+ ((#:configure-flags flags)
+ `(cons (string-append "--enable-languages="
+ ,(string-join languages ","))
+ (remove (cut string-match "--enable-languages.*" <>)
+ ,flags)))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'install 'remove-broken-or-conflicting-files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (for-each
+ delete-file
+ (find-files (string-append (assoc-ref outputs "out") "/bin")
+ ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|lto)(-.*)?$"))))))))))
+
(define %generic-search-paths
;; This is the language-neutral search path for GCC. Entries in $CPATH are
;; not considered "system headers", which means GCC can raise warnings for
@@ -800,6 +837,43 @@ It can also be used for ahead-of-time code generation for building standalone
compilers. The just-in-time (jit) part of the name is now something of a
misnomer.")))
+(define (make-gccgo gcc)
+ "Return a gccgo package based on GCC."
+ (let ((gccgo (custom-gcc-gccgo gcc "gccgo" '("go") %generic-search-paths)))
+ (package
+ (inherit gccgo)
+ (synopsis "Go frontend to GCC")
+ (description
+ "This package is part of the GNU Compiler Collection and
+provides the GNU compiler for the Go programming language.")
+ (arguments
+ (substitute-keyword-arguments (package-arguments gccgo)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'install 'wrap-go-with-tool-path
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (exedir (string-append out "/libexec/gcc"))
+ (tooldir (dirname (car (find-files exedir "^cgo$")))))
+ (wrap-program (string-append out "/bin/go")
+ `("GCCGOTOOLDIR" =
+ (,(string-append "${GCCGOTOOLDIR-" tooldir "}")))
+ `("GOROOT" =
+ (,(string-append "${GOROOT-" out "}")))))))
+ (add-before 'configure 'fix-gotools-runpath
+ (lambda _
+ (substitute* "gotools/Makefile.in"
+ (("AM_LDFLAGS =" all)
+ (string-append all " -Wl,-rpath=$(libdir) ")))))
+ (add-before 'configure 'remove-tool-reference-from-libgo
+ (lambda _
+ (substitute* "libgo/Makefile.in"
+ (("(GccgoToolDir = \\\")[^\\\"]+" _ start)
+ (string-append start "/nonexistent"))
+ (("(DefaultGoroot = \\\")[^\\\"]+" _ start)
+ (string-append start "/nonexistent"))
+ (("(defaultGOROOTValue.*?return `)[^`]+" _ start)
+ (string-append start "/nonexistent"))))))))))))
(define-public gccgo-4.9
(custom-gcc (package
@@ -815,6 +889,9 @@ provides the GNU compiler for the Go programming language."))
;; a cyclic dependency. <http://debbugs.gnu.org/18101>
#:separate-lib-output? #f))
+(define-public gccgo-10
+ (make-gccgo gcc-10))
+
(define %objc-search-paths
(list (search-path-specification
(variable "OBJC_INCLUDE_PATH")