distro: Add i686 support.

* distro/packages/base.scm (gcc-4.7): Turn `arguments' into a lambda.
  Use `glibc-dynamic-linker' instead of the hard-coded linker name.
This commit is contained in:
Nikita Karetnikov 2012-10-16 23:24:58 +00:00 committed by Ludovic Courtès
parent 124b17673b
commit a52e429f76
1 changed files with 77 additions and 75 deletions

View File

@ -1,5 +1,6 @@
;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org> ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright (C) 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; ;;;
;;; This file is part of Guix. ;;; This file is part of Guix.
;;; ;;;
@ -704,9 +705,9 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
(define (glibc-dynamic-linker system) (define (glibc-dynamic-linker system)
"Return the name of Glibc's dynamic linker for SYSTEM." "Return the name of Glibc's dynamic linker for SYSTEM."
(if (string=? system "x86_64-linux") (cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
"ld-linux-x86-64.so.2" ((string=? system "i686-linux") "/lib/ld-linux.so.2")
(error "dynamic linker name not known for this system" system))) (else (error "dynamic linker name not known for this system" system))))
(define-public gcc-4.7 (define-public gcc-4.7
(let ((stripped? #t)) ; TODO: make this a parameter (let ((stripped? #t)) ; TODO: make this a parameter
@ -725,6 +726,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
("mpfr" ,mpfr) ("mpfr" ,mpfr)
("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc. ("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
(arguments (arguments
(lambda (system)
`(#:out-of-source? #t `(#:out-of-source? #t
#:strip-binaries? ,stripped? #:strip-binaries? ,stripped?
#:configure-flags #:configure-flags
@ -743,7 +745,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
"-L" libc "/lib " "-L" libc "/lib "
"-Wl,-dynamic-linker " "-Wl,-dynamic-linker "
"-Wl," libc "-Wl," libc
"/lib/ld-linux-x86-64.so.2")) ,(glibc-dynamic-linker system)))
'()) '())
,(string-append "BOOT_CFLAGS=-O2 " ,(string-append "BOOT_CFLAGS=-O2 "
,(if stripped? "-g0" "-g")))) ,(if stripped? "-g0" "-g"))))
@ -764,7 +766,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
(("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix) (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
(format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%" (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
suffix suffix
(string-append libc "/lib/ld-linux-x86-64.so.2")))) (string-append libc ,(glibc-dynamic-linker system)))))
;; Tell where to find libstdc++, libc, and `?crt*.o', except ;; Tell where to find libstdc++, libc, and `?crt*.o', except
;; `crt{begin,end}.o', which come with GCC. ;; `crt{begin,end}.o', which come with GCC.
@ -801,7 +803,7 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
,(if stripped? ,(if stripped?
"install-strip" "install-strip"
"install")))) "install"))))
%standard-phases))))) %standard-phases))))))
(properties `((gcc-libc . ,(assoc-ref inputs "libc")))) (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
(description "The GNU Compiler Collection") (description "The GNU Compiler Collection")
@ -1557,7 +1559,7 @@ identifier SYSTEM."
(ice-9 regex) (ice-9 regex)
(srfi srfi-1) (srfi srfi-1)
(srfi srfi-26)) (srfi srfi-26))
,@(substitute-keyword-arguments (package-arguments gcc-4.7) ,@(substitute-keyword-arguments ((package-arguments gcc-4.7) system)
((#:configure-flags flags) ((#:configure-flags flags)
`(append (list ,(string-append "--target=" `(append (list ,(string-append "--target="
(boot-triplet system)) (boot-triplet system))
@ -1762,7 +1764,7 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/lib/~a \"$@\"~%"
;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.) ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
,@(substitute-keyword-arguments ((package-arguments gcc-boot0) system) ,@(substitute-keyword-arguments ((package-arguments gcc-boot0) system)
((#:configure-flags boot-flags) ((#:configure-flags boot-flags)
(let loop ((args (package-arguments gcc-4.7))) (let loop ((args ((package-arguments gcc-4.7) system)))
(match args (match args
((#:configure-flags normal-flags _ ...) ((#:configure-flags normal-flags _ ...)
normal-flags) normal-flags)