Libelf is a library for handling ELF (Executable and Linkable Format) files.
Libelf is part of the elfutils-0.192 package. Use the elfutils-0.192.tar.bz2 file as the source tarball.
Create the PKGBUILD for the Libelf package with the following commands:
mkdir /sources/libelf
cd /sources/libelf
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>
pkgname="libelf"
pkgver="0.192"
pkgrel="1"
pkgdesc="Libelf is a library for handling ELF (Executable and Linkable Format) files."
arch=('x86'
'x86_64')
url="https://sourceware.org/elfutils/"
license=('GPLv2'
'GPLv3'
'LGPLv3')
groups=('core')
depends=('bzip2'
'glibc'
'xz'
'zlib'
'zstd')
makedepends=('bash'
'binutils'
'coreutils'
'gcc'
'make')
checkdepends=('iproute2')
source=('https://sourceware.org/ftp/elfutils/0.192/elfutils-0.192.tar.bz2')
md5sums=('a6bb1efc147302cfc15b5c2b827f186a')
build(){
cd ${_pkgname}-${pkgver}
./configure --prefix=/usr \
--disable-debuginfod \
--enable-libdebuginfod=dummy
make
}
check(){
cd ${_pkgname}-${pkgver}
make check
}
package(){
cd ${_pkgname}-${pkgver}
# Install only libelf
make DESTDIR=${pkgdir} -C libelf install
install -vm644 config/libelf.pc ${pkgdir}/usr/lib/pkgconfig
rm ${pkgdir}/usr/lib/libelf.a
}
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 elfutils-0.192-1-$(uname -m).pkg.tar.xz \
/srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
/srv/pacman/repos/LFS/elfutils-0.192-1-$(uname -m).pkg.tar.xz
Update the local cache and install the Libelf package:
pacman -Syu pacman -S libelf --overwrite \* -dd --noconfirm
Finally, copy the source files into the source repository and clean up the build directory:
mkdir /srv/pacman/source/LFS/libelf cp PKGBUILD /srv/pacman/source/LFS/libelf cd /sources rm -rf libelf