You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
6.7 KiB

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