1 # Build recipe for lvm2.
3 # Copyright (c) 2018-2019 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
24 # Define a category for the output of the package name
29 tarname=${program}.${version}.tgz
32 fetch=http://sourceware.org/ftp/lvm2/releases/$tarname
35 Logical Volume Management tools.
37 LVM2 refers to the userspace toolset that provide
38 logical volume management facilities on GNU/linux.
41 homepage=http://www.sourceware.org/lvm2
42 license="GPLv2+, LGPL2.1"
44 # Source documentation
45 docs="COPYING* README VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM"
46 docsdir="${docdir}/${program}-${version}"
48 # The package has a custom source directory
49 srcdir=${program}.${version}
53 unpack "${tardir}/$tarname"
57 # Set sane permissions
58 chmod -R u+w,go-w,a+rX-s .
60 # Apply patches from Alpine Linux in order to build against Musl
61 patch -p1 < "${worktree}/patches/lvm2/fix-stdio-usage.patch"
62 patch -p1 < "${worktree}/patches/lvm2/mallinfo.patch"
63 patch -p1 < "${worktree}/patches/lvm2/library_dir-default-config.patch"
64 patch -p1 < "${worktree}/patches/lvm2/mlockall-default-config.patch"
66 # --enable-static_link does not work in this version
67 ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
69 --libdir=/usr/lib${libSuffix} \
70 --with-usrlibdir=/usr/lib${libSuffix} \
71 --with-udev-prefix=/usr/lib${libSuffix} \
81 --with-lvm1=internal \
82 --with-thin=internal \
84 --with-device-gid=11 \
85 --with-device-mode=0660 \
86 --build="$(gcc -dumpmachine)"
88 make -j${jobs} DESTDIR="$destdir" install
90 # Strip remaining binaries and libraries
91 find "$destdir" -type f | xargs file | \
92 awk '/ELF/ && /executable/ || /shared object/' | \
93 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
95 # Manage .new (config) files via graft(8)
96 touch "${destdir}/etc/lvm/.graft-config"
98 # Compress and link man pages (if needed)
99 if test -d "${destdir}/$mandir"
102 cd "${destdir}/$mandir"
103 find . -type f -exec lzip -9 {} +
104 find . -type l | while read -r file
106 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
113 mkdir -p "${destdir}${docsdir}"
114 cp -p $docs "${destdir}${docsdir}"