recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / tools / mlocate / recipe
blob0772eb1ec5f2bb09eff575394d5903fcc4fef673
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
19 set -e
21 program=mlocate
22 version=0.26
23 release=2
25 # Define a category for the output of the package name
26 pkgcategory=tools
28 tarname=${program}-${version}.tar.xz
30 # Remote source(s)
31 fetch=https://releases.pagure.org/${program}/$tarname
33 description="
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
42 license=GPLv2+
44 # Source documentation
45 docs="AUTHORS ChangeLog COPYING NEWS README"
46 docsdir="${docdir}/${program}-${version}"
48 build()
50     unpack "${tardir}/$tarname"
52     cd "$srcdir"
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" \
64      $configure_args \
65      --libdir=/usr/lib${libSuffix} \
66      --localstatedir=/var/lib \
67      --mandir=$mandir \
68      --docdir=$docsdir \
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
84     # Copy custom files
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" \
91           "${destdir}/etc/"
92     chmod 0644 "${destdir}/etc/updatedb.conf"
94     # To handle config file(s)
95     touch "${destdir}/etc/.graft-config"
97     # Compress man pages
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"
103     # Copy documentation
104     mkdir -p "${destdir}/$docsdir"
105     cp -p $docs "${destdir}/$docsdir"