recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / tools / lvm2 / recipe
blob72a131a8e75fcf538aa2bbaaefebc941cfa68467
1 # Build recipe for lvm2.
3 # Copyright (c) 2018-2019, 2022 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
18 set -e
20 program=LVM2
21 version=2.02.168
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=tools
27 pkgname=lvm2
29 tarname=${program}.${version}.tgz
31 # Remote source(s)
32 fetch=https://sourceware.org/ftp/lvm2/releases/$tarname
34 description="
35 Logical Volume Management tools.
37 LVM2 refers to the userspace toolset that provide
38 logical volume management facilities on GNU/linux.
41 homepage=https://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}
51 build()
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
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" \
68      $configure_args \
69      --libdir=/usr/lib${libSuffix} \
70      --with-usrlibdir=/usr/lib${libSuffix} \
71      --with-udev-prefix="" \
72      --mandir=$mandir \
73      --docdir=$docsdir \
74      --enable-pkgconfig \
75      --enable-applib \
76      --enable-cmdlib \
77      --enable-dmeventd \
78      --enable-udev_rules \
79      --enable-udev_sync \
80      --disable-readline \
81      --with-lvm1=internal \
82      --with-thin=internal \
83      --with-device-uid=0 \
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"
100     then
101         (
102             cd "${destdir}/$mandir"
103             find . -type f -exec lzip -9 {} +
104             find . -type l | while read -r file
105             do
106                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
107                 rm -- "$file"
108             done
109         )
110     fi
112     # Copy documentation
113     mkdir -p "${destdir}/$docsdir"
114     cp -p $docs "${destdir}/$docsdir"