gnu: packages: Use 'search-patches' everywhere.
[jackhill/guix/guix.git] / gnu / packages / firmware.scm
CommitLineData
4902c3ec 1;;; GNU Guix --- Functional package management for GNU
7c473310 2;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
4902c3ec
LC
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 firmware)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages cmake)
26 #:use-module (gnu packages cross-base)
27 #:use-module (gnu packages perl))
28
29(define-public ath9k-htc-firmware
30 (package
31 (name "ath9k-htc-firmware")
7c473310 32 (version "1.4.0")
4902c3ec
LC
33 (source (origin
34 (method git-fetch)
35 (uri (git-reference
36 (url "https://github.com/qca/open-ath9k-htc-firmware.git")
37 (commit version)))
38 (sha256
39 (base32
7c473310 40 "16jbj8avg5jkgvq5lxm0hdxxn4c3zn7fx8b4nxllvr024apk9w23"))
821f4dc2 41 (file-name (string-append name "-" version "-checkout"))
fc1adab1 42 (patches (search-patches "ath9k-htc-firmware-objcopy.patch"))))
4902c3ec
LC
43 (build-system gnu-build-system)
44 (arguments
45 '(#:phases (alist-cons-before
46 'configure 'pre-configure
47 (lambda* (#:key inputs #:allow-other-keys)
48 (chdir "target_firmware")
49
50 ;; 'configure' is a simple script that runs 'cmake' with
51 ;; the right flags.
52 (substitute* "configure"
53 (("^TOOLCHAIN=.*$")
54 (string-append "TOOLCHAIN="
55 (assoc-ref inputs "cross-gcc")
56 "\n"))))
57 (alist-replace
58 'install
59 (lambda* (#:key outputs #:allow-other-keys)
60 (let* ((out (assoc-ref outputs "out"))
61 (fw-dir (string-append out "/lib/firmware")))
62 (mkdir-p fw-dir)
63 (for-each (lambda (file)
64 (copy-file file
65 (string-append fw-dir "/"
66 (basename file))))
67 (find-files "." "\\.fw$"))
68 #t))
69 %standard-phases))
70 #:tests? #f))
71
72 ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.)
73 ;; Use our own tool chain for that.
74 (native-inputs `(("cross-gcc" ,xgcc-xtensa)
75 ("cross-binutils" ,(cross-binutils "xtensa-elf"))
76 ("cmake" ,cmake)
77 ("perl" ,perl)))
78 (home-page "http://wireless.kernel.org/en/users/Drivers/ath9k_htc")
79 (synopsis "Firmware for the Atheros AR7010 and AR9271 USB 802.11n NICs")
80 (description
81 "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB
e881752c 82802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of
4902c3ec 83Linux-libre.")
166191b3 84 (license (non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD"))))