gnu: Add arm-none-eabi cross compiler.
[jackhill/guix/guix.git] / gnu / packages / embedded.scm
CommitLineData
35a37efb
RW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
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 embedded)
20 #:use-module (guix utils)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix svn-download)
24 #:use-module (guix git-download)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages cross-base)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages texinfo))
32
33;; We must not use the released GCC sources here, because the cross-compiler
34;; does not produce working binaries. Instead we take the very same SVN
35;; revision from the branch that is used for a release of the "GCC ARM
36;; embedded" project on launchpad.
37;; See https://launchpadlibrarian.net/218827644/release.txt
38(define-public gcc-arm-none-eabi-4.9
39 (let ((xgcc (cross-gcc "arm-none-eabi"
40 (cross-binutils "arm-none-eabi")))
41 (revision "1")
42 (svn-revision 227977))
43 (package (inherit xgcc)
44 (version (string-append (package-version xgcc) "-"
45 revision "." (number->string svn-revision)))
46 (source
47 (origin
48 (method svn-fetch)
49 (uri (svn-reference
50 (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/")
51 (revision svn-revision)))
52 (file-name (string-append "gcc-arm-embedded-" version "-checkout"))
53 (sha256
54 (base32
55 "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr"))
56 (patches (origin-patches (package-source xgcc)))))
57 (native-inputs
58 `(("flex" ,flex)
59 ,@(package-native-inputs xgcc)))
60 (arguments
61 (substitute-keyword-arguments (package-arguments xgcc)
62 ((#:phases phases)
63 `(modify-phases ,phases
64 (add-after 'unpack 'fix-genmultilib
65 (lambda _
66 (substitute* "gcc/genmultilib"
67 (("#!/bin/sh") (string-append "#!" (which "sh"))))
68 #t))))
69 ((#:configure-flags flags)
70 ;; The configure flags are largely identical to the flags used by the
71 ;; "GCC ARM embedded" project.
72 `(append (list "--enable-multilib"
73 "--with-newlib"
74 "--with-multilib-list=armv6-m,armv7-m,armv7e-m"
75 "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"
76 "--enable-plugins"
77 "--disable-decimal-float"
78 "--disable-libffi"
79 "--disable-libgomp"
80 "--disable-libmudflap"
81 "--disable-libquadmath"
82 "--disable-libssp"
83 "--disable-libstdcxx-pch"
84 "--disable-nls"
85 "--disable-shared"
86 "--disable-threads"
87 "--disable-tls")
88 (delete "--disable-multilib" ,flags)))))
89 (native-search-paths
90 (list (search-path-specification
91 (variable "CROSS_C_INCLUDE_PATH")
92 (files '("arm-none-eabi/include")))
93 (search-path-specification
94 (variable "CROSS_CPLUS_INCLUDE_PATH")
95 (files '("arm-none-eabi/include")))
96 (search-path-specification
97 (variable "CROSS_LIBRARY_PATH")
98 (files '("arm-none-eabi/lib"))))))))