summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-27 15:13:25 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-27 15:13:25 +0100
commite9c0b9446bf9b76448349dce1a026eb010038a67 (patch)
treeaba863928ff82f948336a6c26e3f38ecaf5ed6f5 /gnu
parent785db4d877959c0b948859d19dff22384924fae4 (diff)
downloadguix-e9c0b9446bf9b76448349dce1a026eb010038a67.tar.gz
gnu: Move GCC to its own module.
* gnu/packages/base.scm (gcc-4.7): Move to...
* gnu/packages/gcc.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/base.scm114
-rw-r--r--gnu/packages/gcc.scm140
2 files changed, 141 insertions, 113 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 23bf00b241..92b94dc035 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -24,6 +24,7 @@
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
@@ -378,119 +379,6 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
    (license gpl3+)
    (home-page "http://www.gnu.org/software/binutils/")))
 
-(define-public gcc-4.7
-  (let ((stripped? #t))                         ; TODO: make this a parameter
-    (package
-     (name "gcc")
-     (version "4.7.2")
-     (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/gcc/gcc-"
-                                  version "/gcc-" version ".tar.bz2"))
-              (sha256
-               (base32
-                "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
-     (build-system gnu-build-system)
-     (inputs `(("gmp" ,gmp)
-               ("mpfr" ,mpfr)
-               ("mpc" ,mpc)))           ; TODO: libelf, ppl, cloog, zlib, etc.
-     (arguments
-      `(#:out-of-source? #t
-        #:strip-binaries? ,stripped?
-        #:configure-flags
-        `("--enable-plugin"
-          "--enable-languages=c,c++"
-          "--disable-multilib"
-
-          "--with-local-prefix=/no-gcc-local-prefix"
-
-          ,(let ((libc (assoc-ref %build-inputs "libc")))
-             (if libc
-                 (string-append "--with-native-system-header-dir=" libc
-                                "/include")
-                 "--without-headers")))
-        #:make-flags
-        (let ((libc (assoc-ref %build-inputs "libc")))
-          `(,@(if libc
-                  (list (string-append "LDFLAGS_FOR_BUILD="
-                                       "-L" libc "/lib "
-                                       "-Wl,-dynamic-linker "
-                                       "-Wl," libc
-                                       ,(glibc-dynamic-linker)))
-                  '())
-            ,(string-append "BOOT_CFLAGS=-O2 "
-                            ,(if stripped? "-g0" "-g"))))
-
-        #:tests? #f
-        #:phases
-        (alist-cons-before
-         'configure 'pre-configure
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           (let ((out  (assoc-ref outputs "out"))
-                 (libc (assoc-ref inputs "libc")))
-             (when libc
-               ;; The following is not performed for `--without-headers'
-               ;; cross-compiler builds.
-
-               ;; Fix the dynamic linker's file name.
-               (substitute* (find-files "gcc/config"
-                                        "^linux(64|-elf)?\\.h$")
-                 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
-                  (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
-                          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(64)?|linux-elf)\\.h$")
-                 (("#define LIB_SPEC (.*)$" _ suffix)
-                  ;; Note that with this "lib" spec, we may still add a
-                  ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
-                  ;; There's not much that can be done to avoid it, though.
-                  (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
-%{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a~%"
-                          libc libc out out suffix))
-                 (("#define STARTFILE_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\";"))))
-
-         (alist-cons-after
-          'configure 'post-configure
-          (lambda _
-            ;; Don't store configure flags, to avoid retaining references to
-            ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
-            (substitute* "Makefile"
-              (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
-               "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
-          (alist-replace 'install
-                         (lambda* (#:key outputs #:allow-other-keys)
-                           (zero?
-                            (system* "make"
-                                     ,(if stripped?
-                                          "install-strip"
-                                          "install"))))
-                         %standard-phases)))))
-
-     (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
-     (synopsis "The GNU Compiler Collection")
-     (description
-      "The GNU Compiler Collection includes compiler front ends for C, C++,
-Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as
-libraries for these languages (libstdc++, libgcj, libgomp,...).
-
-GCC development is a part of the GNU Project, aiming to improve the compiler
-used in the GNU system including the GNU/Linux variant.")
-     (license gpl3+)
-     (home-page "http://gcc.gnu.org/"))))
-
 (define-public glibc
   (package
    (name "glibc")
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
new file mode 100644
index 0000000000..a4ee04f5a5
--- /dev/null
+++ b/gnu/packages/gcc.scm
@@ -0,0 +1,140 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages gcc)
+  #:use-module (guix licenses)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages bootstrap)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages multiprecision)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu))
+
+(define-public gcc-4.7
+  (let ((stripped? #t))                         ; TODO: make this a parameter
+    (package
+     (name "gcc")
+     (version "4.7.2")
+     (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/gcc/gcc-"
+                                  version "/gcc-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
+     (build-system gnu-build-system)
+     (inputs `(("gmp" ,gmp)
+               ("mpfr" ,mpfr)
+               ("mpc" ,mpc)))           ; TODO: libelf, ppl, cloog, zlib, etc.
+     (arguments
+      `(#:out-of-source? #t
+        #:strip-binaries? ,stripped?
+        #:configure-flags
+        `("--enable-plugin"
+          "--enable-languages=c,c++"
+          "--disable-multilib"
+
+          "--with-local-prefix=/no-gcc-local-prefix"
+
+          ,(let ((libc (assoc-ref %build-inputs "libc")))
+             (if libc
+                 (string-append "--with-native-system-header-dir=" libc
+                                "/include")
+                 "--without-headers")))
+        #:make-flags
+        (let ((libc (assoc-ref %build-inputs "libc")))
+          `(,@(if libc
+                  (list (string-append "LDFLAGS_FOR_BUILD="
+                                       "-L" libc "/lib "
+                                       "-Wl,-dynamic-linker "
+                                       "-Wl," libc
+                                       ,(glibc-dynamic-linker)))
+                  '())
+            ,(string-append "BOOT_CFLAGS=-O2 "
+                            ,(if stripped? "-g0" "-g"))))
+
+        #:tests? #f
+        #:phases
+        (alist-cons-before
+         'configure 'pre-configure
+         (lambda* (#:key inputs outputs #:allow-other-keys)
+           (let ((out  (assoc-ref outputs "out"))
+                 (libc (assoc-ref inputs "libc")))
+             (when libc
+               ;; The following is not performed for `--without-headers'
+               ;; cross-compiler builds.
+
+               ;; Fix the dynamic linker's file name.
+               (substitute* (find-files "gcc/config"
+                                        "^linux(64|-elf)?\\.h$")
+                 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
+                  (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
+                          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(64)?|linux-elf)\\.h$")
+                 (("#define LIB_SPEC (.*)$" _ suffix)
+                  ;; Note that with this "lib" spec, we may still add a
+                  ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
+                  ;; There's not much that can be done to avoid it, though.
+                  (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
+%{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a~%"
+                          libc libc out out suffix))
+                 (("#define STARTFILE_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\";"))))
+
+         (alist-cons-after
+          'configure 'post-configure
+          (lambda _
+            ;; Don't store configure flags, to avoid retaining references to
+            ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
+            (substitute* "Makefile"
+              (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
+               "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
+          (alist-replace 'install
+                         (lambda* (#:key outputs #:allow-other-keys)
+                           (zero?
+                            (system* "make"
+                                     ,(if stripped?
+                                          "install-strip"
+                                          "install"))))
+                         %standard-phases)))))
+
+     (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
+     (synopsis "The GNU Compiler Collection")
+     (description
+      "The GNU Compiler Collection includes compiler front ends for C, C++,
+Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as
+libraries for these languages (libstdc++, libgcj, libgomp,...).
+
+GCC development is a part of the GNU Project, aiming to improve the compiler
+used in the GNU system including the GNU/Linux variant.")
+     (license gpl3+)
+     (home-page "http://gcc.gnu.org/"))))