> I guess this triggers a complete rebuild, right?  (That means it would
> go in ‘core-updates’.)

> Using the ‘substitute-keyword-arguments’ hack as in base.scm would allow
> you to avoid that.

> Also, the ‘origin’ thing should be factorized:

>   (define (gcc-source version)
>     (origin ...))

> It’s good that you’re tackling this!  Then we can also build the
> Objective-C front-end, and then start GNUstepping.

What do you think about the attached diff?  Is there a way to avoid
multiple ‘map’s?

What about the names of the packages?  For example, ‘gcc-fortran’ is
usually called ‘gfortran’, ‘gcc-go’ is called ‘gccgo’, etc.  Should we
use these names?  How should we call ‘gcc-objc’, then?

If you want to test any of the front-ends, don’t forget to set
LIBRARY_PATH and LD_LIBRARY_PATH, like so:

$ export LIBRARY_PATH=/nix/store/wmaxqx3p658v2yqjv00mss2shvn23h7a-glibc-2.18/lib
$ export 
LD_LIBRARY_PATH=/nix/store/kvhg0fszagsx5y80sq79bkmb7yqvjfmd-gcc-go-4.8.1/lib

Notes:

1. The Go front-end requires ‘-g’ (see [1]).

2. “GFORTRAN guesses the source code formatting based on the file
   extension. For .f90 files, it will assume it's working with FORTRAN
   90 source code and use free formatting rules. For .f and .for files,
   it will assume the file is F77 source code and use fixed formatting
   rules.” [2]

3. If you want to compile Objective-C or Objective-C++, pass ‘-x <lang>’
   to ‘gcc’.

4. The Ada front-end requires GNAT [3] (see [4]).

5. Not sure why the Java front-end fails:

   libtool: link: ( cd ".libs" && rm -f "libquadmath.la" && ln -s 
"../libquadmath.la" "libquadmath.la" )
   make[3]: Leaving directory 
`/tmp/nix-build-gcc-java-4.8.1.drv-0/build/i686-pc-linux-gnu/libquadmath'
   make[2]: Leaving directory 
`/tmp/nix-build-gcc-java-4.8.1.drv-0/build/i686-pc-linux-gnu/libquadmath'
   make[1]: Leaving directory `/tmp/nix-build-gcc-java-4.8.1.drv-0/build'
   make: *** [all] Error 2
   phase `build' failed after 2229 seconds
   note: keeping build directory `/tmp/nix-build-gcc-java-4.8.1.drv-0'
   builder for `/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' 
failed with exit code 1
   @ build-failed 
/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv - 1 builder for 
`/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' failed with 
exit code 1
   guix build: error: build failed: build of 
`/nix/store/wlqwyy9k9mbl3wpy9jq08k91qq23f4kp-gcc-java-4.8.1.drv' failed

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57194
[2] http://ubuntuforums.org/showthread.php?t=853105
[3] https://www.gnu.org/software/gnat/
[4] http://gcc.gnu.org/ml/gcc/2007-11/msg00091.html

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index cececca..c2742fb 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -26,6 +26,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (ice-9 regex))
 
@@ -211,6 +212,41 @@ Go.  It also includes standard libraries for these languages.")
               (base32
                "04sqn0ds17ys8l6zn7vyyvjz1a7hsk4zb0381vlw9wnr7az48nsl"))))))
 
+(define (custom-gcc gcc name languages)
+  (package (inherit gcc)
+    (name name)
+    (arguments
+     (substitute-keyword-arguments (package-arguments gcc)
+       ((#:configure-flags flags)
+        (map (lambda (x)
+               (if (list? x)
+                   (map (lambda (y)
+                          (if (equal? "--enable-languages=c,c++" y)
+                              (string-append "--enable-languages="
+                                             languages)
+                              y))
+                        x)
+                   x))
+             flags))))))
+
+;; (define-public gcc-ada-4.8
+;;   (custom-gcc gcc-4.8 "gcc-ada" "ada"))
+
+(define-public gcc-fortran-4.8
+  (custom-gcc gcc-4.8 "gcc-fortran" "fortran"))
+
+(define-public gcc-go-4.8
+  (custom-gcc gcc-4.8 "gcc-go" "go"))
+
+;; (define-public gcc-java-4.8
+;;   (custom-gcc gcc-4.8 "gcc-java" "java"))
+
+(define-public gcc-objc-4.8
+  (custom-gcc gcc-4.8 "gcc-objc" "objc"))
+
+(define-public gcc-objc++-4.8
+  (custom-gcc gcc-4.8 "gcc-objc++" "obj-c++"))
+
 (define-public isl
   (package
     (name "isl")

Attachment: pgpkXvlDm4gbN.pgp
Description: PGP signature

Reply via email to