Files
BMLFS/build-scripts/lvm2.build
2025-07-04 23:19:07 -05:00

85 lines
3.2 KiB
Bash

#! /bin/bash
# LVM2
# Source: https://sourceware.org/ftp/lvm2/LVM2.2.03.33.tgz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: libaio
# Recommended: NONE
# Optional: libnvme, mdadm, reiserfsprogs, valgrind,
# Optional: xfsprogs, thin-provisioning-tools
# If optimizing with GCC:
export CFLAGS="-march=native -pipe "
export CFLAGS+="-O3 -Os -fdata-sections -ffat-lto-objects "
export CFLAGS+="-ffunction-sections -flto=4 -fno-semantic-interposition "
export CFLAGS+="-fstack-protector-strong -fzero-call-used-regs=used "
export CXXFLAGS=$CFLAGS
export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed "
# Apply patches from Chimera Linux
patch -Np1 -i ../patches/lvm2-chimera/0001-lvresize-use-POSIX-shell.patch
patch -Np1 -i ../patches/lvm2-chimera/fix-stdio-usage.patch
patch -Np1 -i ../patches/lvm2-chimera/mlockall-default-config.patch
patch -Np1 -i ../patches/lvm2-chimera/portable-install-1.patch
patch -Np1 -i ../patches/lvm2-chimera/scripts-gnu.patch
patch -Np1 -i ../patches/lvm2-chimera/udev-no-systemd.patch
export PVER="2.03.33"
#If building with clang-17.x, add these flags:
CFLAGS="$CFLAGS -Wno-implicit-function-declaration -Wno-int-conversion " \
PATH+=:/usr/sbin \
./configure --prefix=/usr \
--exec-prefix= \
--enable-cmdlib \
--enable-pkgconfig \
--enable-udev_sync \
--libdir=/usr/lib \
--with-symvers=no $BUILDTRUPLE &&
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
sudo -S mkdir -pv /BMAN/install /BMAN/usr && \
sudo -S mv $BUILD/usr/share /BMAN/usr/ && \
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
lvm2: lvm2 (Logical Volume Manager version 2)
lvm2:
lvm2: Heinz Mauelshagen's LVM (Logical Volume Manager) for Linux.
lvm2: LVM adds an additional layer between the physical peripherals and the
lvm2: low-level I/O interface to get a logical view of disks. This allows
lvm2: the concatenation of several disks (so-called physical volumes or PVs)
lvm2: to form a storage pool (so-called Volume Group or VG) with allocation
lvm2: units called physical extents (called PE). With LVM, you can extend,
lvm2: resize, or relocate storage dynamically.
lvm2:
lvm2:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/lvm2-$PVER-$PSUFFIX && \
cd /BMAN && \
cat > /tmp/slack-desc << "EOF"
lvm2-doc: Manuals for lvm2
lvm2-doc:
lvm2-doc: An additional layer between the physical peripherals and the
lvm2-doc: low-level I/O interface to get a logical view of disks.
lvm2-doc:
EOF
sudo -S mv -v /tmp/slack-desc install/ && \
sudo -S makepkg -l y -c n $PKGS/lvm2-doc-$PVER-$NOPSUFFIX && \
sudo -S rm -rf ${BUILD}/* /BMAN/*