1 # Build recipe for mlocate.
3 # Copyright (c) 2017 Alan Beadle, <ab.beadle@gmail.com>.
4 # Copyright (c) 2017, 2021 Matias Fonzo, <selk@dragora.org>.
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # Exit immediately on any error
25 # Define a category for the output of the package name
28 tarname=${program}-${version}.tar.xz
31 fetch=https://releases.pagure.org/${program}/$tarname
34 mlocate is a locate/updatedb implementation.
36 The 'm' stands for 'merging': updatedb reuses the existing database to
37 avoid rereading most of the file system, which makes updatedb faster
38 and does not trash the system caches as much.
41 homepage=https://pagure.io/mlocate
44 # Source documentation
45 docs="AUTHORS ChangeLog COPYING NEWS README"
46 docsdir="${docdir}/${program}-${version}"
50 unpack "${tardir}/$tarname"
54 # Set sane permissions
55 chmod -R u+w,go-w,a+rX-s .
57 patch -Np1 -i "${worktree}/patches/mlocate/01-fortify-source-compat.patch"
59 # Update for hosts based on musl
60 cp -f "${worktree}/archive/common/config.guess" admin/config.guess
61 cp -f "${worktree}/archive/common/config.sub" admin/config.sub
63 ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS -static" \
65 --libdir=/usr/lib${libSuffix} \
66 --localstatedir=/var/lib \
69 --build="$(gcc -dumpmachine)"
71 make -j${jobs} groupname=locate
72 make -j${jobs} groupname=locate DESTDIR="$destdir" install
74 mv "${destdir}/usr/bin/locate" "${destdir}/usr/bin/mlocate"
75 ln -s mlocate "${destdir}/usr/bin/locate"
77 # To increase security changing the default 2755
78 chmod 2711 "${destdir}/usr/bin/mlocate"
80 # Remove generated charset.alias
81 rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
82 rmdir "${destdir}/usr/lib${libSuffix}" || true
86 mkdir -p "${destdir}/etc/cron.daily/"
87 cp -p "${worktree}/archive/mlocate/etc/cron.daily/mlocate" \
88 "${destdir}/etc/cron.daily/"
89 chmod 0755 "${destdir}/etc/cron.daily/mlocate"
90 cp -p "${worktree}/archive/mlocate/etc/updatedb.conf" \
92 chmod 0644 "${destdir}/etc/updatedb.conf"
94 # To handle config file(s)
95 touch "${destdir}/etc/.graft-config"
98 lzip -9 "${destdir}/${mandir}"/man?/*
100 # A symbolic link if someone requests locate(1)
101 ln -s locate.1.lz "${destdir}/${mandir}/man1/mlocate.1.lz"
104 mkdir -p "${destdir}${docsdir}"
105 cp -p $docs "${destdir}${docsdir}"