Nikita Karetnikov nik...@karetnikov.org skribis:
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?
See below.
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?
I’d say ‘gfortran’ and ‘gccgo’, and perhaps ‘gcc-objective-c’?
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
I guess that’s unnecessary when using ‘ld-wrapper’.
Notes:
1. The Go front-end requires ‘-g’ (see [1]).
That’s a bug, which may have been fixed in 4.8.2 no? I’d rather not
workaround that if it’s been/being fixed.
4. The Ada front-end requires GNAT [3] (see [4]).
5. Not sure why the Java front-end fails:
GNAT and GCJ are definitely trickier, so I’d suggest to leave them for now.
+(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))
That’s unreliable because FLAGS is actually a quoted expression, like
'(cons --with-foo (list --with-bar))
So the mapping has to be done in builder-side code, not in host-side
code, like ‘gcc-cross-boot0’ does.
Something like:
`(cons --enable-languages= ,(string-join languages ,)
(remove (cut string-match --enable-languages.* ) ,flags))
(Note that “c,c++” can be omitted since it’s always enabled.)
Thanks,
Ludo’.