8.43. Bison-3.8.2

The Bison package contains a parser generator.

Approximate build time: 2.1 SBU
Required disk space: 62 MB

8.43.1. Installation of Bison

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

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

pkgname="bison"
pkgver="3.8.2"
pkgrel="1"
pkgdesc="The Bison package contains a parser generator."
arch=('x86'
      'x86_64')
url="https://www.gnu.org/software/bison/"
license=('GPLv3')
groups=('core')
depends=('glibc'
         'rootfs')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gcc'
             'gettext'
             'grep'
             'm4'
             'make'
             'perl'
             'sed')
checkdepends=('diffutils'
              'findutils'
              'flex')
optdepends=('doxygen: to build additional documetation')
source=('https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz')
md5sums=('c28f119f405a2304ff0a7ccdcc629713')
    
build(){
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --docdir=/usr/share/doc/${pkgname}-${pkgver}
  make
}

check(){
  cd ${pkgname}-${pkgver}
  make check
}

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

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

Update the local cache and install the Bison package:

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

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

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

8.43.2. Contents of Bison

Installed programs: bison and yacc
Installed library: liby.a
Installed directory: /usr/share/bison

Short Descriptions

bison

Generates, from a series of rules, a program for analyzing the structure of text files; Bison is a replacement for Yacc (Yet Another Compiler Compiler)

yacc

A wrapper for bison, meant for programs that still call yacc instead of bison; it calls bison with the -y option

liby

The Yacc library containing implementations of Yacc-compatible yyerror and main functions; this library is normally not very useful, but POSIX requires it