Commit | Line | Data |
---|---|---|
e9c0b944 | 1 | ;;; GNU Guix --- Functional package management for GNU |
61af1014 | 2 | ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> |
270b501e | 3 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
e2808a4a | 4 | ;;; Copyright © 2014 Ricardo Wurmus <rekado@elephly.net> |
ed2b1c4f | 5 | ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr> |
e9c0b944 LC |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu packages gcc) | |
c6d7e299 LC |
23 | #:use-module ((guix licenses) |
24 | #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+)) | |
e9c0b944 LC |
25 | #:use-module (gnu packages) |
26 | #:use-module (gnu packages bootstrap) | |
27 | #:use-module (gnu packages compression) | |
28 | #:use-module (gnu packages multiprecision) | |
c8ebc821 | 29 | #:use-module (gnu packages texinfo) |
3e778ad3 | 30 | #:use-module (gnu packages elf) |
38cf2ba0 | 31 | #:use-module (gnu packages perl) |
e9c0b944 LC |
32 | #:use-module (guix packages) |
33 | #:use-module (guix download) | |
ca16cb96 | 34 | #:use-module (guix build-system gnu) |
74574fd1 | 35 | #:use-module (guix build-system trivial) |
fdd6c726 | 36 | #:use-module (guix utils) |
ca16cb96 | 37 | #:use-module (ice-9 regex)) |
e9c0b944 | 38 | |
832abc76 LC |
39 | (define %gcc-infrastructure |
40 | ;; Base URL for GCC's infrastructure. | |
41 | "ftp://gcc.gnu.org/pub/gcc/infrastructure/") | |
42 | ||
76e639a0 | 43 | (define (gcc-configure-flags-for-triplet target) |
ca16cb96 LC |
44 | "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet. |
45 | ||
46 | The purpose of this procedure is to translate extended GNU triplets---e.g., | |
47 | where the OS part is overloaded to denote a specific ABI---into GCC | |
48 | `configure' options. We take extended GNU triplets that glibc recognizes." | |
49 | (cond ((string-match "^mips64el.*gnuabin?64$" target) | |
50 | ;; Triplets recognized by glibc as denoting the N64 ABI; see | |
51 | ;; ports/sysdeps/mips/preconfigure. | |
52 | '("--with-abi=64")) | |
3f00ff8b MW |
53 | |
54 | ((string-match "^arm.*-gnueabihf$" target) | |
55 | '("--with-arch=armv7-a" | |
56 | "--with-float=hard" | |
57 | "--with-mode=thumb" | |
58 | ||
59 | ;; See <https://wiki.debian.org/ArmHardFloatPort/VfpComparison#FPU> | |
60 | "--with-fpu=vfpv3-d16")) | |
61 | ||
ca16cb96 | 62 | (else |
3f00ff8b | 63 | ;; TODO: Add `arm.*-gnueabi', etc. |
ca16cb96 LC |
64 | '()))) |
65 | ||
e9c0b944 | 66 | (define-public gcc-4.7 |
9063ef0f | 67 | (let* ((stripped? #t) ;whether to strip the compiler, not the libraries |
de1d41f9 LC |
68 | (maybe-target-tools |
69 | (lambda () | |
70 | ;; Return the `_FOR_TARGET' variables that are needed when | |
71 | ;; cross-compiling GCC. | |
72 | (let ((target (%current-target-system))) | |
73 | (if target | |
74 | (map (lambda (var tool) | |
75 | (string-append (string-append var "_FOR_TARGET") | |
76 | "=" target "-" tool)) | |
77 | '("CC" "CXX" "LD" "AR" "NM" "RANLIB" "STRIP") | |
78 | '("gcc" "g++" "ld" "ar" "nm" "ranlib" "strip")) | |
79 | '())))) | |
7e3c9f74 LC |
80 | (libdir |
81 | (let ((base '(or (assoc-ref outputs "lib") | |
82 | (assoc-ref outputs "out")))) | |
83 | (lambda () | |
84 | ;; Return the directory that contains lib/libgcc_s.so et al. | |
85 | (if (%current-target-system) | |
86 | `(string-append ,base "/" ,(%current-target-system)) | |
87 | base)))) | |
de1d41f9 LC |
88 | (configure-flags |
89 | (lambda () | |
90 | ;; This is terrible. Since we have two levels of quasiquotation, | |
91 | ;; we have to do this convoluted thing just so we can insert the | |
92 | ;; contents of (maybe-target-tools). | |
93 | (list 'quasiquote | |
94 | (append | |
95 | '("--enable-plugin" | |
96 | "--enable-languages=c,c++" | |
97 | "--disable-multilib" | |
98 | ||
06213498 LC |
99 | ;; No pre-compiled libstdc++ headers, to save space. |
100 | "--disable-libstdcxx-pch" | |
101 | ||
de1d41f9 LC |
102 | "--with-local-prefix=/no-gcc-local-prefix" |
103 | ||
84e6756c LC |
104 | ;; With a separate "lib" output, the build system |
105 | ;; incorrectly guesses GPLUSPLUS_INCLUDE_DIR, so force | |
106 | ;; it. (Don't use a versioned sub-directory, that's | |
107 | ;; unnecessary.) | |
108 | ,(string-append "--with-gxx-include-dir=" | |
109 | (assoc-ref %outputs "out") | |
110 | "/include/c++") | |
111 | ||
de1d41f9 LC |
112 | ,(let ((libc (assoc-ref %build-inputs "libc"))) |
113 | (if libc | |
114 | (string-append "--with-native-system-header-dir=" libc | |
115 | "/include") | |
116 | "--without-headers"))) | |
117 | ||
76e639a0 MW |
118 | ;; Pass the right options for the target triplet. |
119 | (let ((triplet | |
120 | (or (%current-target-system) | |
121 | (nix-system->gnu-triplet (%current-system))))) | |
122 | (gcc-configure-flags-for-triplet triplet)) | |
ca16cb96 | 123 | |
de1d41f9 | 124 | (maybe-target-tools)))))) |
e9c0b944 | 125 | (package |
de1d41f9 | 126 | (name "gcc") |
d2e2f142 | 127 | (version "4.7.4") |
de1d41f9 LC |
128 | (source (origin |
129 | (method url-fetch) | |
130 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
131 | version "/gcc-" version ".tar.bz2")) | |
132 | (sha256 | |
133 | (base32 | |
d2e2f142 | 134 | "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj")))) |
de1d41f9 | 135 | (build-system gnu-build-system) |
84e6756c LC |
136 | |
137 | ;; Separate out the run-time support libraries because all the | |
138 | ;; dynamic-linked objects depend on it. | |
9063ef0f LC |
139 | (outputs '("out" ;commands, etc. (60+ MiB) |
140 | "lib" ;libgcc_s, libgomp, etc. (15+ MiB) | |
141 | "debug")) ;debug symbols of run-time libraries | |
84e6756c | 142 | |
de1d41f9 LC |
143 | (inputs `(("gmp" ,gmp) |
144 | ("mpfr" ,mpfr) | |
145 | ("mpc" ,mpc) | |
146 | ("isl" ,isl) | |
147 | ("cloog" ,cloog) | |
148 | ("libelf" ,libelf) | |
149 | ("zlib" ,zlib))) | |
c8ebc821 LC |
150 | |
151 | ;; GCC is one of the few packages that doesn't ship .info files. | |
152 | (native-inputs `(("texinfo" ,texinfo))) | |
153 | ||
de1d41f9 LC |
154 | (arguments |
155 | `(#:out-of-source? #t | |
de1d41f9 LC |
156 | #:configure-flags ,(configure-flags) |
157 | #:make-flags | |
fd0b2766 LC |
158 | ;; None of the flags below are needed when doing a Canadian cross. |
159 | ;; TODO: Simplify this. | |
160 | ,(if (%current-target-system) | |
161 | (if stripped? | |
162 | ''("CFLAGS=-g0 -O2") | |
163 | ''()) | |
164 | `(let* ((libc (assoc-ref %build-inputs "libc")) | |
165 | (libc-native (or (assoc-ref %build-inputs "libc-native") | |
166 | libc))) | |
167 | `(,@(if libc | |
168 | (list (string-append "LDFLAGS_FOR_TARGET=" | |
169 | "-B" libc "/lib " | |
170 | "-Wl,-dynamic-linker " | |
171 | "-Wl," libc | |
172 | ,(glibc-dynamic-linker))) | |
173 | '()) | |
174 | ||
175 | ;; Native programs like 'genhooks' also need that right. | |
176 | ,(string-append "LDFLAGS=" | |
177 | "-Wl,-rpath=" libc-native "/lib " | |
178 | "-Wl,-dynamic-linker " | |
179 | "-Wl," libc-native ,(glibc-dynamic-linker)) | |
180 | ,(string-append "BOOT_CFLAGS=-O2 " | |
181 | ,(if stripped? "-g0" "-g"))))) | |
de1d41f9 LC |
182 | |
183 | #:tests? #f | |
dfc8bb20 | 184 | |
de1d41f9 LC |
185 | #:phases |
186 | (alist-cons-before | |
187 | 'configure 'pre-configure | |
188 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
7e3c9f74 | 189 | (let ((libdir ,(libdir)) |
84e6756c | 190 | (libc (assoc-ref inputs "libc"))) |
de1d41f9 LC |
191 | (when libc |
192 | ;; The following is not performed for `--without-headers' | |
193 | ;; cross-compiler builds. | |
194 | ||
91c47bef MW |
195 | ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a |
196 | ;; single line, to allow the next step to work properly. | |
197 | (for-each | |
198 | (lambda (x) | |
199 | (substitute* (find-files "gcc/config" | |
3f00ff8b | 200 | "^linux(64|-elf|-eabi)?\\.h$") |
91c47bef MW |
201 | (("(#define GLIBC_DYNAMIC_LINKER.*)\\\\\n$" _ line) |
202 | line))) | |
203 | '(1 2 3)) | |
204 | ||
de1d41f9 LC |
205 | ;; Fix the dynamic linker's file name. |
206 | (substitute* (find-files "gcc/config" | |
3f00ff8b | 207 | "^linux(64|-elf|-eabi)?\\.h$") |
de1d41f9 LC |
208 | (("#define GLIBC_DYNAMIC_LINKER([^ ]*).*$" _ suffix) |
209 | (format #f "#define GLIBC_DYNAMIC_LINKER~a \"~a\"~%" | |
210 | suffix | |
211 | (string-append libc ,(glibc-dynamic-linker))))) | |
212 | ||
213 | ;; Tell where to find libstdc++, libc, and `?crt*.o', except | |
214 | ;; `crt{begin,end}.o', which come with GCC. | |
215 | (substitute* (find-files "gcc/config" | |
06213498 LC |
216 | "^gnu-user.*\\.h$") |
217 | (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix) | |
fa1e2f3d MW |
218 | ;; Help libgcc_s.so be found (see also below.) Always use |
219 | ;; '-lgcc_s' so that libgcc_s.so is always found by those | |
220 | ;; programs that use 'pthread_cancel' (glibc dlopens | |
221 | ;; libgcc_s.so when pthread_cancel support is needed, but | |
222 | ;; having it in the application's RUNPATH isn't enough; see | |
a7bf595f | 223 | ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.) |
270b501e MW |
224 | ;; |
225 | ;; NOTE: The '-lgcc_s' added below needs to be removed in a | |
226 | ;; later phase of %gcc-static. If you change the string | |
227 | ;; below, make sure to update the relevant code in | |
228 | ;; %gcc-static package as needed. | |
06213498 | 229 | (format #f "#define GNU_USER_TARGET_LIB_SPEC \ |
81197492 LC |
230 | \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a" |
231 | libc libc libdir suffix)) | |
06213498 | 232 | (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line) |
de1d41f9 | 233 | (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\" |
e9c0b944 | 234 | #define STANDARD_STARTFILE_PREFIX_2 \"\" |
06213498 | 235 | ~a" |
de1d41f9 LC |
236 | libc line)))) |
237 | ||
238 | ;; Don't retain a dependency on the build-time sed. | |
239 | (substitute* "fixincludes/fixincl.x" | |
240 | (("static char const sed_cmd_z\\[\\] =.*;") | |
84e6756c LC |
241 | "static char const sed_cmd_z[] = \"sed\";")) |
242 | ||
d0b62698 LC |
243 | (when (file-exists? "libbacktrace") |
244 | ;; GCC 4.8+ comes with libbacktrace. By default it builds | |
245 | ;; with -Werror, which fails with a -Wcast-qual error in glibc | |
246 | ;; 2.21's stdlib-bsearch.h. Remove -Werror. | |
247 | (substitute* "libbacktrace/configure" | |
248 | (("WARN_FLAGS=(.*)-Werror" _ flags) | |
ec299071 LC |
249 | (string-append "WARN_FLAGS=" flags))) |
250 | ||
251 | (when (file-exists? "libsanitizer/libbacktrace") | |
252 | ;; Same in libsanitizer's bundled copy (!) found in 4.9+. | |
253 | (substitute* "libsanitizer/libbacktrace/Makefile.in" | |
254 | (("-Werror") | |
255 | "")))) | |
d0b62698 | 256 | |
21e583de LC |
257 | ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s. |
258 | ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354> | |
259 | ;; and <http://bugs.gnu.org/20358>. | |
260 | (substitute* "libstdc++-v3/src/Makefile.in" | |
261 | (("^OPT_LDFLAGS = ") | |
262 | "OPT_LDFLAGS = -Wl,-rpath=$(libdir) ")) | |
263 | ||
84e6756c LC |
264 | ;; Move libstdc++*-gdb.py to the "lib" output to avoid a |
265 | ;; circularity between "out" and "lib". (Note: | |
266 | ;; --with-python-dir is useless because it imposes $(prefix) as | |
267 | ;; the parent directory.) | |
268 | (substitute* "libstdc++-v3/python/Makefile.in" | |
269 | (("pythondir = .*$") | |
270 | (string-append "pythondir = " libdir "/share" | |
271 | "/gcc-$(gcc_version)/python\n"))) | |
272 | ||
273 | ;; Avoid another circularity between the outputs: this #define | |
274 | ;; ends up in auto-host.h in the "lib" output, referring to | |
275 | ;; "out". (This variable is used to augment cpp's search path, | |
276 | ;; but there's nothing useful to look for here.) | |
277 | (substitute* "gcc/config.in" | |
278 | (("PREFIX_INCLUDE_DIR") | |
279 | "PREFIX_INCLUDE_DIR_isnt_necessary_here")))) | |
de1d41f9 LC |
280 | |
281 | (alist-cons-after | |
282 | 'configure 'post-configure | |
283 | (lambda _ | |
284 | ;; Don't store configure flags, to avoid retaining references to | |
6f58d582 | 285 | ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'. |
de1d41f9 LC |
286 | (substitute* "Makefile" |
287 | (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest) | |
288 | "TOPLEVEL_CONFIGURE_ARGUMENTS=\n"))) | |
9063ef0f | 289 | %standard-phases)))) |
de1d41f9 LC |
290 | |
291 | (native-search-paths | |
292 | (list (search-path-specification | |
293 | (variable "CPATH") | |
af070955 | 294 | (files '("include"))) |
de1d41f9 LC |
295 | (search-path-specification |
296 | (variable "LIBRARY_PATH") | |
af070955 | 297 | (files '("lib" "lib64"))))) |
de1d41f9 LC |
298 | |
299 | (properties `((gcc-libc . ,(assoc-ref inputs "libc")))) | |
300 | (synopsis "GNU Compiler Collection") | |
301 | (description | |
a22dc0c4 LC |
302 | "GCC is the GNU Compiler Collection. It provides compiler front-ends |
303 | for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and | |
79c311b8 | 304 | Go. It also includes runtime support libraries for these languages.") |
de1d41f9 LC |
305 | (license gpl3+) |
306 | (home-page "http://gcc.gnu.org/")))) | |
832abc76 | 307 | |
3b401612 | 308 | (define-public gcc-4.8 |
3b401612 | 309 | (package (inherit gcc-4.7) |
ab5f49cf | 310 | (version "4.8.5") |
3b401612 | 311 | (source (origin |
7e35b9dd LC |
312 | (method url-fetch) |
313 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
314 | version "/gcc-" version ".tar.bz2")) | |
315 | (sha256 | |
316 | (base32 | |
ab5f49cf | 317 | "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2")) |
7e35b9dd | 318 | (patches (list (search-patch "gcc-arm-link-spec-fix.patch"))))))) |
3b401612 | 319 | |
571aa6cd | 320 | (define-public gcc-4.9 |
7e35b9dd | 321 | (package (inherit gcc-4.8) |
6f317fa3 | 322 | (version "4.9.3") |
571aa6cd | 323 | (source (origin |
7e35b9dd LC |
324 | (method url-fetch) |
325 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
326 | version "/gcc-" version ".tar.bz2")) | |
327 | (sha256 | |
328 | (base32 | |
6f317fa3 MW |
329 | "0zmnm00d2a1hsd41g34bhvxzvxisa2l584q3p447bd91lfjv4ci3")) |
330 | (patches (list (search-patch "gcc-libvtv-runpath.patch"))))))) | |
571aa6cd | 331 | |
60e2d5fe | 332 | (define-public gcc-5.1 |
7e35b9dd | 333 | (package (inherit gcc-4.9) |
60e2d5fe MW |
334 | (version "5.1.0") |
335 | (source (origin | |
7e35b9dd LC |
336 | (method url-fetch) |
337 | (uri (string-append "mirror://gnu/gcc/gcc-" | |
338 | version "/gcc-" version ".tar.bz2")) | |
339 | (sha256 | |
340 | (base32 | |
341 | "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp")) | |
167a05aa LC |
342 | (patches (map search-patch |
343 | '("gcc-arm-link-spec-fix.patch" | |
344 | "gcc-5.0-libvtv-runpath.patch"))))))) | |
60e2d5fe | 345 | |
eed67cbb RW |
346 | (define-public gcc gcc-4.9) |
347 | ||
d0abf829 LC |
348 | (define-public (make-libstdc++ gcc) |
349 | "Return a libstdc++ package based on GCC. The primary use case is when | |
350 | using compilers other than GCC." | |
351 | (package | |
352 | (inherit gcc) | |
353 | (name "libstdc++") | |
354 | (arguments | |
355 | `(#:out-of-source? #t | |
356 | #:phases (alist-cons-before | |
357 | 'configure 'chdir | |
358 | (lambda _ | |
359 | (chdir "libstdc++-v3")) | |
360 | %standard-phases) | |
361 | #:configure-flags `("--disable-libstdcxx-pch" | |
362 | ,(string-append "--with-gxx-include-dir=" | |
363 | (assoc-ref %outputs "out") | |
364 | "/include")))) | |
365 | (outputs '("out" "debug")) | |
366 | (inputs '()) | |
367 | (native-inputs '()) | |
368 | (propagated-inputs '()) | |
369 | (synopsis "GNU C++ standard library"))) | |
370 | ||
371 | (define-public libstdc++-4.9 | |
372 | (make-libstdc++ gcc-4.9)) | |
373 | ||
2b6b6d13 RW |
374 | (define (make-libiberty gcc) |
375 | "Return a libiberty package based on GCC." | |
376 | (package | |
377 | (inherit gcc) | |
378 | (name "libiberty") | |
379 | (arguments | |
380 | `(#:out-of-source? #t | |
381 | #:phases | |
382 | (modify-phases %standard-phases | |
383 | (add-before 'configure 'chdir | |
384 | (lambda _ | |
385 | (chdir "libiberty") | |
386 | #t)) | |
387 | (replace | |
388 | 'install | |
389 | (lambda* (#:key outputs #:allow-other-keys) | |
390 | (let* ((out (assoc-ref outputs "out")) | |
391 | (lib (string-append out "/lib/")) | |
392 | (include (string-append out "/include/"))) | |
393 | (mkdir-p lib) | |
394 | (mkdir-p include) | |
395 | (copy-file "libiberty.a" | |
396 | (string-append lib "libiberty.a")) | |
397 | (copy-file "../include/libiberty.h" | |
398 | (string-append include "libiberty.h")) | |
399 | #t)))))) | |
400 | (inputs '()) | |
401 | (outputs '("out")) | |
402 | (native-inputs '()) | |
403 | (propagated-inputs '()) | |
404 | (synopsis "Collection of subroutines used by various GNU programs"))) | |
405 | ||
406 | (define-public libiberty | |
407 | (make-libiberty gcc)) | |
408 | ||
c4df90a5 | 409 | (define* (custom-gcc gcc name languages #:key (separate-lib-output? #t)) |
fdd6c726 NK |
410 | "Return a custom version of GCC that supports LANGUAGES." |
411 | (package (inherit gcc) | |
412 | (name name) | |
c4df90a5 MW |
413 | (outputs (if separate-lib-output? |
414 | (package-outputs gcc) | |
415 | (delete "lib" (package-outputs gcc)))) | |
fdd6c726 NK |
416 | (arguments |
417 | (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system) | |
418 | (guix build utils) | |
419 | (ice-9 regex) | |
420 | (srfi srfi-1) | |
421 | (srfi srfi-26)) | |
422 | ,@(package-arguments gcc)) | |
423 | ((#:configure-flags flags) | |
424 | `(cons (string-append "--enable-languages=" | |
425 | ,(string-join languages ",")) | |
426 | (remove (cut string-match "--enable-languages.*" <>) | |
427 | ,flags))))))) | |
428 | ||
429 | (define-public gfortran-4.8 | |
430 | (custom-gcc gcc-4.8 "gfortran" '("fortran"))) | |
431 | ||
c69a8b7b RW |
432 | (define-public gfortran-4.9 |
433 | (custom-gcc gcc-4.9 "gfortran" '("fortran"))) | |
434 | ||
eed67cbb RW |
435 | (define-public gfortran |
436 | (custom-gcc gcc "gfortran" '("fortran"))) | |
437 | ||
fdd6c726 | 438 | (define-public gccgo-4.8 |
c4df90a5 MW |
439 | (custom-gcc gcc-4.8 "gccgo" '("go") |
440 | ;; Suppress the separate "lib" output, because otherwise the | |
441 | ;; "lib" and "out" outputs would refer to each other, creating | |
442 | ;; a cyclic dependency. <http://debbugs.gnu.org/18101> | |
443 | #:separate-lib-output? #f)) | |
fdd6c726 | 444 | |
ed2b1c4f AE |
445 | (define javac.in |
446 | (origin | |
447 | (method url-fetch) | |
448 | (uri (string-append "http://sources.gentoo.org/cgi-bin/viewvc.cgi/" | |
61af1014 LC |
449 | "gentoo-x86/dev-java/gcj-jdk/files/javac.in?revision=1.1")) |
450 | (file-name "javac.in") | |
ed2b1c4f AE |
451 | (sha256 (base32 |
452 | "1c3dk4z5yfj6ic2fn3lyxs27n6pmn2wy9k0r1s17lnkf1bzkrciv")))) | |
453 | ||
74574fd1 RW |
454 | (define-public gcj-4.8 |
455 | (package (inherit gcc-4.8) | |
456 | (name "gcj") | |
457 | (inputs | |
458 | `(("fastjar" ,fastjar) | |
459 | ("perl" ,perl) | |
ed2b1c4f | 460 | ("javac.in" ,javac.in) |
74574fd1 RW |
461 | ("ecj-bootstrap" ,ecj-bootstrap-4.8) |
462 | ,@(package-inputs gcc-4.8))) | |
463 | ;; Suppress the separate "lib" output, because otherwise the | |
464 | ;; "lib" and "out" outputs would refer to each other, creating | |
465 | ;; a cyclic dependency. <http://debbugs.gnu.org/18101> | |
466 | (outputs | |
467 | (delete "lib" (package-outputs gcc-4.8))) | |
468 | (arguments | |
469 | (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system) | |
470 | (guix build utils) | |
471 | (ice-9 regex) | |
472 | (srfi srfi-1) | |
473 | (srfi srfi-26)) | |
474 | ,@(package-arguments gcc-4.8)) | |
475 | ((#:configure-flags flags) | |
476 | `(let ((ecj (assoc-ref %build-inputs "ecj-bootstrap"))) | |
477 | `("--enable-java-home" | |
478 | "--enable-gjdoc" | |
479 | ,(string-append "--with-ecj-jar=" ecj) | |
480 | "--enable-languages=java" | |
481 | ,@(remove (cut string-match "--enable-languages.*" <>) | |
482 | ,flags)))) | |
ad12c43e RW |
483 | ((#:phases phases) |
484 | `(modify-phases ,phases | |
485 | (add-after | |
486 | 'unpack 'add-lib-output-to-rpath | |
487 | (lambda _ | |
488 | (substitute* "libjava/Makefile.in" | |
489 | (("libgcj_bc_dummy_LINK = .* -shared" line) | |
490 | (string-append line " -Wl,-rpath=$(libdir)")) | |
491 | (("libgcj(_bc)?_la_LDFLAGS =" ldflags _) | |
492 | (string-append ldflags " -Wl,-rpath=$(libdir)"))))) | |
493 | (add-after | |
494 | 'install 'install-javac-and-javap-wrappers | |
495 | (lambda _ | |
496 | (let* ((javac (assoc-ref %build-inputs "javac.in")) | |
497 | (ecj (assoc-ref %build-inputs "ecj-bootstrap")) | |
498 | (gcj (assoc-ref %outputs "out")) | |
499 | (gcjbin (string-append gcj "/bin/")) | |
500 | (jvm (string-append gcj "/lib/jvm/")) | |
501 | (target (string-append jvm "/bin/javac"))) | |
502 | ||
503 | (symlink (string-append gcjbin "jcf-dump") | |
504 | (string-append jvm "/bin/javap")) | |
505 | ||
506 | (copy-file ecj (string-append gcj "/share/java/ecj.jar")) | |
507 | ||
508 | ;; Create javac wrapper from the template javac.in by | |
509 | ;; replacing the @VARIABLES@ with paths. | |
510 | (copy-file javac target) | |
511 | (patch-shebang target) | |
512 | (substitute* target | |
513 | (("@JAVA@") | |
514 | (string-append jvm "/bin/java")) | |
515 | (("@ECJ_JAR@") | |
516 | (string-append gcj "/share/java/ecj.jar")) | |
517 | (("@RT_JAR@") | |
518 | (string-append jvm "/jre/lib/rt.jar")) | |
519 | (("@TOOLS_JAR@") | |
520 | (string-append jvm "/lib/tools.jar"))) | |
521 | (chmod target #o755) | |
522 | #t))) | |
523 | (add-after | |
5f6887e8 RW |
524 | 'install 'remove-broken-or-conflicting-files |
525 | (lambda _ | |
526 | (let ((out (assoc-ref %outputs "out"))) | |
527 | (for-each | |
528 | delete-file | |
529 | (append (find-files (string-append out "/lib/jvm/jre/lib") | |
530 | "libjawt.so") | |
531 | (find-files (string-append out "/bin") | |
532 | ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)")))) | |
ad12c43e | 533 | #t)))))))) |
74574fd1 RW |
534 | |
535 | (define ecj-bootstrap-4.8 | |
536 | (origin | |
537 | (method url-fetch) | |
538 | (uri "ftp://sourceware.org/pub/java/ecj-4.8.jar") | |
539 | (sha256 | |
540 | (base32 | |
541 | "10fpqfbdzff1zcbxzh66xc8xbij9saykcj4xzm19wk9p3n7i5zcq")))) | |
542 | ||
fdd6c726 NK |
543 | (define-public gcc-objc-4.8 |
544 | (custom-gcc gcc-4.8 "gcc-objc" '("objc"))) | |
545 | ||
546 | (define-public gcc-objc++-4.8 | |
547 | (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++"))) | |
548 | ||
832abc76 LC |
549 | (define-public isl |
550 | (package | |
551 | (name "isl") | |
552 | (version "0.11.1") | |
553 | (source (origin | |
554 | (method url-fetch) | |
555 | (uri (list (string-append | |
590a4904 | 556 | "http://isl.gforge.inria.fr/isl-" |
832abc76 LC |
557 | version |
558 | ".tar.bz2") | |
559 | (string-append %gcc-infrastructure | |
560 | name "-" version ".tar.gz"))) | |
561 | (sha256 | |
562 | (base32 | |
563 | "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9")))) | |
564 | (build-system gnu-build-system) | |
565 | (inputs `(("gmp" ,gmp))) | |
590a4904 | 566 | (home-page "http://isl.gforge.inria.fr/") |
832abc76 | 567 | (synopsis |
9e771e3b LC |
568 | "Manipulating sets and relations of integer points \ |
569 | bounded by linear constraints") | |
832abc76 LC |
570 | (description |
571 | "isl is a library for manipulating sets and relations of integer points | |
35b9e423 | 572 | bounded by linear constraints. Supported operations on sets include |
832abc76 LC |
573 | intersection, union, set difference, emptiness check, convex hull, (integer) |
574 | affine hull, integer projection, computing the lexicographic minimum using | |
575 | parametric integer programming, coalescing and parametric vertex | |
35b9e423 | 576 | enumeration. It also includes an ILP solver based on generalized basis |
832abc76 LC |
577 | reduction, transitive closures on maps (which may encode infinite graphs), |
578 | dependence analysis and bounds on piecewise step-polynomials.") | |
579 | (license lgpl2.1+))) | |
580 | ||
581 | (define-public cloog | |
582 | (package | |
583 | (name "cloog") | |
584 | (version "0.18.0") | |
585 | (source | |
586 | (origin | |
587 | (method url-fetch) | |
588 | (uri (list (string-append | |
589 | "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-" | |
590 | version | |
591 | ".tar.gz") | |
592 | (string-append %gcc-infrastructure | |
593 | name "-" version ".tar.gz"))) | |
594 | (sha256 | |
595 | (base32 | |
596 | "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw")) | |
597 | (file-name (string-append name "-" version ".tar.gz")))) | |
598 | (build-system gnu-build-system) | |
599 | (inputs `(("gmp" ,gmp) | |
600 | ("isl" ,isl))) | |
601 | (arguments '(#:configure-flags '("--with-isl=system"))) | |
602 | (home-page "http://www.cloog.org/") | |
9e771e3b | 603 | (synopsis "Library to generate code for scanning Z-polyhedra") |
832abc76 LC |
604 | (description |
605 | "CLooG is a free software library to generate code for scanning | |
606 | Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that | |
607 | reaches each integral point of one or more parameterized polyhedra. | |
608 | CLooG has been originally written to solve the code generation problem | |
609 | for optimizing compilers based on the polytope model. Nevertheless it | |
610 | is used now in various area e.g., to build control automata for | |
611 | high-level synthesis or to find the best polynomial approximation of a | |
612 | function. CLooG may help in any situation where scanning polyhedra | |
613 | matters. While the user has full control on generated code quality, | |
614 | CLooG is designed to avoid control overhead and to produce a very | |
615 | effective code.") | |
616 | (license gpl2+))) | |
5c126b64 | 617 |