recipe 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # Build recipe for lvm2.
  2. #
  3. # Copyright (c) 2018-2019, 2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. # Exit immediately on any error
  17. set -e
  18. program=LVM2
  19. version=2.02.168
  20. release=3
  21. # Define a category for the output of the package name
  22. pkgcategory=tools
  23. pkgname=lvm2
  24. tarname=${program}.${version}.tgz
  25. # Remote source(s)
  26. fetch=https://sourceware.org/ftp/lvm2/releases/$tarname
  27. description="
  28. Logical Volume Management tools.
  29. LVM2 refers to the userspace toolset that provide
  30. logical volume management facilities on GNU/linux.
  31. "
  32. homepage=https://www.sourceware.org/lvm2
  33. license="GPLv2+, LGPL2.1"
  34. # Source documentation
  35. docs="COPYING* README VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM"
  36. docsdir="${docdir}/${program}-${version}"
  37. # The package has a custom source directory
  38. srcdir=${program}.${version}
  39. build()
  40. {
  41. unpack "${tardir}/$tarname"
  42. cd "$srcdir"
  43. # Set sane permissions
  44. chmod -R u+w,go-w,a+rX-s .
  45. # Apply patches from Alpine Linux in order to build against Musl
  46. patch -p1 < "${worktree}/patches/lvm2/fix-stdio-usage.patch"
  47. patch -p1 < "${worktree}/patches/lvm2/mallinfo.patch"
  48. patch -p1 < "${worktree}/patches/lvm2/library_dir-default-config.patch"
  49. patch -p1 < "${worktree}/patches/lvm2/mlockall-default-config.patch"
  50. # --enable-static_link does not work in this version
  51. ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
  52. $configure_args \
  53. --libdir=/usr/lib${libSuffix} \
  54. --with-usrlibdir=/usr/lib${libSuffix} \
  55. --with-udev-prefix="" \
  56. --mandir=$mandir \
  57. --docdir=$docsdir \
  58. --enable-pkgconfig \
  59. --enable-applib \
  60. --enable-cmdlib \
  61. --enable-dmeventd \
  62. --enable-udev_rules \
  63. --enable-udev_sync \
  64. --disable-readline \
  65. --with-lvm1=internal \
  66. --with-thin=internal \
  67. --with-device-uid=0 \
  68. --with-device-gid=11 \
  69. --with-device-mode=0660 \
  70. --build="$(gcc -dumpmachine)"
  71. make -j${jobs} DESTDIR="$destdir" install
  72. # Strip remaining binaries and libraries
  73. find "$destdir" -type f | xargs file | \
  74. awk '/ELF/ && /executable/ || /shared object/' | \
  75. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  76. # Manage .new (config) files via graft(8)
  77. touch "${destdir}/etc/lvm/.graft-config"
  78. # Compress and link man pages (if needed)
  79. if test -d "${destdir}/$mandir"
  80. then
  81. (
  82. cd "${destdir}/$mandir"
  83. find . -type f -exec lzip -9 {} +
  84. find . -type l | while read -r file
  85. do
  86. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  87. rm -- "$file"
  88. done
  89. )
  90. fi
  91. # Copy documentation
  92. mkdir -p "${destdir}/$docsdir"
  93. cp -p $docs "${destdir}/$docsdir"
  94. }