gnu: youtube-dl: Update to 2016-10-16.
[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"))))))))
6c39886a
RW
99
100(define-public newlib-arm-none-eabi
101 (package
102 (name "newlib")
103 (version "2.4.0")
104 (source (origin
105 (method url-fetch)
106 (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-"
107 version ".tar.gz"))
108 (sha256
109 (base32
110 "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl"))))
111 (build-system gnu-build-system)
112 (arguments
113 `(#:out-of-source? #t
114 ;; The configure flags are identical to the flags used by the "GCC ARM
115 ;; embedded" project.
116 #:configure-flags '("--target=arm-none-eabi"
117 "--enable-newlib-io-long-long"
118 "--enable-newlib-register-fini"
119 "--disable-newlib-supplied-syscalls"
120 "--disable-nls")
121 #:phases
122 (modify-phases %standard-phases
123 (add-after 'unpack 'fix-references-to-/bin/sh
124 (lambda _
125 (substitute* '("libgloss/arm/cpu-init/Makefile.in"
126 "libgloss/arm/Makefile.in"
127 "libgloss/libnosys/Makefile.in"
128 "libgloss/Makefile.in")
129 (("/bin/sh") (which "sh")))
130 #t)))))
131 (native-inputs
132 `(("xbinutils" ,(cross-binutils "arm-none-eabi"))
133 ("xgcc" ,gcc-arm-none-eabi-4.9)
134 ("texinfo" ,texinfo)))
135 (home-page "http://www.sourceware.org/newlib/")
136 (synopsis "C library for use on embedded systems")
137 (description "Newlib is a C library intended for use on embedded
138systems. It is a conglomeration of several library parts that are easily
139usable on embedded products.")
140 (license (license:non-copyleft
141 "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))
a299a899
RW
142
143(define-public newlib-nano-arm-none-eabi
144 (package (inherit newlib-arm-none-eabi)
145 (name "newlib-nano")
146 (arguments
147 (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi)
148 ;; The configure flags are identical to the flags used by the "GCC ARM
149 ;; embedded" project. They optimize newlib for use on small embedded
150 ;; systems with limited memory.
151 ((#:configure-flags flags)
152 ''("--target=arm-none-eabi"
153 "--enable-multilib"
154 "--disable-newlib-supplied-syscalls"
155 "--enable-newlib-reent-small"
156 "--disable-newlib-fvwrite-in-streamio"
157 "--disable-newlib-fseek-optimization"
158 "--disable-newlib-wide-orient"
159 "--enable-newlib-nano-malloc"
160 "--disable-newlib-unbuf-stream-opt"
161 "--enable-lite-exit"
162 "--enable-newlib-global-atexit"
163 "--enable-newlib-nano-formatted-io"
164 "--disable-nls"))))
165 (synopsis "Newlib variant for small systems with limited memory")))