recipe 3.2 KB

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