8.14. Readline-8.2.13

The Readline package is a set of libraries that offer command-line editing and history capabilities.

Approximate build time: less than 0.1 SBU
Required disk space: 16 MB

8.14.1. Installation of Readline

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

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

pkgname="readline"
pkgver="8.2.13"
pkgrel="1"
pkgdesc="The Readline package offers command-line editing and history capabilities."
arch=('x86'
      'x86_64')
url="https://tiswww.case.edu/php/chet/readline/rltop.html"
license=('GPLv3')
groups=('core')
depends=('glibc'
         'ncurses')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gawk'
             'gcc'
             'grep'
             'make'
             'patch'
             'sed'
             'texinfo')
source=('https://ftp.gnu.org/gnu/readline/readline-8.2.13.tar.gz')
md5sums=('05080bf3801e6874bb115cd6700b708f')

build(){
  cd "${pkgname}-${pkgver}"

  # Don't try to fix old libraries in DESTDIR
  sed -i '/MV.*old/d' Makefile.in
  sed -i '/{OLDSUFF}/c:' support/shlib-install

  # Remove -rpath
  sed -i 's/-Wl,-rpath,[^ ]*//' support/shobj-conf

  ./configure --prefix=/usr    \
              --disable-static \
              --with-curses    \
              --docdir="/usr/share/doc/${pkgname}-${pkgver}"
  make SHLIB_LIBS="-lncursesw"
}

package(){
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -vdm755 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
  install -vm644 doc/*.{ps,pdf,html,dvi} \
                 "${pkgdir}/usr/share/doc/${pkgname}-${pkgver}"
}
REALEOF

The meaning of the new configure and make options:

--with-curses

This option tells Readline that it can find the termcap library functions in the curses library, not a separate termcap library. This will generate the correct readline.pc file.

SHLIB_LIBS="-lncursesw"

This option forces Readline to link against the libncursesw library. For details see the Shared Libraries section in the package's README file.

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 readline-8.2.13-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/readline-8.2.13-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Readline package:

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

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

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

8.14.2. Contents of Readline

Installed libraries: libhistory.so and libreadline.so
Installed directories: /usr/include/readline and /usr/share/doc/readline-8.2.13

Short Descriptions

libhistory

Provides a consistent user interface for recalling lines of history

libreadline

Provides a set of commands for manipulating text entered in an interactive session of a program