8.24. MPFR-4.2.1

The MPFR package contains functions for multiple precision math.

Approximate build time: 0.2 SBU
Required disk space: 43 MB

8.24.1. Installation of MPFR

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

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

pkgname="mpfr"
pkgver="4.2.1"
pkgrel="1"
pkgdesc="The MPFR package contains functions for multiple precision math."
arch=('x86'
      'x86_64')
url="https://www.mpfr.org/"
license=('GPLv3'
         'LGPLv3')
groups=('core')
depends=('glibc'
         'gmp')
makedepends=('bash'
             'binutils'
             'coreutils'
             'diffutils'
             'gawk'
             'gcc'
             'grep'
             'gmp'
             'make'
             'sed'
             'texinfo')
source=('https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz')
md5sums=('523c50c6318dde6f9dc523bc0244690a')
    
build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr        \
              --disable-static     \
              --enable-thread-safe \
              --docdir="/usr/share/doc/${pkgname}-${pkgver}"
  make
  make html
}

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

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  make DESTDIR="${pkgdir}" install-html
}
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 mpfr-4.2.1-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/mpfr-4.2.1-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Mpfr package:

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

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

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

8.24.2. Contents of MPFR

Installed libraries: libmpfr.so
Installed directory: /usr/share/doc/mpfr-4.2.1

Short Descriptions

libmpfr

Contains multiple-precision math functions