1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages gcc)
20 #:use-module ((guix licenses)
21 #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+))
22 #:use-module (gnu packages)
23 #:use-module (gnu packages bootstrap)
24 #:use-module (gnu packages compression)
25 #:use-module (gnu packages multiprecision)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu))
30 (define %gcc-infrastructure
31 ;; Base URL for GCC's infrastructure.
32 "ftp://gcc.gnu.org/pub/gcc/infrastructure/")
34 (define-public gcc-4.7
35 (let ((stripped? #t)) ; TODO: make this a parameter
41 (uri (string-append "mirror://gnu/gcc/gcc-"
42 version "/gcc-" version ".tar.bz2"))
45 "115h03hil99ljig8lkrq4qk426awmzh0g99wrrggxf8g07bq74la"))))
46 (build-system gnu-build-system)
47 (inputs `(("gmp" ,gmp)
49 ("mpc" ,mpc))) ; TODO: libelf, ppl, cloog, zlib, etc.
52 #:strip-binaries? ,stripped?
55 "--enable-languages=c,c++"
58 "--with-local-prefix=/no-gcc-local-prefix"
60 ,(let ((libc (assoc-ref %build-inputs "libc")))
62 (string-append "--with-native-system-header-dir=" libc
64 "--without-headers")))
66 (let ((libc (assoc-ref %build-inputs "libc")))
68 (list (string-append "LDFLAGS_FOR_BUILD="
70 "-Wl,-dynamic-linker "
72 ,(glibc-dynamic-linker)))
74 ,(string-append "BOOT_CFLAGS=-O2 "
75 ,(if stripped? "-g0" "-g"))))
80 'configure 'pre-configure
81 (lambda* (#:key inputs outputs #:allow-other-keys)
82 (let ((out (assoc-ref outputs "out"))
83 (libc (assoc-ref inputs "libc")))
85 ;; The following is not performed for `--without-headers'
86 ;; cross-compiler builds.
88 ;; Fix the dynamic linker's file name.
89 (substitute* (find-files "gcc/config"
90 "^linux(64|-elf)?\\.h$")
91 (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix)
92 (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%"
94 (string-append libc ,(glibc-dynamic-linker)))))
96 ;; Tell where to find libstdc++, libc, and `?crt*.o', except
97 ;; `crt{begin,end}.o', which come with GCC.
98 (substitute* (find-files "gcc/config"
99 "^(gnu-user(64)?|linux-elf)\\.h$")
100 (("#define LIB_SPEC (.*)$" _ suffix)
101 ;; Note that with this "lib" spec, we may still add a
102 ;; RUNPATH to GCC even when `libgcc_s' is not NEEDED.
103 ;; There's not much that can be done to avoid it, though.
104 (format #f "#define LIB_SPEC \"-L~a/lib %{!static:-rpath=~a/lib \
105 %{!static-libgcc:-rpath=~a/lib64 -rpath=~a/lib}} \" ~a~%"
106 libc libc out out suffix))
107 (("#define STARTFILE_SPEC.*$" line)
108 (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
109 #define STANDARD_STARTFILE_PREFIX_2 \"\"
113 ;; Don't retain a dependency on the build-time sed.
114 (substitute* "fixincludes/fixincl.x"
115 (("static char const sed_cmd_z\\[\\] =.*;")
116 "static char const sed_cmd_z[] = \"sed\";"))))
119 'configure 'post-configure
121 ;; Don't store configure flags, to avoid retaining references to
122 ;; build-time dependencies---e.g., `--with-ppl=/nix/store/xxx'.
123 (substitute* "Makefile"
124 (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
125 "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))
126 (alist-replace 'install
127 (lambda* (#:key outputs #:allow-other-keys)
133 %standard-phases)))))
135 (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
136 (synopsis "GNU Compiler Collection")
138 "The GNU Compiler Collection includes compiler front ends for C, C++,
139 Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well as
140 libraries for these languages (libstdc++, libgcj, libgomp,...).
142 GCC development is a part of the GNU Project, aiming to improve the compiler
143 used in the GNU system including the GNU/Linux variant.")
145 (home-page "http://gcc.gnu.org/"))))
153 (uri (list (string-append
154 "ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/isl-"
157 (string-append %gcc-infrastructure
158 name "-" version ".tar.gz")))
161 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))))
162 (build-system gnu-build-system)
163 (inputs `(("gmp" ,gmp)))
164 (home-page "http://www.kotnet.org/~skimo/isl/")
166 "A library for manipulating sets and relations of integer points bounded
167 by linear constraints")
169 "isl is a library for manipulating sets and relations of integer points
170 bounded by linear constraints. Supported operations on sets include
171 intersection, union, set difference, emptiness check, convex hull, (integer)
172 affine hull, integer projection, computing the lexicographic minimum using
173 parametric integer programming, coalescing and parametric vertex
174 enumeration. It also includes an ILP solver based on generalized basis
175 reduction, transitive closures on maps (which may encode infinite graphs),
176 dependence analysis and bounds on piecewise step-polynomials.")
186 (uri (list (string-append
187 "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
190 (string-append %gcc-infrastructure
191 name "-" version ".tar.gz")))
194 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
195 (file-name (string-append name "-" version ".tar.gz"))))
196 (build-system gnu-build-system)
197 (inputs `(("gmp" ,gmp)
199 (arguments '(#:configure-flags '("--with-isl=system")))
200 (home-page "http://www.cloog.org/")
201 (synopsis "A library to generate code for scanning Z-polyhedra")
203 "CLooG is a free software library to generate code for scanning
204 Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
205 reaches each integral point of one or more parameterized polyhedra.
206 CLooG has been originally written to solve the code generation problem
207 for optimizing compilers based on the polytope model. Nevertheless it
208 is used now in various area e.g., to build control automata for
209 high-level synthesis or to find the best polynomial approximation of a
210 function. CLooG may help in any situation where scanning polyhedra
211 matters. While the user has full control on generated code quality,
212 CLooG is designed to avoid control overhead and to produce a very
216 (define-public libelf
222 (uri (string-append "http://www.mr511.de/software/libelf-"
226 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
227 (build-system gnu-build-system)
228 (arguments '(#:phases (alist-replace
230 (lambda* (#:key outputs #:allow-other-keys)
231 ;; This old `configure' script doesn't support
232 ;; variables passed as arguments.
233 (let ((out (assoc-ref outputs "out")))
234 (setenv "CONFIG_SHELL" (which "bash"))
236 (system* "./configure"
237 (string-append "--prefix=" out)))))
239 (home-page "http://www.mr511.de/software/english.html")
240 (synopsis "An ELF object file access library")
241 (description "libelf is a C library to access ELF object files.")