8.25. MPC-1.3.1

The MPC package contains a library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.

Approximate build time: 0.1 SBU
Required disk space: 22 MB

8.25.1. Installation of MPC

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

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

pkgname="mpc"
pkgver="1.3.1"
pkgrel="1"
pkgdesc="The MPC package contains a math library for arbitrarily high precision with proper rounding."
arch=('x86'
      'x86_64')
url="https://www.multiprecision.org/"
license=('LGPLv3')
groups=('core')
depends=('glibc'
         'gmp'
         'mpfr')
makedepends=('bash'
             'binutils'
             'coreutils'
             'diffutils'
             'gawk'
             'gcc'
             'grep'
             'make'
             'sed'
             'texinfo')
source=('https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz')
md5sums=('5c9bc658c9fd0f940e8e3e0f09530c62')
    
build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr        \
              --disable-static     \
              --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 mpc-1.3.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/mpc-1.3.1-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Mpc package:

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

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

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

8.25.2. Contents of MPC

Installed libraries: libmpc.so
Installed directory: /usr/share/doc/mpc-1.3.1

Short Descriptions

libmpc

Contains complex math functions