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