40 lines
1.4 KiB
Bash
Executable File
40 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================================
|
|
# DarkForge Linux — Phase 3, Chapter 8.27: Libcap (POSIX Capabilities)
|
|
# ============================================================================
|
|
# Purpose: Build libcap, a library for managing POSIX capabilities on
|
|
# executables. Used for privilege separation without full root.
|
|
# Required by various system tools and by polkit (for privilege escalation).
|
|
# Inputs: /sources/libcap-2.76.tar.xz
|
|
# Outputs: libcap library in /usr/lib, utilities in /usr/sbin
|
|
# Ref: LFS 13.0 §8.27
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
source /sources/toolchain-scripts/100-chroot-env.sh
|
|
|
|
PACKAGE="libcap"
|
|
VERSION="2.76"
|
|
|
|
echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ==="
|
|
|
|
pkg_extract "${PACKAGE}-${VERSION}.tar.xz"
|
|
cd "${PACKAGE}-${VERSION}"
|
|
|
|
# Prevent static linking (we want shared libraries)
|
|
sed -i '/^LIBDIR/s/lib/lib/' Makefile
|
|
|
|
# Build and install with optimizations
|
|
make lib=lib
|
|
make lib=lib DESTDIR=/ install
|
|
|
|
# Install headers
|
|
install -Dm644 libcap/include/sys/capability.h /usr/include/sys/capability.h
|
|
|
|
# Verify installation
|
|
echo "libcap version: $(/usr/sbin/getcap -V 2>&1 || echo 'libcap installed')"
|
|
|
|
cd "${SRCDIR}"
|
|
pkg_cleanup "${PACKAGE}-${VERSION}"
|
|
echo "=== ${PACKAGE}-${VERSION} complete ==="
|