summaryrefslogtreecommitdiff
path: root/gnu/packages/gcc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r--gnu/packages/gcc.scm326
1 files changed, 169 insertions, 157 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 62b8968823..741cfab06e 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -144,11 +145,11 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(method url-fetch)
(uri (string-append "mirror://gnu/gcc/gcc-"
version "/gcc-" version ".tar.bz2"))
- (patches (search-patches "gcc-4-compile-with-gcc-5.patch"))
(sha256
(base32
"10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
- (patches (search-patches "gcc-fix-texi2pod.patch"))))
+ (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
+ "gcc-fix-texi2pod.patch"))))
(build-system gnu-build-system)
;; Separate out the run-time support libraries because all the
@@ -200,131 +201,131 @@ where the OS part is overloaded to denote a specific ABI---into GCC
#:tests? #f
#:phases
- (alist-cons-before
- 'configure 'pre-configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((libdir ,(libdir))
- (libc (assoc-ref inputs "libc")))
- (when libc
- ;; The following is not performed for `--without-headers'
- ;; cross-compiler builds.
-
- ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
- ;; single line, to allow the next step to work properly.
- (for-each
- (lambda (x)
- (substitute* (find-files "gcc/config"
- "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
- (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
- line)))
- '(1 2 3))
-
- ;; Fix the dynamic linker's file name.
- (substitute* (find-files "gcc/config"
- "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
- (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
- _ gnu-user suffix)
- (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
- gnu-user suffix
- (string-append libc ,(glibc-dynamic-linker)))))
-
- ;; Tell where to find libstdc++, libc, and `?crt*.o', except
- ;; `crt{begin,end}.o', which come with GCC.
- (substitute* (find-files "gcc/config"
- "^gnu-user.*\\.h$")
- (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
- ;; Help libgcc_s.so be found (see also below.) Always use
- ;; '-lgcc_s' so that libgcc_s.so is always found by those
- ;; programs that use 'pthread_cancel' (glibc dlopens
- ;; libgcc_s.so when pthread_cancel support is needed, but
- ;; having it in the application's RUNPATH isn't enough; see
- ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
- ;;
- ;; NOTE: The '-lgcc_s' added below needs to be removed in a
- ;; later phase of %gcc-static. If you change the string
- ;; below, make sure to update the relevant code in
- ;; %gcc-static package as needed.
- (format #f "#define GNU_USER_TARGET_LIB_SPEC \
+ (modify-phases %standard-phases
+ (add-before 'configure 'pre-configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((libdir ,(libdir))
+ (libc (assoc-ref inputs "libc")))
+ (when libc
+ ;; The following is not performed for `--without-headers'
+ ;; cross-compiler builds.
+
+ ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
+ ;; single line, to allow the next step to work properly.
+ (for-each
+ (lambda (x)
+ (substitute* (find-files "gcc/config"
+ "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
+ (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
+ line)))
+ '(1 2 3))
+
+ ;; Fix the dynamic linker's file name.
+ (substitute* (find-files "gcc/config"
+ "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
+ (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
+ _ gnu-user suffix)
+ (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
+ gnu-user suffix
+ (string-append libc ,(glibc-dynamic-linker)))))
+
+ ;; Tell where to find libstdc++, libc, and `?crt*.o', except
+ ;; `crt{begin,end}.o', which come with GCC.
+ (substitute* (find-files "gcc/config"
+ "^gnu-user.*\\.h$")
+ (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
+ ;; Help libgcc_s.so be found (see also below.) Always use
+ ;; '-lgcc_s' so that libgcc_s.so is always found by those
+ ;; programs that use 'pthread_cancel' (glibc dlopens
+ ;; libgcc_s.so when pthread_cancel support is needed, but
+ ;; having it in the application's RUNPATH isn't enough; see
+ ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
+ ;;
+ ;; NOTE: The '-lgcc_s' added below needs to be removed in a
+ ;; later phase of %gcc-static. If you change the string
+ ;; below, make sure to update the relevant code in
+ ;; %gcc-static package as needed.
+ (format #f "#define GNU_USER_TARGET_LIB_SPEC \
\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
- libc libc libdir suffix))
- (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
- (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+ libc libc libdir suffix))
+ (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
+ (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
#define STANDARD_STARTFILE_PREFIX_2 \"\"
~a"
- libc line)))
-
- ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
- ;; GNU_USER_* defines. Do the above for this case.
- (substitute*
- "gcc/config/rs6000/sysv4.h"
- (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
- (format #f "#define LIB_LINUX_SPEC \
+ libc line)))
+
+ ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
+ ;; GNU_USER_* defines. Do the above for this case.
+ (substitute*
+ "gcc/config/rs6000/sysv4.h"
+ (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
+ (format #f "#define LIB_LINUX_SPEC \
\"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
- libc libc libdir suffix))
- (("#define STARTFILE_LINUX_SPEC.*$" line)
- (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
+ libc libc libdir suffix))
+ (("#define STARTFILE_LINUX_SPEC.*$" line)
+ (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
#define STANDARD_STARTFILE_PREFIX_2 \"\"
~a"
- libc line))))
-
- ;; Don't retain a dependency on the build-time sed.
- (substitute* "fixincludes/fixincl.x"
- (("static char const sed_cmd_z\\[\\] =.*;")
- "static char const sed_cmd_z[] = \"sed\";"))
-
- ;; Aarch64 support didn't land in GCC until the 4.8 series.
- (when (file-exists? "gcc/config/aarch64")
- ;; Force Aarch64 libdir to be /lib and not /lib64
- (substitute* "gcc/config/aarch64/t-aarch64-linux"
- (("lib64") "lib")))
-
- (when (file-exists? "libbacktrace")
- ;; GCC 4.8+ comes with libbacktrace. By default it builds
- ;; with -Werror, which fails with a -Wcast-qual error in glibc
- ;; 2.21's stdlib-bsearch.h. Remove -Werror.
- (substitute* "libbacktrace/configure"
- (("WARN_FLAGS=(.*)-Werror" _ flags)
- (string-append "WARN_FLAGS=" flags)))
-
- (when (file-exists? "libsanitizer/libbacktrace")
- ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
- (substitute* "libsanitizer/libbacktrace/Makefile.in"
- (("-Werror")
- ""))))
-
- ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
- ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
- ;; and <http://bugs.gnu.org/20358>.
- (substitute* "libstdc++-v3/src/Makefile.in"
- (("^OPT_LDFLAGS = ")
- "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
-
- ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
- ;; circularity between "out" and "lib". (Note:
- ;; --with-python-dir is useless because it imposes $(prefix) as
- ;; the parent directory.)
- (substitute* "libstdc++-v3/python/Makefile.in"
- (("pythondir = .*$")
- (string-append "pythondir = " libdir "/share"
- "/gcc-$(gcc_version)/python\n")))
-
- ;; Avoid another circularity between the outputs: this #define
- ;; ends up in auto-host.h in the "lib" output, referring to
- ;; "out". (This variable is used to augment cpp's search path,
- ;; but there's nothing useful to look for here.)
- (substitute* "gcc/config.in"
- (("PREFIX_INCLUDE_DIR")
- "PREFIX_INCLUDE_DIR_isnt_necessary_here"))))
-
- (alist-cons-after
- 'configure 'post-configure
- (lambda _
- ;; Don't store configure flags, to avoid retaining references to
- ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
- (substitute* "Makefile"
- (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
- "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
- %standard-phases))))
+ libc line))))
+
+ ;; Don't retain a dependency on the build-time sed.
+ (substitute* "fixincludes/fixincl.x"
+ (("static char const sed_cmd_z\\[\\] =.*;")
+ "static char const sed_cmd_z[] = \"sed\";"))
+
+ ;; Aarch64 support didn't land in GCC until the 4.8 series.
+ (when (file-exists? "gcc/config/aarch64")
+ ;; Force Aarch64 libdir to be /lib and not /lib64
+ (substitute* "gcc/config/aarch64/t-aarch64-linux"
+ (("lib64") "lib")))
+
+ (when (file-exists? "libbacktrace")
+ ;; GCC 4.8+ comes with libbacktrace. By default it builds
+ ;; with -Werror, which fails with a -Wcast-qual error in glibc
+ ;; 2.21's stdlib-bsearch.h. Remove -Werror.
+ (substitute* "libbacktrace/configure"
+ (("WARN_FLAGS=(.*)-Werror" _ flags)
+ (string-append "WARN_FLAGS=" flags)))
+
+ (when (file-exists? "libsanitizer/libbacktrace")
+ ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
+ (substitute* "libsanitizer/libbacktrace/Makefile.in"
+ (("-Werror")
+ ""))))
+
+ ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
+ ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
+ ;; and <http://bugs.gnu.org/20358>.
+ (substitute* "libstdc++-v3/src/Makefile.in"
+ (("^OPT_LDFLAGS = ")
+ "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
+
+ ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
+ ;; circularity between "out" and "lib". (Note:
+ ;; --with-python-dir is useless because it imposes $(prefix) as
+ ;; the parent directory.)
+ (substitute* "libstdc++-v3/python/Makefile.in"
+ (("pythondir = .*$")
+ (string-append "pythondir = " libdir "/share"
+ "/gcc-$(gcc_version)/python\n")))
+
+ ;; Avoid another circularity between the outputs: this #define
+ ;; ends up in auto-host.h in the "lib" output, referring to
+ ;; "out". (This variable is used to augment cpp's search path,
+ ;; but there's nothing useful to look for here.)
+ (substitute* "gcc/config.in"
+ (("PREFIX_INCLUDE_DIR")
+ "PREFIX_INCLUDE_DIR_isnt_necessary_here"))
+ #t)))
+
+ (add-after 'configure 'post-configure
+ (lambda _
+ ;; Don't store configure flags, to avoid retaining references to
+ ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
+ (substitute* "Makefile"
+ (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
+ "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))
+ #t)))))
(native-search-paths
;; Use the language-specific variables rather than 'CPATH' because they
@@ -369,13 +370,15 @@ Go. It also includes runtime support libraries for these languages.")
;; This is required for building with glibc-2.26.
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
(snippet
- '(for-each
- (lambda (dir)
- (substitute* (string-append "libgcc/config/"
- dir "/linux-unwind.h")
- (("struct ucontext") "ucontext_t")))
- '("aarch64" "alpha" "bfin" "i386" "m68k"
- "pa" "sh" "tilepro" "xtensa")))))
+ '(begin
+ (for-each
+ (lambda (dir)
+ (substitute* (string-append "libgcc/config/"
+ dir "/linux-unwind.h")
+ (("struct ucontext") "ucontext_t")))
+ '("aarch64" "alpha" "bfin" "i386" "m68k"
+ "pa" "sh" "tilepro" "xtensa"))
+ #t))))
(supported-systems %supported-systems)
(inputs
`(("isl" ,isl-0.11)
@@ -401,13 +404,15 @@ Go. It also includes runtime support libraries for these languages.")
;; This is required for building with glibc-2.26.
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
(snippet
- '(for-each
- (lambda (dir)
- (substitute* (string-append "libgcc/config/"
- dir "/linux-unwind.h")
- (("struct ucontext") "ucontext_t")))
- '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
- "pa" "sh" "tilepro" "xtensa")))))
+ '(begin
+ (for-each
+ (lambda (dir)
+ (substitute* (string-append "libgcc/config/"
+ dir "/linux-unwind.h")
+ (("struct ucontext") "ucontext_t")))
+ '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
+ "pa" "sh" "tilepro" "xtensa"))
+ #t))))
;; Override inherited texinfo-5 with latest version.
(native-inputs `(("perl" ,perl) ;for manpages
("texinfo" ,texinfo)))))
@@ -439,9 +444,11 @@ Go. It also includes runtime support libraries for these languages.")
;;
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590
;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077
- '(substitute* "libcc1/configure"
- (("\\$gcc_cv_objdump -T")
- "$OBJDUMP_FOR_TARGET -T")))))
+ '(begin
+ (substitute* "libcc1/configure"
+ (("\\$gcc_cv_objdump -T")
+ "$OBJDUMP_FOR_TARGET -T"))
+ #t))))
(inputs
`(("isl" ,isl)
,@(package-inputs gcc-4.7)))))
@@ -467,13 +474,15 @@ Go. It also includes runtime support libraries for these languages.")
;; This can be removed when gcc-6.5.0 is released.
;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
(snippet
- '(for-each
- (lambda (dir)
- (substitute* (string-append "libgcc/config/"
- dir "/linux-unwind.h")
- (("struct ucontext") "ucontext_t")))
- '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
- "pa" "sh" "tilepro" "xtensa")))))
+ '(begin
+ (for-each
+ (lambda (dir)
+ (substitute* (string-append "libgcc/config/"
+ dir "/linux-unwind.h")
+ (("struct ucontext") "ucontext_t")))
+ '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
+ "pa" "sh" "tilepro" "xtensa"))
+ #t))))
(inputs
`(("isl" ,isl)
,@(package-inputs gcc-4.7)))))
@@ -512,7 +521,8 @@ using compilers other than GCC."
#:phases (alist-cons-before
'configure 'chdir
(lambda _
- (chdir "libstdc++-v3"))
+ (chdir "libstdc++-v3")
+ #t)
%standard-phases)
#:configure-flags `("--disable-libstdcxx-pch"
,(string-append "--with-gxx-include-dir="
@@ -759,7 +769,8 @@ as the 'native-search-paths' field."
#:phases (modify-phases %standard-phases
(add-before 'configure 'chdir
(lambda _
- (chdir "libstdc++-v3")))
+ (chdir "libstdc++-v3")
+ #t))
(add-before 'configure 'set-xsl-directory
(lambda* (#:key inputs #:allow-other-keys)
(let ((docbook (assoc-ref inputs "docbook-xsl")))
@@ -768,22 +779,23 @@ as the 'native-search-paths' field."
(("@XSL_STYLE_DIR@")
(string-append
docbook "/xml/xsl/"
- (strip-store-file-name docbook)))))))
+ (strip-store-file-name docbook))))
+ #t)))
(replace 'build
(lambda _
;; XXX: There's also a 'doc-info' target, but it
;; relies on docbook2X, which itself relies on
;; DocBook 4.1.2, which is not really usable
;; (lacks a catalog.xml.)
- (zero? (system* "make"
- "doc-html"
- "doc-man"))))
+ (invoke "make"
+ "doc-html"
+ "doc-man")))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
- (zero? (system* "make"
- "doc-install-html"
- "doc-install-man"))))))))))
+ (invoke "make"
+ "doc-install-html"
+ "doc-install-man")))))))))
(define-public libstdc++-doc-4.9
(make-libstdc++-doc gcc-4.9))
@@ -897,9 +909,9 @@ effective code.")
(delete 'check)
(replace 'build
(lambda _
- (zero? (system* "make"
- "gnu-c-manual.info"
- "gnu-c-manual.html"))))
+ (invoke "make"
+ "gnu-c-manual.info"
+ "gnu-c-manual.html")))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))