recipes: Respect (explicit) CPPFLAGS
[dragora.git] / recipes / tools / udevil / recipe
blobdecab14b9d3dd3c2b8a3f56f75cbd807be846a02
1 # Build recipe for udevil.
3 # Copyright (c) 2019-2020, 2022 Matias Fonzo, <selk@dragora.org>.
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
9 #    http://www.apache.org/licenses/LICENSE-2.0
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.
17 # Exit immediately on any error
18 set -e
20 program=udevil
21 version=20150504_ce9f1c5
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=tools
27 tarname=${program}-${version}.tar.lz
29 # Remote source(s)
30 fetch="
31  https://rsync.dragora.org/current/sources/$tarname
32  https://mirror.cedia.org.ec/dragora/current/sources/$tarname
35 description="
36 Mounts and unmounts devices without password.
38 udevil is a command line GNU/Linux program which mounts and unmounts
39 removable devices without a password, shows device info, and monitors
40 device changes.  It can also mount ISO files, nfs://, smb://,
41 ftp://, ssh:// and WebDAV URLs, and tmpfs/ramfs filesystems.
44 homepage=https://github.com/ignorantguru/udevil
45 license=GPLv3+
47 # Source documentation
48 docs="AUTHORS COPYING ChangeLog NEWS README"
49 docsdir="${docdir}/${program}-${version}"
51 build()
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
57     # Update for hosts based on musl
58     cp -f "${worktree}/archive/common/config.guess" config.guess
59     cp -f "${worktree}/archive/common/config.sub" config.sub
61     # Set sane permissions
62     chmod -R u+w,go-w,a+rX-s .
64     ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
65      $configure_args \
66      --libdir=/usr/lib${libSuffix} \
67      --mandir=$mandir \
68      --docdir=$docsdir \
69      --disable-systemd \
70      --build="$(gcc -dumpmachine)"
72     make -j${jobs} V=1
73     make -j${jobs} libdir=/usr/lib${libSuffix} \
74      DESTDIR="$destdir" install-strip
76     # To handle (dot) .new files via graft(1)
77     touch "${destdir}/etc/udevil/.graft-config"
79     # Restrict execution of udevil to the 'plugdev' group
80     chown root:plugdev "${destdir}/usr/bin/udevil"
81     chmod u+s,go-s,o-x "${destdir}/usr/bin/udevil"
83     # Install devmon (udevil) perp service
85     mkdir -p "${destdir}/etc/perp/devmon"
87     cp -p "${worktree}/archive/udevil/rc.log" \
88           "${worktree}/archive/udevil/rc.main" \
89           "${destdir}/etc/perp/devmon/"
91     chmod 755 "${destdir}"/etc/perp/devmon/rc.*
93     # Be an active service by default
94     chmod +t "${destdir}/etc/perp/devmon"
96     # To handle config file(s)
97     touch "${destdir}/etc/perp/devmon/.graft-config"
99     # Compress and link man pages (if needed)
100     if test -d "${destdir}/$mandir"
101     then
102         (
103             cd "${destdir}/$mandir"
104             find . -type f -exec lzip -9 {} +
105             find . -type l | while read -r file
106             do
107                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
108                 rm -- "$file"
109             done
110         )
111     fi
113     # Copy documentation
114     mkdir -p "${destdir}${docsdir}"
115     cp -p $docs "${destdir}${docsdir}"