gcc.scm 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
  6. ;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
  8. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
  10. ;;; Copyright © 2020 Joseph LaFreniere <joseph@lafreniere.xyz>
  11. ;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
  12. ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
  13. ;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
  14. ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
  15. ;;;
  16. ;;; This file is part of GNU Guix.
  17. ;;;
  18. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  19. ;;; under the terms of the GNU General Public License as published by
  20. ;;; the Free Software Foundation; either version 3 of the License, or (at
  21. ;;; your option) any later version.
  22. ;;;
  23. ;;; GNU Guix is distributed in the hope that it will be useful, but
  24. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  25. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. ;;; GNU General Public License for more details.
  27. ;;;
  28. ;;; You should have received a copy of the GNU General Public License
  29. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  30. (define-module (gnu packages gcc)
  31. #:use-module ((guix licenses)
  32. #:select (gpl3+ gpl2+ lgpl2.1+ lgpl2.0+ fdl1.3+))
  33. #:use-module (gnu packages)
  34. #:use-module (gnu packages bootstrap)
  35. #:use-module (gnu packages compression)
  36. #:use-module (gnu packages multiprecision)
  37. #:use-module (gnu packages texinfo)
  38. #:use-module (gnu packages dejagnu)
  39. #:use-module (gnu packages documentation)
  40. #:use-module (gnu packages xml)
  41. #:use-module (gnu packages docbook)
  42. #:use-module (gnu packages graphviz)
  43. #:use-module (gnu packages elf)
  44. #:use-module (gnu packages perl)
  45. #:use-module (guix packages)
  46. #:use-module (guix download)
  47. #:use-module (guix build-system gnu)
  48. #:use-module (guix build-system trivial)
  49. #:use-module (guix gexp)
  50. #:use-module (guix utils)
  51. #:use-module (srfi srfi-1)
  52. #:use-module (ice-9 regex))
  53. (define %gcc-infrastructure
  54. ;; Base URL for GCC's infrastructure.
  55. "mirror://gcc/infrastructure/")
  56. (define (gcc-configure-flags-for-triplet target)
  57. "Return a list of additional GCC `configure' flags for TARGET, a GNU triplet.
  58. The purpose of this procedure is to translate extended GNU triplets---e.g.,
  59. where the OS part is overloaded to denote a specific ABI---into GCC
  60. `configure' options. We take extended GNU triplets that glibc recognizes."
  61. (cond ((string-match "^mips64el.*gnuabin?64$" target)
  62. ;; Triplets recognized by glibc as denoting the N64 ABI; see
  63. ;; ports/sysdeps/mips/preconfigure.
  64. '("--with-abi=64"))
  65. ((string-match "^arm.*-gnueabihf$" target)
  66. '("--with-arch=armv7-a"
  67. "--with-float=hard"
  68. "--with-mode=thumb"
  69. "--with-fpu=neon"))
  70. ((and (string-suffix? "-gnu" target)
  71. (not (string-contains target "-linux")))
  72. ;; Cross-compilation of libcilkrts in GCC 5.5.0 to GNU/Hurd fails
  73. ;; with:
  74. ;; libcilkrts/runtime/os-unix.c:388:2: error: #error "Unknown architecture"
  75. ;; Cilk has been removed from GCC 8 anyway.
  76. '("--disable-libcilkrts"))
  77. ;; glibc needs the 128-bit long double type on these architectures.
  78. ((or (string-prefix? "powerpc64le-" target)
  79. (string-prefix? "powerpc-" target))
  80. '("--with-long-double-128"))
  81. (else
  82. ;; TODO: Add `arm.*-gnueabi', etc.
  83. '())))
  84. (define-public gcc-4.7
  85. (let* ((stripped? #t) ;whether to strip the compiler, not the libraries
  86. (maybe-target-tools
  87. (lambda ()
  88. ;; Return the `_FOR_TARGET' variables that are needed when
  89. ;; cross-compiling GCC.
  90. (let ((target (%current-target-system)))
  91. (if target
  92. (map (lambda (var tool)
  93. (string-append (string-append var "_FOR_TARGET")
  94. "=" target "-" tool))
  95. '("CC" "CXX" "LD" "AR" "NM" "OBJDUMP" "RANLIB" "STRIP")
  96. '("gcc" "g++" "ld" "ar" "nm" "objdump" "ranlib" "strip"))
  97. '()))))
  98. (libdir
  99. (let ((base '(or (assoc-ref outputs "lib")
  100. (assoc-ref outputs "out"))))
  101. (lambda ()
  102. ;; Return the directory that contains lib/libgcc_s.so et al.
  103. (if (%current-target-system)
  104. `(string-append ,base "/" ,(%current-target-system))
  105. base))))
  106. (configure-flags
  107. (lambda ()
  108. ;; This is terrible. Since we have two levels of quasiquotation,
  109. ;; we have to do this convoluted thing just so we can insert the
  110. ;; contents of (maybe-target-tools).
  111. (list 'quasiquote
  112. (append
  113. '("--enable-plugin"
  114. "--enable-languages=c,c++"
  115. "--disable-multilib"
  116. "--with-system-zlib"
  117. ;; No pre-compiled libstdc++ headers, to save space.
  118. "--disable-libstdcxx-pch"
  119. "--with-local-prefix=/no-gcc-local-prefix"
  120. ;; With a separate "lib" output, the build system
  121. ;; incorrectly guesses GPLUSPLUS_INCLUDE_DIR, so force
  122. ;; it. (Don't use a versioned sub-directory, that's
  123. ;; unnecessary.)
  124. ,(string-append "--with-gxx-include-dir="
  125. (assoc-ref %outputs "out")
  126. "/include/c++")
  127. ,(let ((libc (assoc-ref %build-inputs "libc")))
  128. (if libc
  129. (string-append "--with-native-system-header-dir=" libc
  130. "/include")
  131. "--without-headers")))
  132. ;; Pass the right options for the target triplet.
  133. (let ((triplet
  134. (or (%current-target-system)
  135. (nix-system->gnu-triplet (%current-system)))))
  136. (gcc-configure-flags-for-triplet triplet))
  137. (maybe-target-tools))))))
  138. (hidden-package
  139. (package
  140. (name "gcc")
  141. (version "4.7.4")
  142. (source (origin
  143. (method url-fetch)
  144. (uri (string-append "mirror://gnu/gcc/gcc-"
  145. version "/gcc-" version ".tar.bz2"))
  146. (sha256
  147. (base32
  148. "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
  149. (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
  150. "gcc-fix-texi2pod.patch"))))
  151. (build-system gnu-build-system)
  152. ;; Separate out the run-time support libraries because all the
  153. ;; dynamic-linked objects depend on it.
  154. (outputs '("out" ;commands, etc. (60+ MiB)
  155. "lib" ;libgcc_s, libgomp, etc. (15+ MiB)
  156. "debug")) ;debug symbols of run-time libraries
  157. (inputs `(("gmp" ,gmp)
  158. ("mpfr" ,mpfr)
  159. ("mpc" ,mpc)
  160. ("libelf" ,libelf)
  161. ("zlib" ,zlib)))
  162. ;; GCC < 5 is one of the few packages that doesn't ship .info files.
  163. ;; Newer texinfos fail to build the manual, so we use an older one.
  164. (native-inputs `(("perl" ,perl) ;for manpages
  165. ("texinfo" ,texinfo-5)))
  166. (arguments
  167. `(#:out-of-source? #t
  168. #:configure-flags ,(configure-flags)
  169. #:make-flags
  170. ;; None of the flags below are needed when doing a Canadian cross.
  171. ;; TODO: Simplify this.
  172. ,(if (%current-target-system)
  173. (if stripped?
  174. ''("CFLAGS=-g0 -O2")
  175. ''())
  176. `(let* ((libc (assoc-ref %build-inputs "libc"))
  177. (libc-native (or (assoc-ref %build-inputs "libc-native")
  178. libc)))
  179. `(,@(if libc
  180. (list (string-append "LDFLAGS_FOR_TARGET="
  181. "-B" libc "/lib "
  182. "-Wl,-dynamic-linker "
  183. "-Wl," libc
  184. ,(glibc-dynamic-linker)))
  185. '())
  186. ;; Native programs like 'genhooks' also need that right.
  187. ,(string-append "LDFLAGS="
  188. "-Wl,-rpath=" libc-native "/lib "
  189. "-Wl,-dynamic-linker "
  190. "-Wl," libc-native ,(glibc-dynamic-linker))
  191. ,(string-append "BOOT_CFLAGS=-O2 "
  192. ,(if stripped? "-g0" "-g")))))
  193. #:tests? #f
  194. #:phases
  195. (modify-phases %standard-phases
  196. (add-before 'configure 'pre-configure
  197. (lambda* (#:key inputs outputs #:allow-other-keys)
  198. (let ((libdir ,(libdir))
  199. (libc (assoc-ref inputs "libc")))
  200. (when libc
  201. ;; The following is not performed for `--without-headers'
  202. ;; cross-compiler builds.
  203. ;; Join multi-line definitions of GLIBC_DYNAMIC_LINKER* into a
  204. ;; single line, to allow the next step to work properly.
  205. (for-each
  206. (lambda (x)
  207. (substitute* (find-files "gcc/config"
  208. "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
  209. (("(#define (GLIBC|GNU_USER)_DYNAMIC_LINKER.*)\\\\\n$" _ line)
  210. line)))
  211. '(1 2 3))
  212. ;; Fix the dynamic linker's file name.
  213. (substitute* (find-files "gcc/config"
  214. "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
  215. (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
  216. _ gnu-user suffix)
  217. (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
  218. gnu-user suffix
  219. (string-append libc ,(glibc-dynamic-linker)))))
  220. ;; Tell where to find libstdc++, libc, and `?crt*.o', except
  221. ;; `crt{begin,end}.o', which come with GCC.
  222. (substitute* (find-files "gcc/config"
  223. "^gnu-user.*\\.h$")
  224. (("#define GNU_USER_TARGET_LIB_SPEC (.*)$" _ suffix)
  225. ;; Help libgcc_s.so be found (see also below.) Always use
  226. ;; '-lgcc_s' so that libgcc_s.so is always found by those
  227. ;; programs that use 'pthread_cancel' (glibc dlopens
  228. ;; libgcc_s.so when pthread_cancel support is needed, but
  229. ;; having it in the application's RUNPATH isn't enough; see
  230. ;; <http://sourceware.org/ml/libc-help/2013-11/msg00023.html>.)
  231. ;;
  232. ;; NOTE: The '-lgcc_s' added below needs to be removed in a
  233. ;; later phase of %gcc-static. If you change the string
  234. ;; below, make sure to update the relevant code in
  235. ;; %gcc-static package as needed.
  236. (format #f "#define GNU_USER_TARGET_LIB_SPEC \
  237. \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
  238. libc libc libdir suffix))
  239. (("#define GNU_USER_TARGET_STARTFILE_SPEC.*$" line)
  240. (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
  241. #define STANDARD_STARTFILE_PREFIX_2 \"\"
  242. ~a"
  243. libc line)))
  244. ;; The rs6000 (a.k.a. powerpc) config in GCC does not use
  245. ;; GNU_USER_* defines. Do the above for this case.
  246. (substitute*
  247. "gcc/config/rs6000/sysv4.h"
  248. (("#define LIB_LINUX_SPEC (.*)$" _ suffix)
  249. (format #f "#define LIB_LINUX_SPEC \
  250. \"-L~a/lib %{!static:-rpath=~a/lib %{!static-libgcc:-rpath=~a/lib -lgcc_s}} \" ~a"
  251. libc libc libdir suffix))
  252. (("#define STARTFILE_LINUX_SPEC.*$" line)
  253. (format #f "#define STANDARD_STARTFILE_PREFIX_1 \"~a/lib\"
  254. #define STANDARD_STARTFILE_PREFIX_2 \"\"
  255. ~a"
  256. libc line))))
  257. (when (file-exists? "gcc/config/rs6000")
  258. ;; Force powerpc libdir to be /lib and not /lib64
  259. (substitute* (find-files "gcc/config/rs6000")
  260. (("/lib64") "/lib")))
  261. ;; Don't retain a dependency on the build-time sed.
  262. (substitute* "fixincludes/fixincl.x"
  263. (("static char const sed_cmd_z\\[\\] =.*;")
  264. "static char const sed_cmd_z[] = \"sed\";"))
  265. ;; Aarch64 support didn't land in GCC until the 4.8 series.
  266. (when (file-exists? "gcc/config/aarch64")
  267. ;; Force Aarch64 libdir to be /lib and not /lib64
  268. (substitute* "gcc/config/aarch64/t-aarch64-linux"
  269. (("lib64") "lib")))
  270. (when (file-exists? "libbacktrace")
  271. ;; GCC 4.8+ comes with libbacktrace. By default it builds
  272. ;; with -Werror, which fails with a -Wcast-qual error in glibc
  273. ;; 2.21's stdlib-bsearch.h. Remove -Werror.
  274. (substitute* "libbacktrace/configure"
  275. (("WARN_FLAGS=(.*)-Werror" _ flags)
  276. (string-append "WARN_FLAGS=" flags)))
  277. (when (file-exists? "libsanitizer/libbacktrace")
  278. ;; Same in libsanitizer's bundled copy (!) found in 4.9+.
  279. (substitute* "libsanitizer/libbacktrace/Makefile.in"
  280. (("-Werror")
  281. ""))))
  282. ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s.
  283. ;; See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354>
  284. ;; and <http://bugs.gnu.org/20358>.
  285. (substitute* "libstdc++-v3/src/Makefile.in"
  286. (("^OPT_LDFLAGS = ")
  287. "OPT_LDFLAGS = -Wl,-rpath=$(libdir) "))
  288. ;; Move libstdc++*-gdb.py to the "lib" output to avoid a
  289. ;; circularity between "out" and "lib". (Note:
  290. ;; --with-python-dir is useless because it imposes $(prefix) as
  291. ;; the parent directory.)
  292. (substitute* "libstdc++-v3/python/Makefile.in"
  293. (("pythondir = .*$")
  294. (string-append "pythondir = " libdir "/share"
  295. "/gcc-$(gcc_version)/python\n")))
  296. ;; Avoid another circularity between the outputs: this #define
  297. ;; ends up in auto-host.h in the "lib" output, referring to
  298. ;; "out". (This variable is used to augment cpp's search path,
  299. ;; but there's nothing useful to look for here.)
  300. (substitute* "gcc/config.in"
  301. (("PREFIX_INCLUDE_DIR")
  302. "PREFIX_INCLUDE_DIR_isnt_necessary_here")))))
  303. (add-after 'configure 'post-configure
  304. (lambda _
  305. ;; Don't store configure flags, to avoid retaining references to
  306. ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'.
  307. (substitute* "Makefile"
  308. (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest)
  309. "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")))))))
  310. (native-search-paths
  311. ;; Use the language-specific variables rather than 'CPATH' because they
  312. ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
  313. ;; The intent is to allow headers that are in the search path to be
  314. ;; treated as "system headers" (headers exempt from warnings) just like
  315. ;; the typical /usr/include headers on an FHS system.
  316. (list (search-path-specification
  317. (variable "C_INCLUDE_PATH")
  318. (files '("include")))
  319. (search-path-specification
  320. (variable "CPLUS_INCLUDE_PATH")
  321. ;; Add 'include/c++' here so that <cstdlib>'s "#include_next
  322. ;; <stdlib.h>" finds GCC's <stdlib.h>, not libc's.
  323. (files '("include/c++" "include")))
  324. (search-path-specification
  325. (variable "LIBRARY_PATH")
  326. (files '("lib" "lib64")))))
  327. (properties `((gcc-libc . ,(assoc-ref inputs "libc"))))
  328. (synopsis "GNU Compiler Collection")
  329. (description
  330. "GCC is the GNU Compiler Collection. It provides compiler front-ends
  331. for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and
  332. Go. It also includes runtime support libraries for these languages.")
  333. (license gpl3+)
  334. (supported-systems (delete "aarch64-linux" %supported-systems))
  335. (home-page "https://gcc.gnu.org/")))))
  336. (define-public gcc-4.8
  337. (package (inherit gcc-4.7)
  338. (version "4.8.5")
  339. (source (origin
  340. (method url-fetch)
  341. (uri (string-append "mirror://gnu/gcc/gcc-"
  342. version "/gcc-" version ".tar.bz2"))
  343. (sha256
  344. (base32
  345. "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"))
  346. (patches (search-patches "gcc-arm-link-spec-fix.patch"
  347. "gcc-4.8-libsanitizer-fix.patch"
  348. "gcc-asan-missing-include.patch"
  349. "gcc-fix-texi2pod.patch"))
  350. (modules '((guix build utils)))
  351. ;; This is required for building with glibc-2.26.
  352. ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
  353. (snippet
  354. '(for-each
  355. (lambda (dir)
  356. (substitute* (string-append "libgcc/config/"
  357. dir "/linux-unwind.h")
  358. (("struct ucontext") "ucontext_t")))
  359. '("aarch64" "alpha" "bfin" "i386" "m68k"
  360. "pa" "sh" "tilepro" "xtensa")))))
  361. (supported-systems %supported-systems)
  362. (inputs
  363. `(("isl" ,isl-0.11)
  364. ("cloog" ,cloog)
  365. ,@(package-inputs gcc-4.7)))))
  366. (define-public gcc-4.9
  367. (package (inherit gcc-4.8)
  368. (version "4.9.4")
  369. (source (origin
  370. (method url-fetch)
  371. (uri (string-append "mirror://gnu/gcc/gcc-"
  372. version "/gcc-" version ".tar.bz2"))
  373. (sha256
  374. (base32
  375. "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc"))
  376. (patches (search-patches "gcc-4.9-libsanitizer-fix.patch"
  377. "gcc-4.9-libsanitizer-ustat.patch"
  378. "gcc-4.9-libsanitizer-mode-size.patch"
  379. "gcc-arm-bug-71399.patch"
  380. "gcc-asan-missing-include.patch"
  381. "gcc-libvtv-runpath.patch"
  382. "gcc-fix-texi2pod.patch"))
  383. (modules '((guix build utils)))
  384. ;; This is required for building with glibc-2.26.
  385. ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
  386. (snippet
  387. '(for-each
  388. (lambda (dir)
  389. (substitute* (string-append "libgcc/config/"
  390. dir "/linux-unwind.h")
  391. (("struct ucontext") "ucontext_t")))
  392. '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2"
  393. "pa" "sh" "tilepro" "xtensa")))))
  394. ;; Override inherited texinfo-5 with latest version.
  395. (native-inputs `(("perl" ,perl) ;for manpages
  396. ("texinfo" ,texinfo)))
  397. (arguments
  398. (if (%current-target-system)
  399. (package-arguments gcc-4.8)
  400. ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs
  401. ;; to be adjusted so it does not interfere with GCC's own build processes.
  402. (substitute-keyword-arguments (package-arguments gcc-4.8)
  403. ((#:modules modules %gnu-build-system-modules)
  404. `((srfi srfi-1)
  405. ,@modules))
  406. ((#:phases phases)
  407. `(modify-phases ,phases
  408. (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
  409. (lambda* (#:key inputs #:allow-other-keys)
  410. (let ((libc (assoc-ref inputs "libc"))
  411. (gcc (assoc-ref inputs "gcc")))
  412. (setenv "CPLUS_INCLUDE_PATH"
  413. (string-join (fold delete
  414. (string-split (getenv "CPLUS_INCLUDE_PATH")
  415. #\:)
  416. (list (string-append libc "/include")
  417. (string-append gcc "/include/c++")))
  418. ":"))
  419. (format #t
  420. "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
  421. (getenv "CPLUS_INCLUDE_PATH"))))))))))))
  422. (define gcc-canadian-cross-objdump-snippet
  423. ;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that,
  424. ;; 'libcc1/configure' wrongfully determines that '-rdynamic' support is
  425. ;; missing because $gcc_cv_objdump is empty:
  426. ;;
  427. ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590
  428. ;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077
  429. #~(substitute* "libcc1/configure"
  430. (("\\$gcc_cv_objdump -T")
  431. "$OBJDUMP_FOR_TARGET -T")))
  432. (define-public gcc-5
  433. ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install
  434. ;; them in a VPATH build.
  435. (package (inherit gcc-4.9)
  436. (version "5.5.0")
  437. (source (origin
  438. (method url-fetch)
  439. (uri (string-append "mirror://gnu/gcc/gcc-"
  440. version "/gcc-" version ".tar.xz"))
  441. (sha256
  442. (base32
  443. "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k"))
  444. (patches (search-patches "gcc-arm-bug-71399.patch"
  445. "gcc-libsanitizer-ustat.patch"
  446. "gcc-strmov-store-file-names.patch"
  447. "gcc-5.0-libvtv-runpath.patch"
  448. "gcc-5-source-date-epoch-1.patch"
  449. "gcc-5-source-date-epoch-2.patch"
  450. "gcc-6-libsanitizer-mode-size.patch"
  451. "gcc-fix-texi2pod.patch"
  452. "gcc-5-hurd.patch"))
  453. (modules '((guix build utils)))
  454. (snippet gcc-canadian-cross-objdump-snippet)))
  455. (inputs
  456. `(;; GCC5 needs <isl/band.h> which is removed in later versions.
  457. ("isl" ,isl-0.18)
  458. ,@(package-inputs gcc-4.7)))))
  459. (define-public gcc-6
  460. (package
  461. (inherit gcc-5)
  462. (version "6.5.0")
  463. (source (origin
  464. (method url-fetch)
  465. (uri (string-append "mirror://gnu/gcc/gcc-"
  466. version "/gcc-" version ".tar.xz"))
  467. (sha256
  468. (base32
  469. "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby"))
  470. (patches (search-patches "gcc-strmov-store-file-names.patch"
  471. "gcc-6-libsanitizer-mode-size.patch"
  472. "gcc-6-source-date-epoch-1.patch"
  473. "gcc-6-source-date-epoch-2.patch"
  474. "gcc-5.0-libvtv-runpath.patch"))))
  475. ;; GCC 4.9 and 5 has a workaround that is not needed for GCC 6 and later.
  476. (arguments (package-arguments gcc-4.8))
  477. (inputs
  478. `(("isl" ,isl)
  479. ;; XXX: This gross hack allows us to have libstdc++'s <bits/c++config.h>
  480. ;; in the search path, thereby avoiding misconfiguration of libstdc++:
  481. ;; <https://bugs.gnu.org/42392>.
  482. ("libstdc++" ,libstdc++-headers)
  483. ,@(package-inputs gcc-4.7)))))
  484. (define-public gcc-7
  485. (package
  486. (inherit gcc-6)
  487. (version "7.5.0")
  488. (source (origin
  489. (method url-fetch)
  490. (uri (string-append "mirror://gnu/gcc/gcc-"
  491. version "/gcc-" version ".tar.xz"))
  492. (sha256
  493. (base32
  494. "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq"))
  495. (patches (search-patches "gcc-strmov-store-file-names.patch"
  496. "gcc-7-libsanitizer-mode-size.patch"
  497. "gcc-5.0-libvtv-runpath.patch"))))
  498. (description
  499. "GCC is the GNU Compiler Collection. It provides compiler front-ends
  500. for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
  501. It also includes runtime support libraries for these languages.")))
  502. (define-public gcc-8
  503. (package
  504. (inherit gcc-7)
  505. (version "8.5.0")
  506. (source (origin
  507. (method url-fetch)
  508. (uri (string-append "mirror://gnu/gcc/gcc-"
  509. version "/gcc-" version ".tar.xz"))
  510. (sha256
  511. (base32
  512. "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k"))
  513. (patches (search-patches "gcc-8-strmov-store-file-names.patch"
  514. "gcc-5.0-libvtv-runpath.patch"
  515. "gcc-8-sort-libtool-find-output.patch"))
  516. (modules '((guix build utils)))
  517. (snippet gcc-canadian-cross-objdump-snippet)))))
  518. (define-public gcc-9
  519. (package
  520. (inherit gcc-8)
  521. (version "9.4.0")
  522. (source (origin
  523. (method url-fetch)
  524. (uri (string-append "mirror://gnu/gcc/gcc-"
  525. version "/gcc-" version ".tar.xz"))
  526. (sha256
  527. (base32
  528. "13l3p6g2krilaawbapmn9zmmrh3zdwc36mfr3msxfy038hps6pf9"))
  529. (patches (search-patches "gcc-9-strmov-store-file-names.patch"
  530. "gcc-9-asan-fix-limits-include.patch"
  531. "gcc-5.0-libvtv-runpath.patch"))
  532. (modules '((guix build utils)))
  533. (snippet gcc-canadian-cross-objdump-snippet)))))
  534. (define-public gcc-10
  535. (package
  536. (inherit gcc-8)
  537. (version "10.3.0")
  538. (source (origin
  539. (method url-fetch)
  540. (uri (string-append "mirror://gnu/gcc/gcc-"
  541. version "/gcc-" version ".tar.xz"))
  542. (sha256
  543. (base32
  544. "0i6378ig6h397zkhd7m4ccwjx5alvzrf2hm27p1pzwjhlv0h9x34"))
  545. (patches (search-patches "gcc-9-strmov-store-file-names.patch"
  546. "gcc-5.0-libvtv-runpath.patch"))
  547. (modules '((guix build utils)))
  548. (snippet gcc-canadian-cross-objdump-snippet)))))
  549. (define-public gcc-11
  550. (package
  551. (inherit gcc-8)
  552. (version "11.2.0")
  553. (source (origin
  554. (method url-fetch)
  555. (uri (string-append "mirror://gnu/gcc/gcc-"
  556. version "/gcc-" version ".tar.xz"))
  557. (sha256
  558. (base32
  559. "12zs6vd2rapp42x154m479hg3h3lsafn3xhg06hp5hsldd9xr3nh"))
  560. (patches (search-patches "gcc-9-strmov-store-file-names.patch"
  561. "gcc-5.0-libvtv-runpath.patch"))
  562. (modules '((guix build utils)))
  563. (snippet gcc-canadian-cross-objdump-snippet)))))
  564. ;; Note: When changing the default gcc version, update
  565. ;; the gcc-toolchain-* definitions.
  566. (define-public gcc gcc-10)
  567. (define-public (make-libstdc++ gcc)
  568. "Return a libstdc++ package based on GCC. The primary use case is when
  569. using compilers other than GCC."
  570. (package
  571. (inherit gcc)
  572. (name "libstdc++")
  573. (arguments
  574. `(#:out-of-source? #t
  575. #:phases
  576. (modify-phases %standard-phases
  577. ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
  578. (add-before 'chdir 'fix-rs6000-libdir
  579. (lambda _
  580. (when (file-exists? "gcc/config/rs6000")
  581. (substitute* (find-files "gcc/config/rs6000")
  582. (("/lib64") "/lib")))))
  583. (add-before 'configure 'chdir
  584. (lambda _
  585. (chdir "libstdc++-v3"))))
  586. #:configure-flags `("--disable-libstdcxx-pch"
  587. ,(string-append "--with-gxx-include-dir="
  588. (assoc-ref %outputs "out")
  589. "/include"))))
  590. (outputs '("out" "debug"))
  591. (inputs '())
  592. (native-inputs '())
  593. (propagated-inputs '())
  594. (synopsis "GNU C++ standard library")))
  595. (define libstdc++
  596. ;; Libstdc++ matching the default GCC.
  597. (make-libstdc++ gcc))
  598. (define libstdc++-headers
  599. ;; XXX: This package is for internal use to work around
  600. ;; <https://bugs.gnu.org/42392> (see above). The main difference compared
  601. ;; to the libstdc++ headers that come with 'gcc' is that <bits/c++config.h>
  602. ;; is right under include/c++ and not under
  603. ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR).
  604. (package
  605. (inherit libstdc++)
  606. (name "libstdc++-headers")
  607. (outputs '("out"))
  608. (build-system trivial-build-system)
  609. (arguments
  610. '(#:builder (let* ((out (assoc-ref %outputs "out"))
  611. (libstdc++ (assoc-ref %build-inputs "libstdc++")))
  612. (mkdir out)
  613. (mkdir (string-append out "/include"))
  614. (symlink (string-append libstdc++ "/include")
  615. (string-append out "/include/c++")))))
  616. (inputs `(("libstdc++" ,libstdc++)))
  617. (synopsis "Headers of GNU libstdc++")))
  618. (define-public libstdc++-4.9
  619. (make-libstdc++ gcc-4.9))
  620. (define (make-libiberty gcc)
  621. "Return a libiberty package based on GCC."
  622. (package
  623. (inherit gcc)
  624. (name "libiberty")
  625. (arguments
  626. `(#:out-of-source? #t
  627. #:phases
  628. (modify-phases %standard-phases
  629. (add-before 'configure 'chdir
  630. (lambda _
  631. (chdir "libiberty")))
  632. (replace 'install
  633. (lambda* (#:key outputs #:allow-other-keys)
  634. (let* ((out (assoc-ref outputs "out"))
  635. (lib (string-append out "/lib/"))
  636. (include (string-append out "/include/")))
  637. (install-file "libiberty.a" lib)
  638. (install-file "../include/libiberty.h" include)))))))
  639. (inputs '())
  640. (outputs '("out"))
  641. (native-inputs '())
  642. (propagated-inputs '())
  643. (properties '())
  644. (synopsis "Collection of subroutines used by various GNU programs")))
  645. (define-public libiberty
  646. (make-libiberty gcc))
  647. (define* (custom-gcc gcc name languages
  648. #:optional
  649. (search-paths (package-native-search-paths gcc))
  650. #:key (separate-lib-output? #t))
  651. "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
  652. as the 'native-search-paths' field."
  653. (package (inherit gcc)
  654. (name name)
  655. (outputs (if separate-lib-output?
  656. (package-outputs gcc)
  657. (delete "lib" (package-outputs gcc))))
  658. (native-search-paths search-paths)
  659. (properties (alist-delete 'hidden? (package-properties gcc)))
  660. (arguments
  661. (substitute-keyword-arguments (package-arguments gcc)
  662. ((#:modules modules %gnu-build-system-modules)
  663. `(,@modules
  664. (srfi srfi-1)
  665. (srfi srfi-26)
  666. (ice-9 regex)))
  667. ((#:configure-flags flags)
  668. `(cons (string-append "--enable-languages="
  669. ,(string-join languages ","))
  670. (remove (cut string-match "--enable-languages.*" <>)
  671. ,flags)))
  672. ((#:phases phases)
  673. `(modify-phases ,phases
  674. (add-after 'install 'remove-broken-or-conflicting-files
  675. (lambda* (#:key outputs #:allow-other-keys)
  676. (for-each
  677. delete-file
  678. (find-files (string-append (assoc-ref outputs "out") "/bin")
  679. ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|lto)(-.*)?$"))))))))))
  680. (define* (custom-gcc-gccgo gcc name languages
  681. #:optional
  682. (search-paths (package-native-search-paths gcc))
  683. #:key (separate-lib-output? #t))
  684. ;; TODO: remove CUSTOM-GCC-GCCGO when regex changes for CUSTOM-GCC are
  685. ;; merged into master <https://issues.guix.gnu.org/49010>
  686. "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS
  687. as the 'native-search-paths' field."
  688. (package (inherit gcc)
  689. (name name)
  690. (outputs (if separate-lib-output?
  691. (package-outputs gcc)
  692. (delete "lib" (package-outputs gcc))))
  693. (native-search-paths search-paths)
  694. (properties (alist-delete 'hidden? (package-properties gcc)))
  695. (arguments
  696. (substitute-keyword-arguments (package-arguments gcc)
  697. ((#:modules modules %gnu-build-system-modules)
  698. `(,@modules
  699. (srfi srfi-1)
  700. (srfi srfi-26)
  701. (ice-9 regex)))
  702. ((#:configure-flags flags)
  703. `(cons (string-append "--enable-languages="
  704. ,(string-join languages ","))
  705. (remove (cut string-match "--enable-languages.*" <>)
  706. ,flags)))
  707. ((#:phases phases)
  708. `(modify-phases ,phases
  709. (add-after 'install 'remove-broken-or-conflicting-files
  710. (lambda* (#:key outputs #:allow-other-keys)
  711. (for-each
  712. delete-file
  713. (find-files (string-append (assoc-ref outputs "out") "/bin")
  714. ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|lto)(-.*)?$"))))))))))
  715. (define %generic-search-paths
  716. ;; This is the language-neutral search path for GCC. Entries in $CPATH are
  717. ;; not considered "system headers", which means GCC can raise warnings for
  718. ;; issues in those headers. 'CPATH' is the only one that works for
  719. ;; front-ends not in the C family.
  720. (list (search-path-specification
  721. (variable "CPATH")
  722. (files '("include")))
  723. (search-path-specification
  724. (variable "LIBRARY_PATH")
  725. (files '("lib" "lib64")))))
  726. (define-public gfortran
  727. (hidden-package
  728. (custom-gcc gcc
  729. "gfortran" '("fortran")
  730. %generic-search-paths)))
  731. (define-public gdc-10
  732. (hidden-package
  733. (custom-gcc gcc-10 "gdc" '("d")
  734. %generic-search-paths)))
  735. (define-public gdc-11
  736. (hidden-package
  737. (custom-gcc gcc-11 "gdc" '("d")
  738. %generic-search-paths)))
  739. (define-public libgccjit
  740. (package
  741. (inherit gcc-9)
  742. (name "libgccjit")
  743. (outputs (delete "lib" (package-outputs gcc)))
  744. (properties (alist-delete 'hidden? (package-properties gcc)))
  745. (arguments
  746. (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system)
  747. (guix build utils)
  748. (ice-9 regex)
  749. (srfi srfi-1)
  750. (srfi srfi-26))
  751. ,@(package-arguments gcc))
  752. ((#:configure-flags flags)
  753. `(append `("--enable-host-shared"
  754. ,(string-append "--enable-languages=jit"))
  755. (remove (cut string-match "--enable-languages.*" <>)
  756. ,flags)))
  757. ((#:phases phases)
  758. `(modify-phases ,phases
  759. (add-after 'install 'remove-broken-or-conflicting-files
  760. (lambda* (#:key outputs #:allow-other-keys)
  761. (for-each delete-file
  762. (find-files (string-append (assoc-ref outputs "out") "/bin")
  763. ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)"))))))))
  764. (synopsis "GCC library generating machine code on-the-fly at runtime")
  765. (description
  766. "This package is part of the GNU Compiler Collection and provides an
  767. embeddable library for generating machine code on-the-fly at runtime. This
  768. shared library can then be dynamically-linked into bytecode interpreters and
  769. other such programs that want to generate machine code on-the-fly at run-time.
  770. It can also be used for ahead-of-time code generation for building standalone
  771. compilers. The just-in-time (jit) part of the name is now something of a
  772. misnomer.")))
  773. (define (make-gccgo gcc)
  774. "Return a gccgo package based on GCC."
  775. (let ((gccgo (custom-gcc-gccgo gcc "gccgo" '("go") %generic-search-paths)))
  776. (package
  777. (inherit gccgo)
  778. (synopsis "Go frontend to GCC")
  779. (description
  780. "This package is part of the GNU Compiler Collection and
  781. provides the GNU compiler for the Go programming language.")
  782. (arguments
  783. (substitute-keyword-arguments (package-arguments gccgo)
  784. ((#:phases phases)
  785. `(modify-phases ,phases
  786. (add-after 'install 'wrap-go-with-tool-path
  787. (lambda* (#:key outputs #:allow-other-keys)
  788. (let* ((out (assoc-ref outputs "out"))
  789. (exedir (string-append out "/libexec/gcc"))
  790. (tooldir (dirname (car (find-files exedir "^cgo$")))))
  791. (wrap-program (string-append out "/bin/go")
  792. `("GCCGOTOOLDIR" =
  793. (,(string-append "${GCCGOTOOLDIR-" tooldir "}")))
  794. `("GOROOT" =
  795. (,(string-append "${GOROOT-" out "}")))))))
  796. (add-before 'configure 'fix-gotools-runpath
  797. (lambda _
  798. (substitute* "gotools/Makefile.in"
  799. (("AM_LDFLAGS =" all)
  800. (string-append all " -Wl,-rpath=$(libdir) ")))))
  801. (add-before 'configure 'remove-tool-reference-from-libgo
  802. (lambda _
  803. (substitute* "libgo/Makefile.in"
  804. (("(GccgoToolDir = \\\")[^\\\"]+" _ start)
  805. (string-append start "/nonexistent"))
  806. (("(DefaultGoroot = \\\")[^\\\"]+" _ start)
  807. (string-append start "/nonexistent"))
  808. (("(defaultGOROOTValue.*?return `)[^`]+" _ start)
  809. (string-append start "/nonexistent"))))))))))))
  810. (define-public gccgo-4.9
  811. (custom-gcc (package
  812. (inherit gcc-4.9)
  813. (synopsis "Go frontend to GCC")
  814. (description
  815. "This package is part of the GNU Compiler Collection and
  816. provides the GNU compiler for the Go programming language."))
  817. "gccgo" '("go")
  818. %generic-search-paths
  819. ;; Suppress the separate "lib" output, because otherwise the
  820. ;; "lib" and "out" outputs would refer to each other, creating
  821. ;; a cyclic dependency. <http://debbugs.gnu.org/18101>
  822. #:separate-lib-output? #f))
  823. (define-public gccgo-10
  824. (make-gccgo gcc-10))
  825. (define %objc-search-paths
  826. (list (search-path-specification
  827. (variable "OBJC_INCLUDE_PATH")
  828. (files '("include")))
  829. (search-path-specification
  830. (variable "LIBRARY_PATH")
  831. (files '("lib" "lib64")))))
  832. (define-public gcc-objc-4.8
  833. (custom-gcc gcc-4.8 "gcc-objc" '("objc")
  834. %objc-search-paths))
  835. (define-public gcc-objc-4.9
  836. (custom-gcc gcc-4.9 "gcc-objc" '("objc")
  837. %objc-search-paths))
  838. (define-public gcc-objc-5
  839. (custom-gcc gcc-5 "gcc-objc" '("objc")
  840. %objc-search-paths))
  841. (define-public gcc-objc-6
  842. (custom-gcc gcc-6 "gcc-objc" '("objc")
  843. %objc-search-paths))
  844. (define-public gcc-objc-7
  845. (custom-gcc gcc-7 "gcc-objc" '("objc")
  846. %objc-search-paths))
  847. (define-public gcc-objc-8
  848. (custom-gcc gcc-8 "gcc-objc" '("objc")
  849. %objc-search-paths))
  850. (define-public gcc-objc-9
  851. (custom-gcc gcc-9 "gcc-objc" '("objc")
  852. %objc-search-paths))
  853. (define-public gcc-objc-10
  854. (custom-gcc gcc-10 "gcc-objc" '("objc")
  855. %objc-search-paths))
  856. (define-public gcc-objc gcc-objc-10)
  857. (define %objc++-search-paths
  858. (list (search-path-specification
  859. (variable "OBJCPLUS_INCLUDE_PATH")
  860. (files '("include")))
  861. (search-path-specification
  862. (variable "LIBRARY_PATH")
  863. (files '("lib" "lib64")))))
  864. (define-public gcc-objc++-4.8
  865. (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
  866. %objc++-search-paths))
  867. (define-public gcc-objc++-4.9
  868. (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++")
  869. %objc++-search-paths))
  870. (define-public gcc-objc++-5
  871. (custom-gcc gcc-5 "gcc-objc++" '("obj-c++")
  872. %objc++-search-paths))
  873. (define-public gcc-objc++-6
  874. (custom-gcc gcc-6 "gcc-objc++" '("obj-c++")
  875. %objc++-search-paths))
  876. (define-public gcc-objc++-7
  877. (custom-gcc gcc-7 "gcc-objc++" '("obj-c++")
  878. %objc++-search-paths))
  879. (define-public gcc-objc++-8
  880. (custom-gcc gcc-8 "gcc-objc++" '("obj-c++")
  881. %objc++-search-paths))
  882. (define-public gcc-objc++-9
  883. (custom-gcc gcc-9 "gcc-objc++" '("obj-c++")
  884. %objc++-search-paths))
  885. (define-public gcc-objc++-10
  886. (custom-gcc gcc-10 "gcc-objc++" '("obj-c++")
  887. %objc++-search-paths))
  888. (define-public gcc-objc++ gcc-objc++-10)
  889. (define (make-libstdc++-doc gcc)
  890. "Return a package with the libstdc++ documentation for GCC."
  891. (package
  892. (inherit gcc)
  893. (name "libstdc++-doc")
  894. (version (package-version gcc))
  895. (synopsis "GNU libstdc++ documentation")
  896. (outputs '("out"))
  897. (native-inputs `(("doxygen" ,doxygen)
  898. ("texinfo" ,texinfo)
  899. ("libxml2" ,libxml2)
  900. ("libxslt" ,libxslt)
  901. ("docbook-xml" ,docbook-xml)
  902. ("docbook-xsl" ,docbook-xsl)
  903. ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen'
  904. (inputs '())
  905. (propagated-inputs '())
  906. (arguments
  907. '(#:out-of-source? #t
  908. #:tests? #f ;it's just documentation
  909. #:phases (modify-phases %standard-phases
  910. (add-before 'configure 'chdir
  911. (lambda _
  912. (chdir "libstdc++-v3")))
  913. (add-before 'configure 'set-xsl-directory
  914. (lambda* (#:key inputs #:allow-other-keys)
  915. (let ((docbook (assoc-ref inputs "docbook-xsl")))
  916. (substitute* (find-files "doc"
  917. "^Makefile\\.in$")
  918. (("@XSL_STYLE_DIR@")
  919. (string-append
  920. docbook "/xml/xsl/"
  921. (strip-store-file-name docbook)))))))
  922. (replace 'build
  923. (lambda _
  924. ;; XXX: There's also a 'doc-info' target, but it
  925. ;; relies on docbook2X, which itself relies on
  926. ;; DocBook 4.1.2, which is not really usable
  927. ;; (lacks a catalog.xml.)
  928. (invoke "make"
  929. "doc-html"
  930. "doc-man")))
  931. (replace 'install
  932. (lambda* (#:key outputs #:allow-other-keys)
  933. (let ((out (assoc-ref outputs "out")))
  934. (invoke "make"
  935. "doc-install-html"
  936. "doc-install-man")))))))
  937. (properties (alist-delete 'hidden? (package-properties gcc)))))
  938. (define-public libstdc++-doc-5
  939. (make-libstdc++-doc gcc-5))
  940. (define-public libstdc++-doc-9
  941. (make-libstdc++-doc gcc-9))
  942. (define-public isl
  943. (package
  944. (name "isl")
  945. (version "0.23")
  946. (source (origin
  947. (method url-fetch)
  948. (uri (list (string-append
  949. "http://isl.gforge.inria.fr/isl-"
  950. version
  951. ".tar.bz2")
  952. (string-append %gcc-infrastructure
  953. name "-" version ".tar.bz2")))
  954. (sha256
  955. (base32
  956. "0k91zck10zxs9sk3yrbb92y1j3w981w3fbwkfwd7kl779b0j52f5"))))
  957. (build-system gnu-build-system)
  958. (outputs '("out" "static"))
  959. (arguments
  960. '(#:phases (modify-phases %standard-phases
  961. (add-after 'install 'move-static-library
  962. (lambda* (#:key outputs #:allow-other-keys)
  963. (let* ((out (assoc-ref outputs "out"))
  964. (static (assoc-ref outputs "static"))
  965. (source (string-append out "/lib/libisl.a"))
  966. (target (string-append static "/lib/libisl.a")))
  967. (mkdir-p (dirname target))
  968. (link source target)
  969. (delete-file source)
  970. ;; Remove reference to libisl.a from the .la file so
  971. ;; libtool looks for it in the usual locations.
  972. (substitute* (string-append out "/lib/libisl.la")
  973. (("^old_library=.*")
  974. "old_library=''\n"))))))))
  975. (inputs `(("gmp" ,gmp)))
  976. (home-page "http://isl.gforge.inria.fr/")
  977. (synopsis
  978. "Manipulating sets and relations of integer points \
  979. bounded by linear constraints")
  980. (description
  981. "isl is a library for manipulating sets and relations of integer points
  982. bounded by linear constraints. Supported operations on sets include
  983. intersection, union, set difference, emptiness check, convex hull, (integer)
  984. affine hull, integer projection, computing the lexicographic minimum using
  985. parametric integer programming, coalescing and parametric vertex
  986. enumeration. It also includes an ILP solver based on generalized basis
  987. reduction, transitive closures on maps (which may encode infinite graphs),
  988. dependence analysis and bounds on piecewise step-polynomials.")
  989. (license lgpl2.1+)))
  990. (define-public isl-0.18
  991. (package
  992. (inherit isl)
  993. (version "0.18")
  994. (source (origin
  995. (method url-fetch)
  996. (uri (list (string-append "http://isl.gforge.inria.fr/isl-"
  997. version ".tar.bz2")
  998. (string-append %gcc-infrastructure
  999. "isl-" version ".tar.bz2")))
  1000. (sha256
  1001. (base32
  1002. "06ybml6llhi4i56q90jnimbcgk1lpcdwhy9nxdxra2hxz3bhz2vb"))))))
  1003. (define-public isl-0.11
  1004. (package
  1005. (inherit isl)
  1006. (name "isl")
  1007. (version "0.11.1")
  1008. (source (origin
  1009. (method url-fetch)
  1010. (uri (list (string-append
  1011. "http://isl.gforge.inria.fr/isl-"
  1012. version
  1013. ".tar.bz2")
  1014. (string-append %gcc-infrastructure
  1015. name "-" version ".tar.bz2")))
  1016. (sha256
  1017. (base32
  1018. "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9"))
  1019. (patches (search-patches "isl-0.11.1-aarch64-support.patch"))))))
  1020. (define-public cloog
  1021. (package
  1022. (name "cloog")
  1023. (version "0.18.0")
  1024. (source
  1025. (origin
  1026. (method url-fetch)
  1027. (uri (list (string-append
  1028. "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-"
  1029. version
  1030. ".tar.gz")
  1031. (string-append %gcc-infrastructure
  1032. name "-" version ".tar.gz")))
  1033. (sha256
  1034. (base32
  1035. "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw"))
  1036. (file-name (string-append name "-" version ".tar.gz"))))
  1037. (build-system gnu-build-system)
  1038. (inputs `(("gmp" ,gmp)
  1039. ("isl" ,isl-0.11)))
  1040. (arguments '(#:configure-flags '("--with-isl=system")))
  1041. (home-page "http://www.cloog.org/")
  1042. (synopsis "Library to generate code for scanning Z-polyhedra")
  1043. (description
  1044. "CLooG is a free software library to generate code for scanning
  1045. Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that
  1046. reaches each integral point of one or more parameterized polyhedra.
  1047. CLooG has been originally written to solve the code generation problem
  1048. for optimizing compilers based on the polytope model. Nevertheless it
  1049. is used now in various area e.g., to build control automata for
  1050. high-level synthesis or to find the best polynomial approximation of a
  1051. function. CLooG may help in any situation where scanning polyhedra
  1052. matters. While the user has full control on generated code quality,
  1053. CLooG is designed to avoid control overhead and to produce a very
  1054. effective code.")
  1055. (license gpl2+)))
  1056. (define-public gnu-c-manual
  1057. (package
  1058. (name "gnu-c-manual")
  1059. (version "0.2.5")
  1060. (source (origin
  1061. (method url-fetch)
  1062. (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-"
  1063. version ".tar.gz"))
  1064. (sha256
  1065. (base32
  1066. "1sfsj9256w18qzylgag2h5h377aq8in8929svblfnj9svfriqcys"))))
  1067. (build-system gnu-build-system)
  1068. (native-inputs `(("texinfo" ,texinfo)))
  1069. (arguments
  1070. '(#:phases (modify-phases %standard-phases
  1071. (delete 'configure)
  1072. (delete 'check)
  1073. (replace 'build
  1074. (lambda _
  1075. (invoke "make"
  1076. "gnu-c-manual.info"
  1077. "gnu-c-manual.html")))
  1078. (replace 'install
  1079. (lambda* (#:key outputs #:allow-other-keys)
  1080. (let* ((out (assoc-ref outputs "out"))
  1081. (info (string-append out "/share/info"))
  1082. (html (string-append
  1083. out "/share/doc/gnu-c-manual")))
  1084. (mkdir-p info)
  1085. (mkdir-p html)
  1086. (for-each (lambda (file)
  1087. (copy-file file
  1088. (string-append info "/"
  1089. file)))
  1090. (find-files "." "\\.info(-[0-9])?$"))
  1091. (for-each (lambda (file)
  1092. (copy-file file
  1093. (string-append html "/"
  1094. file)))
  1095. (find-files "." "\\.html$"))))))))
  1096. (synopsis "Reference manual for the C programming language")
  1097. (description
  1098. "This is a reference manual for the C programming language, as
  1099. implemented by the GNU C Compiler (gcc). As a reference, it is not intended
  1100. to be a tutorial of the language. Rather, it outlines all of the constructs
  1101. of the language. Library functions are not included.")
  1102. (home-page "https://www.gnu.org/software/gnu-c-manual/")
  1103. (license fdl1.3+)))