recipe 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Build recipe for mlocate.
  2. #
  3. # Copyright (c) 2017 Alan Beadle, <ab.beadle@gmail.com>.
  4. # Copyright (c) 2017, 2021 Matias Fonzo, <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Exit immediately on any error
  18. set -e
  19. program=mlocate
  20. version=0.26
  21. release=2
  22. # Define a category for the output of the package name
  23. pkgcategory=tools
  24. tarname=${program}-${version}.tar.xz
  25. # Remote source(s)
  26. fetch=https://releases.pagure.org/${program}/$tarname
  27. description="
  28. mlocate is a locate/updatedb implementation.
  29. The 'm' stands for 'merging': updatedb reuses the existing database to
  30. avoid rereading most of the file system, which makes updatedb faster
  31. and does not trash the system caches as much.
  32. "
  33. homepage=https://pagure.io/mlocate
  34. license=GPLv2+
  35. # Source documentation
  36. docs="AUTHORS ChangeLog COPYING NEWS README"
  37. docsdir="${docdir}/${program}-${version}"
  38. build()
  39. {
  40. unpack "${tardir}/$tarname"
  41. cd "$srcdir"
  42. # Set sane permissions
  43. chmod -R u+w,go-w,a+rX-s .
  44. patch -Np1 -i "${worktree}/patches/mlocate/01-fortify-source-compat.patch"
  45. # Update for hosts based on musl
  46. cp -f "${worktree}/archive/common/config.guess" admin/config.guess
  47. cp -f "${worktree}/archive/common/config.sub" admin/config.sub
  48. ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
  49. $configure_args \
  50. --libdir=/usr/lib${libSuffix} \
  51. --localstatedir=/var/lib \
  52. --mandir=$mandir \
  53. --docdir=$docsdir \
  54. --build="$(gcc -dumpmachine)"
  55. make -j${jobs} groupname=locate
  56. make -j${jobs} groupname=locate DESTDIR="$destdir" install
  57. mv "${destdir}/usr/bin/locate" "${destdir}/usr/bin/mlocate"
  58. ln -s mlocate "${destdir}/usr/bin/locate"
  59. # To increase security changing the default 2755
  60. chmod 2711 "${destdir}/usr/bin/mlocate"
  61. # Remove generated charset.alias
  62. rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
  63. rmdir "${destdir}/usr/lib${libSuffix}" || true
  64. # Copy custom files
  65. mkdir -p "${destdir}/etc/cron.daily/"
  66. cp -p "${worktree}/archive/mlocate/etc/cron.daily/mlocate" \
  67. "${destdir}/etc/cron.daily/"
  68. chmod 0755 "${destdir}/etc/cron.daily/mlocate"
  69. cp -p "${worktree}/archive/mlocate/etc/updatedb.conf" \
  70. "${destdir}/etc/"
  71. chmod 0644 "${destdir}/etc/updatedb.conf"
  72. # To handle config file(s)
  73. touch "${destdir}/etc/.graft-config"
  74. # Compress man pages
  75. lzip -9 "${destdir}/${mandir}"/man?/*
  76. # A symbolic link if someone requests locate(1)
  77. ln -s locate.1.lz "${destdir}/${mandir}/man1/mlocate.1.lz"
  78. # Copy documentation
  79. mkdir -p "${destdir}${docsdir}"
  80. cp -p $docs "${destdir}${docsdir}"
  81. }