The Bc package contains an arbitrary precision numeric processing language.
Prepare Bc for compilation:
Create the PKGBUILD for the Bc package with the following commands:
mkdir /sources/bc
cd /sources/bc
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="bc"
pkgver="7.0.3"
pkgrel="1"
pkgdesc="The Bc package contains an arbitrary precision numeric processing language."
arch=('x86'
'x86_64')
url="https://git.gavinhoward.com/gavin/bc"
license=('custom'
'MIT')
groups=('core')
depends=('glibc'
'ncurses'
'readline')
makedepends=('bash'
'binutils'
'coreutils'
'gcc'
'grep'
'make')
checkdepends=('gawk')
source=('https://github.com/gavinhoward/bc/releases/download/7.0.3/bc-7.0.3.tar.xz')
md5sums=('ad4db5a0eb4fdbb3f6813be4b6b3da74')
build(){
cd "${pkgname}-${pkgver}"
CC=gcc ./configure --prefix=/usr -G -O3 -r
make
}
check(){
cd "${pkgname}-${pkgver}"
make test
}
package(){
cd "${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
}
REALEOF
The meaning of the configure options:
CC=gcc
This parameter specifies the compiler to use.
-G
Omit parts of the test suite that won't work until the bc program has been installed.
-O3
Specify the optimization to use.
-r
Enable the use of Readline to improve the line editing feature of bc.
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 bc-7.0.3-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/bc-7.0.3-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Bc package:
pacman -Syu pacman -S bc --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/bc cp PKGBUILD /srv/pacman/source/LFS/bc cd /sources rm -rf bc