> Instead, what should do is preserve the arguments; the value associated
> with #:configure-flags should be changed to replace any
> --enable-languages=.* flag with yours.  See ‘gcc-boot0’ in base.scm for
> how to do that.

Are you talking about the ‘substitute-keyword-arguments’ part?

> Alternately, you could turn the current ‘gcc-4.8’ definition into a
> ‘make-gcc-4.8’ procedure like this:

>   (define* (make-gcc-4.8 #:key languages)
>     (package
>        ...

>        #:configure-flags ... ,(string-join languages ",")

>        ...))

>   (define gcc-4.8
>     (make-gcc-4.8 #:languages '("c" "c++")))

> That would probably be easier to work with.

I don’t like the above version because it doesn’t allow to choose the
version of GCC.  I’ve attached my version, how can I make it look
better?

Also, ‘/nix/store/nxpzxlvg5z5qq10wzxrzk9hjyhxyicxq-gfortran-4.8.1/bin’
contains these programs:

c++     gcc-ranlib             i686-pc-linux-gnu-gcc-4.8.1
cpp     gcov                   i686-pc-linux-gnu-gcc-ar
g++     gfortran               i686-pc-linux-gnu-gcc-nm
gcc     i686-pc-linux-gnu-c++  i686-pc-linux-gnu-gcc-ranlib
gcc-ar  i686-pc-linux-gnu-g++  i686-pc-linux-gnu-gfortran
gcc-nm  i686-pc-linux-gnu-gcc

Are C++ and C-related programs supposed to be there?

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index cececca..46c4804 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -47,7 +47,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
          ;; TODO: Add `armel.*gnueabi', `hf', etc.
          '())))
 
-(define-public gcc-4.7
+(define* (inherit-gcc name* version* source* #:key (languages '("c" "c++")))
   (let* ((stripped? #t)                           ; TODO: make this a parameter
          (maybe-target-tools
           (lambda ()
@@ -68,13 +68,14 @@ where the OS part is overloaded to denote a specific ABI---into GCC
             ;; contents of (maybe-target-tools).
             (list 'quasiquote
                   (append
-                   '("--enable-plugin"
-                     "--enable-languages=c,c++"
+                   `("--enable-plugin"
+                     ,(string-append "--enable-languages="
+                                     (string-join languages ","))
                      "--disable-multilib"
 
-                     "--with-local-prefix=/no-gcc-local-prefix"
+                     "--with-local-prefix=/no-gcc-local-prefix")
 
-                     ,(let ((libc (assoc-ref %build-inputs "libc")))
+                   '(,(let ((libc (assoc-ref %build-inputs "libc")))
                         (if libc
                             (string-append "--with-native-system-header-dir=" libc
                                            "/include")
@@ -88,15 +89,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
 
                    (maybe-target-tools))))))
     (package
-      (name "gcc")
-      (version "4.7.3")
-      (source (origin
-               (method url-fetch)
-               (uri (string-append "mirror://gnu/gcc/gcc-"
-                                   version "/gcc-" version ".tar.bz2"))
-               (sha256
-                (base32
-                 "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))
+      (name name*)
+      (version version*)
+      (source source*)
       (build-system gnu-build-system)
       (inputs `(("gmp" ,gmp)
                 ("mpfr" ,mpfr)
@@ -200,6 +195,17 @@ Go.  It also includes standard libraries for these languages.")
       (license gpl3+)
       (home-page "http://gcc.gnu.org/";))))
 
+(define-public gcc-4.7
+  (let ((version "4.7.3"))
+    (inherit-gcc "gcc" version
+                 (origin
+                  (method url-fetch)
+                  (uri (string-append "mirror://gnu/gcc/gcc-"
+                                      version "/gcc-" version ".tar.bz2"))
+                  (sha256
+                   (base32
+                    "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g"))))))
+
 (define-public gcc-4.8
   (package (inherit gcc-4.7)
     (version "4.8.1")
@@ -211,6 +217,18 @@ Go.  It also includes standard libraries for these languages.")
               (base32
                "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl"))))))
 
+(define-public gfortran-4.8
+  (let ((version "4.8.1"))
+    (inherit-gcc "gfortran" version
+                 (origin
+                  (method url-fetch)
+                  (uri (string-append "mirror://gnu/gcc/gcc-"
+                                      version "/gcc-" version ".tar.bz2"))
+                  (sha256
+                   (base32
+                    "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl")))
+                 #:languages '("fortran"))))
+
 (define-public isl
   (package
     (name "isl")

Attachment: pgpHyNQzdGDGR.pgp
Description: PGP signature

Reply via email to