8.45. Bash-5.2.37

The Bash package contains the Bourne-Again Shell.

Approximate build time: 1.4 SBU
Required disk space: 53 MB

8.45.1. Installation of Bash

Create the PKGBUILD for the Bash package with the following commands:

mkdir /sources/bash
cd /sources/bash
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="bash"
pkgver="5.2.37"
pkgrel="1"
pkgdesc="The Bash package contains the Bourne-Again SHell."
arch=('x86'
      'x86_64')
url="https://www.gnu.org/software/bash/"
license=('GPLv3')
groups=('core')
depends=('glibc'
         'ncurses'
         'readline'
         'rootfs')
makedepends=('bash'
             'binutils'
             'bison'
             'coreutils'
             'diffutils'
             'gawk'
             'gcc'
             'grep'
             'make'
             'patch'
             'sed'
             'texinfo')
checkdepends=('expect'
              'shadow')
optdepends=('xorg')
source=('https://ftp.gnu.org/gnu/bash/bash-5.2.37.tar.gz')
md5sums=('9c28f21ff65de72ca329c1779684a972')
    
build(){
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr             \
              --without-bash-malloc     \
              --with-installed-readline \
              --docdir=/usr/share/doc/bash-${version}
  make
}

check(){
  cd ${pkgname}-${pkgver}
  make -k check || true
}

package(){
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
REALEOF

The meaning of the new configure option:

--with-installed-readline

This option tells Bash to use the readline library that is already installed on the system rather than using its own readline version.

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp bash-5.2.37-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/bash-5.2.37-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Bash package:

pacman -Syu
pacman -S bash --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/bash
cp PKGBUILD /srv/pacman/source/LFS/bash
cd /sources
rm -rf bash

Run the newly compiled bash program (replacing the one that is currently being executed):

exec /usr/bin/bash --login

8.45.2. Contents of Bash

Installed programs: bash, bashbug, and sh (link to bash)
Installed directory: /usr/include/bash, /usr/lib/bash, and /usr/share/doc/bash-5.2.37

Short Descriptions

bash

A widely-used command interpreter; it performs many types of expansions and substitutions on a given command line before executing it, thus making this interpreter a powerful tool

bashbug

A shell script to help the user compose and mail standard formatted bug reports concerning bash

sh

A symlink to the bash program; when invoked as sh, bash tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well