@@ -245,6 +245,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/haskell-web.scm \
%D%/packages/haskell-xyz.scm \
%D%/packages/ham-radio.scm \
+ %D%/packages/heads.scm \
%D%/packages/hexedit.scm \
%D%/packages/hugs.scm \
%D%/packages/hurd.scm \
new file mode 100644
@@ -0,0 +1,124 @@
+(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 (gnu packages)
+ #:use-module (gnu packages algebra)
+ #: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 multiprecision)
+ #:use-module (gnu packages cpio)
+ #:use-module (gnu packages perl)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages virtualization))
+
+(define-public musl-cross
+ (let ((revision "1")
+ (commit "b7f2249b665705939dc4eca67d11553c72164f4b"))
+ (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 "3b5b118f1cdddecda3f04b5005f69f962278fc1e")))
+ (file-name "musl-cross-checkout")
+ (sha256
+ (base32 "0pd1b7k4gwbvnyw0677p56d7j0xmv80k5iihkkjrd1mp9zdx90gj"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ; No tests in main project.
+ #: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 #\-))
+ (drop (@ (srfi srfi-1) drop))
+ (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" "kernel-headers" "musl"))
+ (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
+ `(("bash" ,bash)
+ ("flex" ,flex)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("mpc" ,mpc)
+ ("binutils"
+ ,(origin
+ (method url-fetch)
+ (uri "https://ftpmirror.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2")
+ (sha256
+ (base32 "08lzmhidzc16af1zbx34f8cy4z7mzrswpdbhrb8shy3xxpflmcdm"))))
+ ("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"))))
+ ("kernel-headers"
+ ,(origin
+ (method url-fetch)
+ (uri "http://ftp.barfooze.de/pub/sabotage/tarballs/kernel-headers-3.12.6-5.tar.xz")
+ (sha256
+ (base32 "0p43lvbpy69lbjmvq39g570imj0p8z791bhzrpdnp1nygwshj2wf"))))
+ ("musl"
+ ,(origin
+ (method url-fetch)
+ (uri "http://www.musl-libc.org/releases/musl-1.1.21.tar.gz")
+ (sha256
+ (base32 "0i2z52zgc86af1n1gjiz43hgd85mxjgvgn345zsybja9dxpvchn7"))))))
+ (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))))