From 59280e891b663f2e23b90730323c0e0db1bb6d4e Mon Sep 17 00:00:00 2001 From: Alex Griffin Date: Fri, 3 Jan 2020 13:18:41 -0600 Subject: [PATCH] nongnu: broadcom-sta: Support 32-bit systems. * nongnu/packages/linux.scm (broadcom-sta-version, broadcom-sta-x86_64-source, broadcom-sta-i686-source): New variables. (broadcom-sta): Move source to native-inputs and choose source by arch. --- nongnu/packages/linux.scm | 95 +++++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 33 deletions(-) diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm index bc22938..8a15cf9 100644 --- a/nongnu/packages/linux.scm +++ b/nongnu/packages/linux.scm @@ -27,6 +27,7 @@ #:use-module (guix git-download) #:use-module (guix build-system linux-module) #:use-module (guix build-system trivial) + #:use-module (ice-9 match) #:use-module (nonguix licenses)) (define (linux-urls version) @@ -224,45 +225,73 @@ support for 5GHz and 802.11ac, among others.") "https://git.kernel.org/pub/scm/linux/kernel/git/firmware" "/linux-firmware.git/plain/LICENCE.iwlwifi_firmware"))))) +(define broadcom-sta-version "6.30.223.271") + +(define broadcom-sta-x86_64-source + (origin + (method url-fetch/tarbomb) + (uri (string-append "https://docs.broadcom.com/docs-and-downloads/" + "docs/linux_sta/hybrid-v35_64-nodebug-pcoem-" + (string-replace-substring broadcom-sta-version "." "_") + ".tar.gz")) + (patches + (parameterize + ((%patch-path + (map (lambda (directory) + (string-append directory "/nongnu/packages/patches")) + %load-path))) + ;; https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/broadcom-sta + ;; https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/broadcom-wl-dkms + (search-patches "broadcom-sta-gcc.patch" + "broadcom-sta-license.patch" + "broadcom-sta-null-pointer-fix.patch" + "broadcom-sta-rdtscl.patch" + "broadcom-sta-linux-4.7.patch" + "broadcom-sta-linux-4.8.patch" + "broadcom-sta-debian-fix-kernel-warnings.patch" + "broadcom-sta-linux-4.11.patch" + "broadcom-sta-linux-4.12.patch" + "broadcom-sta-linux-4.15.patch" + "broadcom-sta-fix_mac_profile_discrepancy.patch" + "broadcom-sta-linux-5.1.patch"))) + (sha256 + (base32 + "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz")))) + +(define broadcom-sta-i686-source + (origin + (inherit broadcom-sta-x86_64-source) + (uri (string-append "https://docs.broadcom.com/docs-and-downloads/" + "docs/linux_sta/hybrid-v35-nodebug-pcoem-" + (string-replace-substring broadcom-sta-version "." "_") + ".tar.gz")) + (sha256 + (base32 + "1kaqa2dw3nb8k23ffvx46g8jj3wdhz8xa6jp1v3wb35cjfr712sg")))) + (define-public broadcom-sta (package (name "broadcom-sta") - (version "6.30.223.271") - (source - (origin - (method url-fetch/tarbomb) - (uri (string-append "https://docs.broadcom.com/docs-and-downloads/" - "docs/linux_sta/hybrid-v35_64-nodebug-pcoem-" - (string-replace-substring version "." "_") - ".tar.gz")) - (patches - (parameterize - ((%patch-path - (map (lambda (directory) - (string-append directory "/nongnu/packages/patches")) - %load-path))) - ;; https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/linux/broadcom-sta - ;; https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/broadcom-wl-dkms - (search-patches "broadcom-sta-gcc.patch" - "broadcom-sta-license.patch" - "broadcom-sta-null-pointer-fix.patch" - "broadcom-sta-rdtscl.patch" - "broadcom-sta-linux-4.7.patch" - "broadcom-sta-linux-4.8.patch" - "broadcom-sta-debian-fix-kernel-warnings.patch" - "broadcom-sta-linux-4.11.patch" - "broadcom-sta-linux-4.12.patch" - "broadcom-sta-linux-4.15.patch" - "broadcom-sta-fix_mac_profile_discrepancy.patch" - "broadcom-sta-linux-5.1.patch"))) - (sha256 - (base32 - "1gj485qqr190idilacpxwgqyw21il03zph2rddizgj7fbd6pfyaz")))) + (version broadcom-sta-version) + (source #f) (build-system linux-module-build-system) (arguments `(#:linux ,linux - #:tests? #f)) - (supported-systems '("x86_64-linux")) + #:tests? #f + #:phases + (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (let ((source (assoc-ref inputs "broadcom-sta-source"))) + (invoke "tar" "xf" source) + (chdir ((@@ (guix build gnu-build-system) first-subdirectory) ".")) + #t)))))) + (supported-systems '("i686-linux" "x86_64-linux")) + (native-inputs + `(("broadcom-sta-source" + ,(match (or (%current-target-system) (%current-system)) + ("x86_64-linux" broadcom-sta-x86_64-source) + (_ broadcom-sta-i686-source))))) (home-page "https://www.broadcom.com/support/802.11") (synopsis "Broadcom 802.11 Linux STA wireless driver") (description "This package contains Broadcom's IEEE 802.11a/b/g/n/ac hybrid