;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2014, 2015, 2018 Mark H Weaver ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus ;;; Copyright © 2015 Andreas Enge ;;; Copyright © 2015, 2016, 2017, 2018 Efraim Flashner ;;; Copyright © 2016 Carlos Sánchez de La Lama ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARR
aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu installer final)
  #:use-module (gnu installer newt page)
  #:use-module (gnu installer steps)
  #:use-module (gnu installer utils)
  #:use-module (gnu installer user)
  #:use-module (gnu services herd)
  #:use-module (guix build syscalls)
  #:use-module (guix build utils)
  #:use-module (guix utils)
  #:use-module (gnu build accounts)
  #:use-module (gnu build install)
  #:use-module (gnu build linux-container)
  #:use-module ((gnu system shadow) #:prefix sys:)
  #:use-module (rnrs io ports)
  #:use-module (srfi srfi-1)
  #:use-module (ice-9 ftw)
  #:use-module (ice-9 popen)
  #:use-module (ice-9 match)
  #:use-module (ice-9 format)
  #:use-module (ice-9 rdelim)
  #:export (install-system))

(define %seed
  (seed->random-state
   (logxor (getpid) (car (gettimeofday)))))

(define (integer->alphanumeric-char n)
  "Map N, an integer in the [0..62] range, to an alphanumeric character."
  (cond ((< n 10)
         (integer->char (+ (char->integer #\0) n)))
        ((< n 36)
         (integer->char (+ (char->integer #\A) (- n 10))))
        ((< n 62)
         (integer->char (+ (char->integer #\a) (- n 36))))
        (else
         (error "integer out of bounds" n))))

(define (random-string len)
  "Compute a random string of size LEN where each character is alphanumeric."
  (let loop ((chars '())
             (len len))
    (if (zero? len)
        (list->string chars)
        (let ((n (random 62 %seed)))
          (loop (cons (integer->alphanumeric-char n) chars)
                (- len 1))))))

(define (create-user-database users root)
  "Create /etc/passwd, /etc/shadow, and /etc/group under ROOT for the given
USERS."
  (define etc
    (string-append root "/etc"))

  (define (salt)
    ;; "$6" gives us a SHA512 password hash; the random string must be taken
    ;; from the './0-9A-Za-z' alphabet (info "(libc) Passphrase Storage").
    (string-append "$6$" (random-string 10)))

  (define users*
    (map (lambda (user)
           (define root?
             (string=? "root" (user-name user)))

           (sys:user-account (name (user-name user))
                             (comment (user-real-name user))
                             (group "users")
                             (uid (if root? 0 #f))
                             (home-directory
                              (user-home-directory user))
                             (password (crypt
                                        (secret-content (user-password user))
                                        (salt)))

                             ;; We need a string here, not a file-like, hence
                             ;; this choice.
                             (shell
                              "/run/current-system/profile/bin/bash")))
         users))

  (define-values (group password shadow)
    (user+group-databases users* sys:%base-groups
                          #:current-passwd '()
                          #:current-groups '()
                          #:current-shadow '()))

  (mkdir-p etc)
  (write-group group (string-append etc "/group"))
  (write-passwd password (string-append etc "/passwd"))
  (write-shadow shadow (string-append etc "/shadow")))

(define (call-with-mnt-container thunk)
  "This is a variant of call-with-container. Run THUNK in a new container
process, within a separate MNT namespace. The container is not jailed so that
it can interact with the rest of the system."
  (let ((pid (run-container "/" '() '(mnt) 1 thunk)))
    ;; Catch SIGINT and kill the container process.
    (sigaction SIGINT
      (lambda (signum)
        ;: FIXME: Use of SIGKILL prevents the dynamic-wind exit handler of
        ;; THUNK to run.
        (false-if-exception
         (kill pid SIGKILL))))

    (match (waitpid pid)
      ((_ . status) status))))

(define (install-locale locale)
  "Install the given LOCALE or the en_US.utf8 locale as a fallback."
  (let ((supported? (false-if-exception
                     (setlocale LC_ALL locale))))
    (if supported?
        (begin
          (installer-log-line "install supported locale ~a." locale)
          (setenv "LC_ALL" locale))
        (begin
          ;; If the selected locale is not supported, install a default UTF-8
          ;; locale. This is required to copy some files with UTF-8
          ;; characters, in the nss-certs package notably. Set LANGUAGE
          ;; anyways, to have translated messages if possible.
          (installer-log-line "~a locale is not supported, installing \
en_US.utf8 locale instead." locale)
          (setlocale LC_ALL "en_US.utf8")
          (setenv "LC_ALL" "en_US.utf8")
          (setenv "LANGUAGE"
                  (string-take locale
                               (or (string-index locale #\_)
                                   (string-length locale))))))))

(define* (install-system locale #:key (users '()))
  "Create /etc/shadow and /etc/passwd on the installation target for USERS.
Start COW-STORE service on target directory and launch guix install command in
a subshell.  LOCALE must be the locale name under which that command will run,
or #f.  Return #t on success and #f on failure."
  (define backing-directory
    ;; Sub-directory used as the backing store for copy-on-write.
    "/tmp/guix-inst")

  (define (assert-exit x)
    (primitive-exit (if x 0 1)))

  (let* ((options         (catch 'system-error
                            (lambda ()
                              ;; If this file exists, it can provide
                              ;; additional command-line options.
                              (call-with-input-file
                                  "/tmp/installer-system-init-options"
                                read))
                            (const '())))
         (install-command (append `( "guix" "system" "init"
                                     "--fallback"
                                     ,@(if (target-hurd?)
                                           '("--target=i586-pc-gnu")
                                           '()))
                                  options
                                  (list (%installer-configuration-file)
                                        (%installer-target-dir))))
         (database-dir    "/var/guix/db")
         (database-file   (string-append database-dir "/db.sqlite"))
         (saved-database  (string-append database-dir "/db.save"))
         (ret             #f))
    (mkdir-p (%installer-target-dir))

    ;; We want to initialize user passwords but we don't want to store them in
    ;; the config file since the password hashes would end up world-readable
    ;; in the store.  Thus, create /etc/shadow & co. here such that, on the
    ;; first boot, the activation snippet that creates accounts will reuse the
    ;; passwords that we've put in there.
    (create-user-database users (%installer-target-dir))

    ;; When the store overlay is mounted, other processes such as kmscon, udev
    ;; and guix-daemon may open files from the store, preventing the
    ;; underlying install support from being umounted. See:
    ;; https://lists.gnu.org/archive/html/guix-devel/2018-12/msg00161.html.
    ;;
    ;; To avoid this situation, mount the store overlay inside a container,
    ;; and run the installation from within that container.
    (zero?
     (call-with-mnt-container
       (lambda ()
         (dynamic-wind
           (lambda ()
             ;; Install the locale before mounting the cow-store, otherwise
             ;; the loaded cow-store locale files will prevent umounting.
             (install-locale locale)

             ;; Stop the daemon and save the database, so that it can be
             ;; restored once the cow-store is umounted.
             (stop-service 'guix-daemon)
             (copy-file database-file saved-database)

             (installer-log-line "mounting copy-on-write store")
             (mount-cow-store (%installer-target-dir) backing-directory))
           (lambda ()
             ;; We need to drag the guix-daemon to the container MNT
             ;; namespace, so that it can operate on the cow-store.
             (start-service 'guix-daemon (list (number->string (getpid))))

             (setvbuf (current-output-port) 'none)
             (setvbuf (current-error-port) 'none)

             (setenv "PATH" "/run/current-system/profile/bin/")

             (set! ret (run-command install-command #:tty? #t)))
           (lambda ()
             ;; Stop guix-daemon so that it does no keep the MNT namespace
             ;; alive.
             (stop-service 'guix-daemon)

             ;; Restore the database and restart it.  As part of restoring the
             ;; database, remove the WAL and shm files in case they were left
             ;; behind after guix-daemon was stopped.  Failing to do so,
             ;; sqlite might behave as if transactions that appear in the WAL
             ;; file were committed.  (See <https://www.sqlite.org/wal.html>.)
             (installer-log-line "restoring store database from '~a'"
                                 saved-database)
             (copy-file saved-database database-file)
             (for-each (lambda (suffix)
                         (false-if-exception
                          (delete-file (string-append database-file suffix))))
                       '("-wal" "-shm"))
             (start-service 'guix-daemon)

             ;; Finally umount the cow-store and exit the container.
             (installer-log-line "unmounting copy-on-write store")
             (unmount-cow-store (%installer-target-dir) backing-directory)
             (assert-exit ret))))))))
bbacktrace. By default it builds ;; with -Werror, which fails with a -Wcast-qual error in glibc ;; 2.21's stdlib-bsearch.h. Remove -Werror. (substitute* "libbacktrace/configure" (("WARN_FLAGS=(.*)-Werror" _ flags) (string-append "WARN_FLAGS=" flags))) (when (file-exists? "libsanitizer/libbacktrace") ;; Same in libsanitizer's bundled copy (!) found in 4.9+. (substitute* "libsanitizer/libbacktrace/Makefile.in" (("-Werror") "")))) ;; Add a RUNPATH to libstdc++.so so that it finds libgcc_s. ;; See ;; and . (substitute* "libstdc++-v3/src/Makefile.in" (("^OPT_LDFLAGS = ") "OPT_LDFLAGS = -Wl,-rpath=$(libdir) ")) ;; Move libstdc++*-gdb.py to the "lib" output to avoid a ;; circularity between "out" and "lib". (Note: ;; --with-python-dir is useless because it imposes $(prefix) as ;; the parent directory.) (substitute* "libstdc++-v3/python/Makefile.in" (("pythondir = .*$") (string-append "pythondir = " libdir "/share" "/gcc-$(gcc_version)/python\n"))) ;; Avoid another circularity between the outputs: this #define ;; ends up in auto-host.h in the "lib" output, referring to ;; "out". (This variable is used to augment cpp's search path, ;; but there's nothing useful to look for here.) (substitute* "gcc/config.in" (("PREFIX_INCLUDE_DIR") "PREFIX_INCLUDE_DIR_isnt_necessary_here")) #t))) (add-after 'configure 'post-configure (lambda _ ;; Don't store configure flags, to avoid retaining references to ;; build-time dependencies---e.g., `--with-ppl=/gnu/store/xxx'. (substitute* "Makefile" (("^TOPLEVEL_CONFIGURE_ARGUMENTS=(.*)$" _ rest) "TOPLEVEL_CONFIGURE_ARGUMENTS=\n")) #t))))) (native-search-paths ;; Use the language-specific variables rather than 'CPATH' because they ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'. ;; The intent is to allow headers that are in the search path to be ;; treated as "system headers" (headers exempt from warnings) just like ;; the typical /usr/include headers on an FHS system. (list (search-path-specification (variable "C_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "CPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64"))))) (properties `((gcc-libc . ,(assoc-ref inputs "libc")))) (synopsis "GNU Compiler Collection") (description "GCC is the GNU Compiler Collection. It provides compiler front-ends for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and Go. It also includes runtime support libraries for these languages.") (license gpl3+) (supported-systems (delete "aarch64-linux" %supported-systems)) (home-page "https://gcc.gnu.org/"))))) (define-public gcc-4.8 (package (inherit gcc-4.7) (version "4.8.5") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.bz2")) (sha256 (base32 "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2")) (patches (search-patches "gcc-arm-link-spec-fix.patch" "gcc-4.8-libsanitizer-fix.patch" "gcc-asan-missing-include.patch" "gcc-fix-texi2pod.patch")) (modules '((guix build utils))) ;; This is required for building with glibc-2.26. ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712 (snippet '(begin (for-each (lambda (dir) (substitute* (string-append "libgcc/config/" dir "/linux-unwind.h") (("struct ucontext") "ucontext_t"))) '("aarch64" "alpha" "bfin" "i386" "m68k" "pa" "sh" "tilepro" "xtensa")) #t)))) (supported-systems %supported-systems) (inputs `(("isl" ,isl-0.11) ("cloog" ,cloog) ,@(package-inputs gcc-4.7))))) (define-public gcc-4.9 (package (inherit gcc-4.8) (version "4.9.4") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.bz2")) (sha256 (base32 "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc")) (patches (search-patches "gcc-4.9-libsanitizer-fix.patch" "gcc-4.9-libsanitizer-ustat.patch" "gcc-arm-bug-71399.patch" "gcc-asan-missing-include.patch" "gcc-libvtv-runpath.patch" "gcc-fix-texi2pod.patch")) (modules '((guix build utils))) ;; This is required for building with glibc-2.26. ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712 (snippet '(begin (for-each (lambda (dir) (substitute* (string-append "libgcc/config/" dir "/linux-unwind.h") (("struct ucontext") "ucontext_t"))) '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2" "pa" "sh" "tilepro" "xtensa")) #t)))) ;; Override inherited texinfo-5 with latest version. (native-inputs `(("perl" ,perl) ;for manpages ("texinfo" ,texinfo))))) (define-public gcc-5 ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install ;; them in a VPATH build. (package (inherit gcc-4.9) (version "5.5.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 "11zd1hgzkli3b2v70qsm2hyqppngd4616qc96lmm9zl2kl9yl32k")) (patches (search-patches "gcc-arm-bug-71399.patch" "gcc-libsanitizer-ustat.patch" "gcc-strmov-store-file-names.patch" "gcc-5.0-libvtv-runpath.patch" "gcc-5-source-date-epoch-1.patch" "gcc-5-source-date-epoch-2.patch" "gcc-fix-texi2pod.patch")) (modules '((guix build utils))) (snippet ;; Fix 'libcc1/configure' error when cross-compiling GCC. ;; Without that, 'libcc1/configure' wrongfully determines that ;; '-rdynamic' support is missing because $gcc_cv_objdump is ;; empty: ;; ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67590 ;; http://cgit.openembedded.org/openembedded-core/commit/?id=f6e47aa9b12f9ab61530c40e0343f451699d9077 '(begin (substitute* "libcc1/configure" (("\\$gcc_cv_objdump -T") "$OBJDUMP_FOR_TARGET -T")) #t)))) (inputs `(;; GCC5 needs which is removed in later versions. ("isl" ,isl-0.18) ,@(package-inputs gcc-4.7))))) (define-public gcc-6 (package (inherit gcc-5) (version "6.5.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby")) (patches (search-patches "gcc-strmov-store-file-names.patch" "gcc-6-source-date-epoch-1.patch" "gcc-6-source-date-epoch-2.patch" "gcc-5.0-libvtv-runpath.patch")))) (inputs `(("isl" ,isl) ,@(package-inputs gcc-4.7))) (native-search-paths ;; We have to use 'CPATH' for GCC > 5, not 'C_INCLUDE_PATH' & co., due to ;; . (list (search-path-specification (variable "CPATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64"))))))) (define-public gcc-7 (package (inherit gcc-6) (version "7.4.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 "0lgy170b0pp60j9cczqkmaqyjjb584vfamj4c30swd7k0j6y5pgd")) (patches (search-patches "gcc-strmov-store-file-names.patch" "gcc-5.0-libvtv-runpath.patch")))) (description "GCC is the GNU Compiler Collection. It provides compiler front-ends for several languages, including C, C++, Objective-C, Fortran, Ada, and Go. It also includes runtime support libraries for these languages."))) (define-public gcc-8 (package (inherit gcc-7) (version "8.3.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4")) (patches (search-patches "gcc-8-strmov-store-file-names.patch" "gcc-5.0-libvtv-runpath.patch")))))) (define-public gcc-9 (package (inherit gcc-8) (version "9.1.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr")) (patches (search-patches "gcc-9-strmov-store-file-names.patch" "gcc-9-asan-fix-limits-include.patch" "gcc-5.0-libvtv-runpath.patch")))))) ;; Note: When changing the default gcc version, update ;; the gcc-toolchain-* definitions and the gfortran definition ;; accordingly. (define-public gcc gcc-5) (define-public (make-libstdc++ gcc) "Return a libstdc++ package based on GCC. The primary use case is when using compilers other than GCC." (package (inherit gcc) (name "libstdc++") (arguments `(#:out-of-source? #t #:phases (alist-cons-before 'configure 'chdir (lambda _ (chdir "libstdc++-v3") #t) %standard-phases) #:configure-flags `("--disable-libstdcxx-pch" ,(string-append "--with-gxx-include-dir=" (assoc-ref %outputs "out") "/include")))) (outputs '("out" "debug")) (inputs '()) (native-inputs '()) (propagated-inputs '()) (synopsis "GNU C++ standard library"))) (define-public libstdc++-4.9 (make-libstdc++ gcc-4.9)) (define (make-libiberty gcc) "Return a libiberty package based on GCC." (package (inherit gcc) (name "libiberty") (arguments `(#:out-of-source? #t #:phases (modify-phases %standard-phases (add-before 'configure 'chdir (lambda _ (chdir "libiberty") #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib/")) (include (string-append out "/include/"))) (mkdir-p lib) (mkdir-p include) (copy-file "libiberty.a" (string-append lib "libiberty.a")) (copy-file "../include/libiberty.h" (string-append include "libiberty.h")) #t)))))) (inputs '()) (outputs '("out")) (native-inputs '()) (propagated-inputs '()) (synopsis "Collection of subroutines used by various GNU programs"))) (define-public libiberty (make-libiberty gcc)) (define* (custom-gcc gcc name languages #:optional (search-paths (package-native-search-paths gcc)) #:key (separate-lib-output? #t)) "Return a custom version of GCC that supports LANGUAGES. Use SEARCH-PATHS as the 'native-search-paths' field." (package (inherit gcc) (name name) (outputs (if separate-lib-output? (package-outputs gcc) (delete "lib" (package-outputs gcc)))) (native-search-paths search-paths) (properties (alist-delete 'hidden? (package-properties gcc))) (arguments (substitute-keyword-arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (ice-9 regex) (srfi srfi-1) (srfi srfi-26)) ,@(package-arguments gcc)) ((#:configure-flags flags) `(cons (string-append "--enable-languages=" ,(string-join languages ",")) (remove (cut string-match "--enable-languages.*" <>) ,flags))) ((#:phases phases) `(modify-phases ,phases (add-after 'install 'remove-broken-or-conflicting-files (lambda* (#:key outputs #:allow-other-keys) (for-each delete-file (find-files (string-append (assoc-ref outputs "out") "/bin") ".*(c\\+\\+|cpp|g\\+\\+|gcov|gcc|gcc-.*)")) #t)))))))) (define %generic-search-paths ;; This is the language-neutral search path for GCC. Entries in $CPATH are ;; not considered "system headers", which means GCC can raise warnings for ;; issues in those headers. 'CPATH' is the only one that works for ;; front-ends not in the C family. (list (search-path-specification (variable "CPATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64"))))) (define-public gfortran-4.8 (custom-gcc gcc-4.8 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran-4.9 (custom-gcc gcc-4.9 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran-5 (custom-gcc gcc-5 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran-6 (custom-gcc gcc-6 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran-7 (custom-gcc gcc-7 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran-8 (custom-gcc gcc-8 "gfortran" '("fortran") %generic-search-paths)) (define-public gfortran ;; Note: Update this when GCC changes! We cannot use ;; (custom-gcc gcc "fortran" …) because that would lead to a package object ;; that is not 'eq?' with GFORTRAN-5, and thus 'fold-packages' would ;; report two gfortran@5 that are in fact identical. gfortran-5) (define-public gccgo-4.9 (custom-gcc gcc-4.9 "gccgo" '("go") %generic-search-paths ;; Suppress the separate "lib" output, because otherwise the ;; "lib" and "out" outputs would refer to each other, creating ;; a cyclic dependency. #:separate-lib-output? #f)) (define-public gcc-objc-4.8 (custom-gcc gcc-4.8 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc-4.9 (custom-gcc gcc-4.9 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc-5 (custom-gcc gcc-5 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc-6 (custom-gcc gcc-6 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc-7 (custom-gcc gcc-7 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc-8 (custom-gcc gcc-8 "gcc-objc" '("objc") (list (search-path-specification (variable "OBJC_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc gcc-objc-5) (define-public gcc-objc++-4.8 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++-4.9 (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++-5 (custom-gcc gcc-5 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++-6 (custom-gcc gcc-6 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++-7 (custom-gcc gcc-7 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++-8 (custom-gcc gcc-8 "gcc-objc++" '("obj-c++") (list (search-path-specification (variable "OBJCPLUS_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) (define-public gcc-objc++ gcc-objc++-5) (define (make-libstdc++-doc gcc) "Return a package with the libstdc++ documentation for GCC." (package (inherit gcc) (name "libstdc++-doc") (version (package-version gcc)) (synopsis "GNU libstdc++ documentation") (outputs '("out")) (native-inputs `(("doxygen" ,doxygen) ("texinfo" ,texinfo) ("libxml2" ,libxml2) ("libxslt" ,libxslt) ("docbook-xml" ,docbook-xml) ("docbook-xsl" ,docbook-xsl) ("graphviz" ,graphviz))) ;for 'dot', invoked by 'doxygen' (inputs '()) (propagated-inputs '()) (arguments '(#:out-of-source? #t #:tests? #f ;it's just documentation #:phases (modify-phases %standard-phases (add-before 'configure 'chdir (lambda _ (chdir "libstdc++-v3") #t)) (add-before 'configure 'set-xsl-directory (lambda* (#:key inputs #:allow-other-keys) (let ((docbook (assoc-ref inputs "docbook-xsl"))) (substitute* (find-files "doc" "^Makefile\\.in$") (("@XSL_STYLE_DIR@") (string-append docbook "/xml/xsl/" (strip-store-file-name docbook)))) #t))) (replace 'build (lambda _ ;; XXX: There's also a 'doc-info' target, but it ;; relies on docbook2X, which itself relies on ;; DocBook 4.1.2, which is not really usable ;; (lacks a catalog.xml.) (invoke "make" "doc-html" "doc-man"))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (invoke "make" "doc-install-html" "doc-install-man"))))))) (properties (alist-delete 'hidden? (package-properties gcc))))) (define-public libstdc++-doc-5 (make-libstdc++-doc gcc-5)) (define-public libstdc++-doc-9 (make-libstdc++-doc gcc-9)) (define-public isl (package (name "isl") (version "0.19") (source (origin (method url-fetch) (uri (list (string-append "http://isl.gforge.inria.fr/isl-" version ".tar.bz2") (string-append %gcc-infrastructure name "-" version ".tar.gz"))) (sha256 (base32 "1n4yz9rj24mv226hqbpw210ifvqkn8dgvpnkzf0s0lkq9zrjd5ym")))) (build-system gnu-build-system) (inputs `(("gmp" ,gmp))) (home-page "http://isl.gforge.inria.fr/") (synopsis "Manipulating sets and relations of integer points \ bounded by linear constraints") (description "isl is a library for manipulating sets and relations of integer points bounded by linear constraints. Supported operations on sets include intersection, union, set difference, emptiness check, convex hull, (integer) affine hull, integer projection, computing the lexicographic minimum using parametric integer programming, coalescing and parametric vertex enumeration. It also includes an ILP solver based on generalized basis reduction, transitive closures on maps (which may encode infinite graphs), dependence analysis and bounds on piecewise step-polynomials.") (license lgpl2.1+))) (define-public isl-0.18 (package (inherit isl) (version "0.18") (source (origin (method url-fetch) (uri (list (string-append "http://isl.gforge.inria.fr/isl-" version ".tar.bz2") (string-append %gcc-infrastructure "isl-" version ".tar.gz"))) (sha256 (base32 "06ybml6llhi4i56q90jnimbcgk1lpcdwhy9nxdxra2hxz3bhz2vb")))))) (define-public isl-0.11 (package (inherit isl) (name "isl") (version "0.11.1") (source (origin (method url-fetch) (uri (list (string-append "http://isl.gforge.inria.fr/isl-" version ".tar.bz2") (string-append %gcc-infrastructure name "-" version ".tar.gz"))) (sha256 (base32 "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9")) (patches (search-patches "isl-0.11.1-aarch64-support.patch")))))) (define-public cloog (package (name "cloog") (version "0.18.0") (source (origin (method url-fetch) (uri (list (string-append "http://www.bastoul.net/cloog/pages/download/count.php3?url=cloog-" version ".tar.gz") (string-append %gcc-infrastructure name "-" version ".tar.gz"))) (sha256 (base32 "0a12rwfwp22zd0nlld0xyql11cj390rrq1prw35yjsw8wzfshjhw")) (file-name (string-append name "-" version ".tar.gz")))) (build-system gnu-build-system) (inputs `(("gmp" ,gmp) ("isl" ,isl-0.11))) (arguments '(#:configure-flags '("--with-isl=system"))) (home-page "http://www.cloog.org/") (synopsis "Library to generate code for scanning Z-polyhedra") (description "CLooG is a free software library to generate code for scanning Z-polyhedra. That is, it finds a code (e.g., in C, FORTRAN...) that reaches each integral point of one or more parameterized polyhedra. CLooG has been originally written to solve the code generation problem for optimizing compilers based on the polytope model. Nevertheless it is used now in various area e.g., to build control automata for high-level synthesis or to find the best polynomial approximation of a function. CLooG may help in any situation where scanning polyhedra matters. While the user has full control on generated code quality, CLooG is designed to avoid control overhead and to produce a very effective code.") (license gpl2+))) (define-public gnu-c-manual (package (name "gnu-c-manual") (version "0.2.5") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gnu-c-manual/gnu-c-manual-" version ".tar.gz")) (sha256 (base32 "1sfsj9256w18qzylgag2h5h377aq8in8929svblfnj9svfriqcys")))) (build-system gnu-build-system) (native-inputs `(("texinfo" ,texinfo))) (arguments '(#:phases (modify-phases %standard-phases (delete 'configure) (delete 'check) (replace 'build (lambda _ (invoke "make" "gnu-c-manual.info" "gnu-c-manual.html"))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (info (string-append out "/share/info")) (html (string-append out "/share/doc/gnu-c-manual"))) (mkdir-p info) (mkdir-p html) (for-each (lambda (file) (copy-file file (string-append info "/" file))) (find-files "." "\\.info(-[0-9])?$")) (for-each (lambda (file) (copy-file file (string-append html "/" file))) (find-files "." "\\.html$")) #t)))))) (synopsis "Reference manual for the C programming language") (description "This is a reference manual for the C programming language, as implemented by the GNU C Compiler (gcc). As a reference, it is not intended to be a tutorial of the language. Rather, it outlines all of the constructs of the language. Library functions are not included.") (home-page "https://www.gnu.org/software/gnu-c-manual/") (license fdl1.3+)))