recipes: boot/eudev: Added perp service for udevd(8)
[dragora.git] / recipes / boot / eudev / recipe
blobd769d4d8073dc264a25ffeb56dc18a3388127a93
1 # Build recipe for eudev.
3 # Copyright (c) 2016-2021 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=eudev
21 version=3.2.10
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=boot
27 tarname=${program}-${version}.tar.gz
29 # Remote source(s)
30 fetch=https://dev.gentoo.org/~blueness/eudev/$tarname
32 description="
33 Dynamic device management.
35 Udev is the device manager for the Linux 2.6 kernel series.
36 Its primary function is managing device nodes in /dev.
38 It is the successor of devfs and hotplug, which means that
39 it handles the /dev directory and all user space actions
40 when adding/removing devices, including firmware load.
42 This is a fork of Udev from Gentoo.
45 homepage=https://wiki.gentoo.org/wiki/Eudev
46 license=GPLv2+
48 # Source documentation
49 docs=COPYING
50 docsdir="${docdir}/${program}-${version}"
52 build()
54     unpack "${tardir}/$tarname"
56     cd "$srcdir"
58     # Set sane permissions
59     chmod -R u+w,go-w,a+rX-s .
61     ./configure CPPFLAGS="$QICPPFLAGS" \
62     CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
63      $configure_args \
64      --libdir=/usr/lib${libSuffix} \
65      --mandir=$mandir \
66      --docdir=$docsdir \
67      --enable-static=no \
68      --enable-shared=yes \
69      --enable-hwdb \
70      --enable-manpages \
71      --enable-rule-generator \
72      --enable-split-usr \
73      --disable-introspection \
74      --disable-selinux \
75      --with-rootprefix="" \
76      --with-rootlibdir=/lib \
77      --build="$(gcc -dumpmachine)"
79     # http://github.com/gentoo/eudev/pull/127
80     make -j${jobs} V=1 udevhwdbdir=/lib/udev/hwdb.d
81     make -j${jobs} udevhwdbdir=/lib/udev/hwdb.d \
82                    DESTDIR="$destdir" install-strip
84     # Make symlink for multipath
85     ( cd "${destdir}/usr/sbin" && ln -sf /lib/udev/scsi_id . )
87     # Insert custom rules
89     mkdir -p "${destdir}/etc/udev/rules.d"
90     for file in "${worktree}"/archive/eudev/etc/udev/rules.d/*
91     do
92         install -p -m 644 -o root -g root "$file" "${destdir}/etc/udev/rules.d"
93     done
95     mkdir -p "${destdir}/lib/udev"
96     for file in "${worktree}"/archive/eudev/lib/udev/*
97     do
98         install -p -m 755 -o root -g root "$file" "${destdir}/lib/udev"
99     done
100     unset -v file
102     # Install UDEVD perp service
104     mkdir -p "${destdir}/etc/perp/udevd"
106     cp -p "${worktree}/archive/eudev/etc/perp/rc.log" \
107           "${worktree}/archive/eudev/etc/perp/rc.main" \
108           "${destdir}/etc/perp/udevd/"
110     chmod 755 "${destdir}"/etc/perp/udevd/rc.*
112     # Be an active service by default
113     chmod +t "${destdir}/etc/perp/udevd"
115     # To handle config file(s)
116     touch "${destdir}/etc/udev/.graft-config" \
117           "${destdir}/etc/perp/udevd/.graft-config"
119     # Compress and link man pages (if needed)
120     if test -d "${destdir}/$mandir"
121     then
122         (
123             cd "${destdir}/$mandir"
124             find . -type f -exec lzip -9 {} +
125             find . -type l | while read -r file
126             do
127                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
128                 rm -- "$file"
129             done
130         )
131     fi
133     # Copy documentation
134     mkdir -p "${destdir}${docsdir}"
135     cp -p $docs "${destdir}${docsdir}"