recipes: shells/bash: Apply official patches up to level 016
[dragora.git] / recipes / shells / bash / recipe
blobb01bf7d228bbb6c1b884b5b22fdef8ff4a5e799b
1 # Build recipe for GNU bash.
3 # Copyright (c) 2016-2019, 2021-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=bash
21 version=5.1
22 release=4
24 # Define a category for the output of the package name
25 pkgcategory=shells
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://ftp.gnu.org/gnu/bash/$tarname
32 description="
33 The Bourne Again SHell (version $version).
35 Bash is an sh-compatible shell that incorporates useful features from
36 the Korn shell (ksh) and C shell (csh).  It is intended to conform to
37 the IEEE POSIX P1003.2/ISO 9945.2 shell and tools standard.
39 It offers functional improvements over sh for both programming and
40 interactive use.
43 homepage=https://www.gnu.org/software/bash
44 license=GPLv3+
46 # Limit package name to the program name
47 full_pkgname="${program}@${pkgcategory}"
49 # Source documentation
50 docsdir="${docdir}/${program}"
52 build()
54     unpack "${tardir}/$tarname"
56     cd "$srcdir"
58     # Set sane permissions
59     chmod -R u+w,go-w,a+rX-s .
61     # Apply patches from upstream
62     for file in "${worktree}"/patches/bash/bash51-???*
63     do
64         if test -f "$file"
65         then
66             patch -Np0 -i "$file"
67         fi
68     done
70     ./configure CPPFLAGS="$QICPPFLAGS" \
71     CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
72      $configure_args \
73      --libdir=/usr/lib${libSuffix} \
74      --infodir=$infodir \
75      --mandir=$mandir \
76      --docdir=$docsdir \
77      --enable-static-link \
78      --with-installed-readline \
79      --without-bash-malloc \
80      --build="$(gcc -dumpmachine)"
82     make -j${jobs} V=1
83     make -j${jobs} DESTDIR="$destdir" install
85     # Compress info documents deleting index file for the package
86     if test -d "${destdir}/$infodir"
87     then
88         rm -f "${destdir}/${infodir}/dir"
89         lzip -9 "${destdir}/${infodir}"/*
90     fi
92     # Compress and link man pages (if needed)
93     if test -d "${destdir}/$mandir"
94     then
95         (
96             cd "${destdir}/$mandir"
97             find . -type f -exec lzip -9 {} +
98             find . -type l | while read -r file
99             do
100                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
101                 rm -- "$file"
102             done
103         )
104     fi