summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/heads.scm163
-rw-r--r--gnu/packages/patches/musl-cross-locale.patch20
2 files changed, 183 insertions, 0 deletions
diff --git a/gnu/packages/heads.scm b/gnu/packages/heads.scm
new file mode 100644
index 0000000000..b28433431c
--- /dev/null
+++ b/gnu/packages/heads.scm
@@ -0,0 +1,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))))
diff --git a/gnu/packages/patches/musl-cross-locale.patch b/gnu/packages/patches/musl-cross-locale.patch
new file mode 100644
index 0000000000..7634eda381
--- /dev/null
+++ b/gnu/packages/patches/musl-cross-locale.patch
@@ -0,0 +1,20 @@
+Disable locales other than C and POSIX because of a compilation error.
+By Danny Milosavljevic <dannym@scratchpost.org>
+This patch is distributed under BSD-3 license.
+See https://github.com/osresearch/heads/pull/610
+diff -ruN b/source/patches/gcc-5.3.0-locale.diff guix-build-musl-cross-0.1-3.a8a6649.drv-12/source/patches/gcc-5.3.0-locale.diff
+--- a/patches/gcc-5.3.0-locale.diff	1970-01-01 01:00:00.000000000 +0100
++++ b/patches/gcc-5.3.0-locale.diff	2020-05-02 14:20:47.213564509 +0200
+@@ -0,0 +1,12 @@
++--- gcc-5.3.0/libstdc++-v3/config/locale/gnu/ctype_members.cc.orig	2020-05-02 14:16:31.376147000 +0200
+++++ gcc-5.3.0/libstdc++-v3/config/locale/gnu/ctype_members.cc	2020-05-02 14:16:56.716279576 +0200
++@@ -47,7 +47,8 @@
++ 	this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
++ 	this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
++ 	this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
++-	this->_M_table = this->_M_c_locale_ctype->__ctype_b;
+++	//this->_M_table = this->_M_c_locale_ctype->__ctype_b;
+++	throw 3;
++       }
++   }
++