gnu: Add cxxopts.
[jackhill/guix/guix.git] / gnu / packages / heads.scm
CommitLineData
f7228e31
DM
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages heads)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix build-system gnu)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module (guix utils)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages algebra)
29 #:use-module (gnu packages assembly)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bash)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages flex)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages elf)
37 #:use-module (gnu packages m4)
38 #:use-module (gnu packages curl)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages multiprecision)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages cpio)
43 #:use-module (gnu packages file)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages version-control)
46 #:use-module (gnu packages virtualization)
47 #:use-module ((guix build utils) #:select (alist-replace)))
48
49(define-public musl-cross
50 (let ((revision "3")
51 (commit "a8a66490dae7f23a2cf5e256f3a596d1ccfe1a03"))
52 (package
53 (name "musl-cross")
54 (version (git-version "0.1" revision commit))
55 (source
56 (origin
57 (method git-fetch)
58 (uri (git-reference
59 (url "https://github.com/GregorR/musl-cross")
60 (commit commit)))
61 (file-name "musl-cross-checkout")
62 (sha256
63 (base32
64 "1xvl9y017wb2qaphy9zqh3vrhm8hklr8acvzzcjc35d1jjhyl58y"))
65 (patches (search-patches "musl-cross-locale.patch"))))
66 (build-system gnu-build-system)
67 (arguments
68 `(#:tests? #f ; No tests in main project.
69 #:modules
70 ((guix build utils)
71 (guix build gnu-build-system)
72 (srfi srfi-1)) ; drop
73 #:phases
74 (modify-phases %standard-phases
75 (replace 'configure
76 (lambda _
77 (setenv "SHELL" "bash")
78 (setenv "CONFIG_SHELL" "bash")
79 #t))
80 (add-after 'unpack 'unpack-dependencies
81 (lambda* (#:key inputs outputs #:allow-other-keys)
82 (define (install-file* source-key destination-directory
83 destination-suffix)
84 (let* ((source-file (assoc-ref inputs source-key))
85 (source-basename (basename source-file))
86 (source-parts (string-split source-basename #\-))
87 (destination-file
88 (string-join (drop source-parts 1) "-")))
89 (copy-file source-file
90 (string-append destination-directory "/"
91 destination-file destination-suffix))))
92 (for-each (lambda (name)
93 (install-file* name "tarballs" ""))
94 '("binutils" "target-gcc-5" "linux-headers" "musl"))
95 (copy-file (string-append (assoc-ref inputs "config.sub")
96 "/share/automake-1.16/config.sub")
97 "tarballs/config.sub;hb=3d5db9ebe860")
98 (copy-file (string-append (assoc-ref inputs "config.sub")
99 "/share/automake-1.16/config.guess")
100 "tarballs/config.guess;hb=3d5db9ebe860")
101 (substitute* "config.sh"
102 (("^CC_BASE_PREFIX=.*")
103 (string-append "CC_BASE_PREFIX=" (assoc-ref outputs "out")
104 "/crossgcc\n")))
105 ;; Note: Important: source/gcc-5.3.0/gcc/exec-tool.in
106 ;; Note: Important: source/kernel-headers-3.12.6-5/tools/install.sh
107 ;; Note: Important: move-if-change (twice)
108 ;; Make sure that shebangs are patched after new extractions.
109 (substitute* "defs.sh"
110 (("touch \"[$]2/extracted\"")
111 (string-append "touch \"$2/extracted\"
112for s in mkinstalldirs move-if-change compile depcomp callprocs configure \\
113mkdep compile libtool-ldflags config.guess install-sh missing config.sub \\
114config.rpath progtest.m4 lib-ld.m4 acx.m4 gen-fixed.sh mkheader.sh ylwrap \\
115merge.sh godeps.sh lock-and-run.sh print-sysroot-suffix.sh mkconfig.sh \\
116genmultilib exec-tool.in install.sh
117do
118 find . -name $s -exec sed -i -e 's;!/bin/sh;!" (assoc-ref inputs "bash")
119"/bin/sh;' '{}' ';'
120 find . -name $s -exec sed -i -e 's; /bin/sh; " (assoc-ref inputs "bash")
121"/bin/sh;' '{}' ';'
122done
123" )))
124 #t))
125 (replace 'build
126 (lambda* (#:key outputs #:allow-other-keys)
127 (invoke "./build.sh")))
128 (delete 'install))))
129 (native-inputs
130 `(("config.sub" ,automake)
131 ("bash" ,bash)
132 ("flex" ,flex)
133 ("gmp" ,gmp)
134 ("mpfr" ,mpfr)
135 ("mpc" ,mpc)
136 ("binutils"
137 ,(origin
138 (method url-fetch)
139 (uri "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.27.tar.bz2")
140 (sha256
141 (base32 "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn"))))
142 ("target-gcc-5"
143 ,(origin
144 (method url-fetch)
145 (uri "https://ftpmirror.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2")
146 (sha256
147 (base32 "1ny4smkp5bzs3cp8ss7pl6lk8yss0d9m4av1mvdp72r1x695akxq"))))
148 ("linux-headers"
149 ,(origin
150 (method url-fetch)
151 (uri "http://ftp.barfooze.de/pub/sabotage/tarballs/linux-headers-4.19.88.tar.xz")
152 (sha256
153 (base32 "1srgi2nqw892jb6yd4kzacf2xzwfvzhsv2957xfh1nvbs7varwyk"))))
154 ("musl"
155 ,(origin
156 (method url-fetch)
157 (uri "http://www.musl-libc.org/releases/musl-1.1.24.tar.gz")
158 (sha256
159 (base32 "18r2a00k82hz0mqdvgm7crzc7305l36109c0j9yjmkxj2alcjw0k"))))))
160 (home-page "https://github.com/osresearch/heads")
161 (synopsis "Musl-cross gcc 5 toolchain")
162 (description "Musl-cross toolchain: binutils, gcc 5 and musl.")
163 (license license:isc))))