;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012-2017, 2019-2020, 2022, 2023 Ludovic Courtès ;;; Copyright © 2014, 2015, 2018 Mark H Weaver ;;; Copyright © 2015, 2017 Leo Famulari ;;; Copyright © 2016, 2017, 2018, 2019, 2022 Efraim Flashner ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020 Zhu Zihao ;;; Copyright © 2021 Marius Bakke ;;; ;;; 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 . (define-module (gnu packages bash) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) #:use-module (gnu packages compression) #:use-module (gnu packages elf) #:use-module (gnu packages ncurses) #:use-module (gnu packages readline) #:use-module (gnu packages bison) #:use-module (gnu packages linux) #:use-module (gnu packages libffi) #:use-module (gnu packages pkg-config) #:use-module (gnu packages guile) #:use-module (gnu packages version-control) #:use-module (gnu packages less) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (guix store) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:autoload (guix gnupg) (gnupg-verify*) #:autoload (guix base32) (bytevector->nix-base32-string) ;; See for why not #:autoload here. #:use-module ((gcrypt hash) #:select (port-sha256)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 format)) (define (patch-url seqno) "Return the URL of Bash patch number SEQNO." (format #f "mirror://gnu/bash/bash-5.1-patches/bash51-~3,'0d" seqno)) (define (bash-patch seqno sha256-bv) "Return the origin of Bash patch SEQNO, with expected hash SHA256-BV." (origin (method url-fetch) (uri (patch-url seqno)) (sha256 sha256-bv))) (define-syntax-rule (patch-series (seqno hash) ...) (list (bash-patch seqno (base32 hash)) ...)) (define %patch-series-5.1 ;; This is the current patches series for 5.1, generated using ;; 'download-patches' below. (patch-series (1 "1ymm8ppss6gyh9ifznjwiabrb4k91npd09c10y7mk66xp8yppc7b") (2 "1gjx9zqcm407am3n2sh44b8dxm48kgm15rzfiijqxr01m0hn3shm") (3 "1cdnpbfc64yhvkjj4d12s9ywp11g195vzfl1cab24sq55wkcrwi2") (4 "11iwhy6v562bv0kk7lwj7f5jj65ma9bblivy0v02h3ggcibbdbls") (5 "19bdyigdr81824nxvqr6a7k0cax60wq7376j6b91afbnwvlvbjyc") (6 "051x8wlwrqk0yr0zg378vh824iklfl5g9pkmcdf62qp8gn9pvqbm") (7 "0fir80pp1gmlpadmqcgkrv4y119pc7xllchjzg05fd7px73viz5c") (8 "1lfjgshk8i9vch92p5wgc9r90j3phw79aa7gbai89w183b2z6b7j") (9 "1vn36dzd9g4y1h3jiss6418crla0rbcd0d6wwsyv9d5l7aaxlp74") (10 "0amfmvbzsand7bdypylkjdpcp88fa3cplfshn7vyzv2ff2rdgj52") (11 "0yq24abb4fzfxqnwl20b330sxl9lr9ds0nc4yi30f81l94b1y6aq") (12 "165bff97ffih49vfs4mkr5w3z5gn1w6zfyrf773iajkw6v48kw8h") (13 "1bfmgv3lagbk3aq9a831d29xv7jz4sjq7jhn9hq89limyinvdb67") (14 "1l43dw4kpddn7l41i8wmj406z9abxky1wb3rk8krcys33g4f0kka") (15 "1w40vzadzx019v0zhs4q6yqycrk04x1k8xs6qb73vk7ny4p6jdqv") (16 "0krqqljz4bkp9wrdnwfx51bxkb8rkwf8ivc93as1znx5fr7i96c8"))) (define (download-patches store count) "Download COUNT Bash patches into store. Return a list of number/base32-hash tuples, directly usable in the 'patch-series' form." (unfold (cut > <> count) (lambda (number) (let* ((patch (download-to-store store (patch-url number))) (sig (download-to-store store (string-append (patch-url number) ".sig")))) (unless (eq? 'valid-signature (gnupg-verify* sig patch)) (error "failed to verify signature" patch)) (list number (bytevector->nix-base32-string (call-with-input-file patch port-sha256))))) 1+ 1)) (define-public bash (let* ((cppflags (string-join '("-DDEFAULT_PATH_VALUE='\"/no-such-path\"'" "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'" "-DNON_INTERACTIVE_LOGIN_SHELLS" "-DSSH_SOURCE_BASHRC") " ")) (configure-flags ``("--without-bash-malloc" "--with-installed-readline" ,,(string-append "CPPFLAGS=" cppflags) ,(string-append "LDFLAGS=-Wl,-rpath -Wl," (assoc-ref %build-inputs "readline") "/lib" " -Wl,-rpath -Wl," (assoc-ref %build-inputs "ncurses") "/lib"))) (version "5.1")) (package (name "bash") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/bash/bash-" version ".tar.gz")) (sha256 (base32 "1alv68wplnfdm6mh39hm57060xgss