Skip to content

Commit 089352e

Browse files
committed
sys-fs/eudev: add sticky-tags patch
This will allow libgudev to build with eudev and should likely work in most if not all cases. Upstream-Issue: eudev-project/eudev#249 Upstream-PR: eudev-project/eudev#253 Upstream-Commit: eudev-project/eudev@c5bae0b Signed-off-by: orbea <[email protected]>
1 parent cdfa2c1 commit 089352e

File tree

3 files changed

+412
-0
lines changed

3 files changed

+412
-0
lines changed

sys-fs/eudev/eudev-3.2.12-r2.ebuild

+282
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
# Copyright 1999-2023 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=8
5+
6+
KV_MIN=2.6.39
7+
8+
inherit autotools linux-info multilib-minimal toolchain-funcs udev
9+
10+
if [[ ${PV} = 9999* ]]; then
11+
EGIT_REPO_URI="https://github.com/eudev-project/eudev.git"
12+
inherit git-r3
13+
else
14+
MY_PV=${PV/_pre/-pre}
15+
SRC_URI="https://github.com/eudev-project/eudev/releases/download/v${MY_PV}/${PN}-${MY_PV}.tar.gz"
16+
S="${WORKDIR}"/${PN}-${MY_PV}
17+
18+
if [[ ${PV} != *_pre* ]] ; then
19+
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
20+
fi
21+
fi
22+
23+
DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
24+
HOMEPAGE="https://github.com/eudev-project/eudev"
25+
26+
LICENSE="LGPL-2.1 MIT GPL-2"
27+
SLOT="0"
28+
IUSE="+kmod rule-generator selinux split-usr static-libs test"
29+
RESTRICT="!test? ( test )"
30+
31+
DEPEND="
32+
>=sys-apps/util-linux-2.20
33+
>=sys-kernel/linux-headers-${KV_MIN}
34+
virtual/libcrypt:=
35+
kmod? ( >=sys-apps/kmod-16 )
36+
selinux? ( >=sys-libs/libselinux-2.1.9 )
37+
!sys-apps/gentoo-systemd-integration
38+
!sys-apps/systemd
39+
"
40+
RDEPEND="
41+
${DEPEND}
42+
acct-group/input
43+
acct-group/kvm
44+
acct-group/render
45+
acct-group/audio
46+
acct-group/cdrom
47+
acct-group/dialout
48+
acct-group/disk
49+
acct-group/floppy
50+
acct-group/input
51+
acct-group/kmem
52+
acct-group/kvm
53+
acct-group/lp
54+
acct-group/render
55+
acct-group/sgx
56+
acct-group/tape
57+
acct-group/tty
58+
acct-group/usb
59+
acct-group/video
60+
!sys-apps/systemd-utils[udev]
61+
!sys-fs/udev
62+
!sys-apps/systemd
63+
!sys-apps/hwids[udev]
64+
"
65+
BDEPEND="
66+
dev-util/gperf
67+
virtual/os-headers
68+
virtual/pkgconfig
69+
test? (
70+
app-text/tree
71+
dev-lang/perl
72+
)
73+
"
74+
PDEPEND=">=sys-fs/udev-init-scripts-26"
75+
76+
MULTILIB_WRAPPED_HEADERS=(
77+
/usr/include/udev.h
78+
)
79+
80+
PATCHES=(
81+
"${FILESDIR}"/${PN}-3.2.12-sticky-tags.patch
82+
)
83+
84+
pkg_pretend() {
85+
ewarn
86+
ewarn "As of 2013-01-29, ${PN} provides the new interface renaming functionality,"
87+
ewarn "as described in the URL below:"
88+
ewarn "https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
89+
ewarn
90+
ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing"
91+
ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable"
92+
ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules"
93+
ewarn "exists: touch /etc/udev/rules.d/80-net-name-slot.rules"
94+
ewarn
95+
}
96+
97+
pkg_setup() {
98+
CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET ~UNIX"
99+
linux-info_pkg_setup
100+
get_running_version
101+
102+
# These are required kernel options, but we don't error out on them
103+
# because you can build under one kernel and run under another.
104+
if kernel_is lt ${KV_MIN//./ }; then
105+
ewarn
106+
ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}."
107+
ewarn "Make sure to run udev under kernel version ${KV_MIN} or above."
108+
ewarn
109+
fi
110+
}
111+
112+
src_prepare() {
113+
default
114+
115+
# Change rules back to group uucp instead of dialout for now
116+
sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \
117+
|| die "failed to change group dialout to uucp"
118+
119+
# required for the sticky-tags patch
120+
#if [[ ${PV} == 9999* ]] ; then
121+
eautoreconf
122+
#fi
123+
}
124+
125+
rootprefix() {
126+
usex split-usr '' /usr
127+
}
128+
129+
sbindir() {
130+
usex split-usr sbin bin
131+
}
132+
133+
multilib_src_configure() {
134+
# bug #463846
135+
tc-export CC
136+
# bug #502950
137+
export cc_cv_CFLAGS__flto=no
138+
139+
local myeconfargs=(
140+
ac_cv_search_cap_init=
141+
ac_cv_header_sys_capability_h=yes
142+
143+
DBUS_CFLAGS=' '
144+
DBUS_LIBS=' '
145+
146+
--with-rootprefix="${EPREFIX}$(rootprefix)"
147+
--with-rootrundir=/run
148+
--exec-prefix="${EPREFIX}"
149+
--bindir="${EPREFIX}$(rootprefix)/bin"
150+
--sbindir="${EPREFIX}$(rootprefix)/$(sbindir)"
151+
--includedir="${EPREFIX}"/usr/include
152+
--libdir="${EPREFIX}/usr/$(get_libdir)"
153+
--with-rootlibexecdir="${EPREFIX}$(rootprefix)/lib/udev"
154+
$(use_enable split-usr)
155+
--enable-manpages
156+
)
157+
158+
# Only build libudev for non-native_abi, and only install it to libdir,
159+
# that means all options only apply to native_abi
160+
if multilib_is_native_abi ; then
161+
myeconfargs+=(
162+
--with-rootlibdir="${EPREFIX}$(rootprefix)/$(get_libdir)"
163+
$(use_enable kmod)
164+
$(use_enable static-libs static)
165+
$(use_enable selinux)
166+
$(use_enable rule-generator)
167+
)
168+
else
169+
myeconfargs+=(
170+
--disable-static
171+
--disable-kmod
172+
--disable-selinux
173+
--disable-rule-generator
174+
--disable-hwdb
175+
)
176+
fi
177+
178+
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
179+
}
180+
181+
multilib_src_compile() {
182+
if multilib_is_native_abi ; then
183+
emake
184+
else
185+
emake -C src/shared
186+
emake -C src/libudev
187+
fi
188+
}
189+
190+
multilib_src_test() {
191+
# Make sandbox get out of the way.
192+
# These are safe because there is a fake root filesystem put in place,
193+
# but sandbox seems to evaluate the paths of the test i/o instead of the
194+
# paths of the actual i/o that results. Also only test for native abi
195+
if multilib_is_native_abi ; then
196+
addread /sys
197+
addwrite /dev
198+
addwrite /run
199+
200+
default
201+
fi
202+
}
203+
204+
multilib_src_install() {
205+
if multilib_is_native_abi ; then
206+
emake DESTDIR="${D}" install
207+
else
208+
emake -C src/libudev DESTDIR="${D}" install
209+
fi
210+
}
211+
212+
multilib_src_install_all() {
213+
find "${ED}" -name '*.la' -delete || die
214+
215+
insinto "$(rootprefix)/lib/udev/rules.d"
216+
doins "${FILESDIR}"/40-gentoo.rules
217+
218+
use rule-generator && doinitd "${FILESDIR}"/udev-postmount
219+
}
220+
221+
pkg_postrm() {
222+
udev_reload
223+
}
224+
225+
pkg_postinst() {
226+
udev_reload
227+
228+
mkdir -p "${EROOT}"/run
229+
230+
# "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
231+
# So try to remove it here (will only work if empty).
232+
rmdir "${EROOT}"/dev/loop 2>/dev/null
233+
if [[ -d ${EROOT}/dev/loop ]]; then
234+
ewarn "Please make sure your remove /dev/loop,"
235+
ewarn "else losetup may be confused when looking for unused devices."
236+
fi
237+
238+
# REPLACING_VERSIONS should only ever have zero or 1 values but in case it doesn't,
239+
# process it as a list. We only care about the zero case (new install) or the case where
240+
# the same version is being re-emerged. If there is a second version, allow it to abort.
241+
local rv rvres=doitnew
242+
for rv in ${REPLACING_VERSIONS} ; do
243+
if [[ ${rvres} == doit* ]]; then
244+
if [[ ${rv%-r*} == ${PV} ]]; then
245+
rvres=doit
246+
else
247+
rvres=${rv}
248+
fi
249+
fi
250+
done
251+
252+
if has_version 'sys-apps/hwids[udev]'; then
253+
udevadm hwdb --update --root="${ROOT}"
254+
255+
# https://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda
256+
# reload database after it has be rebuilt, but only if we are not upgrading
257+
# also pass if we are -9999 since who knows what hwdb related changes there might be
258+
if [[ ${rvres} == doit* ]] && [[ -z ${ROOT} ]] && [[ ${PV} != "9999" ]]; then
259+
udevadm control --reload
260+
fi
261+
fi
262+
263+
if [[ ${rvres} != doitnew ]]; then
264+
ewarn
265+
ewarn "You need to restart eudev as soon as possible to make the"
266+
ewarn "upgrade go into effect:"
267+
ewarn "\t/etc/init.d/udev --nodeps restart"
268+
fi
269+
270+
if use rule-generator && \
271+
[[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then
272+
ewarn
273+
ewarn "Please add the udev-postmount init script to your default runlevel"
274+
ewarn "to ensure the legacy rule-generator functionality works as reliably"
275+
ewarn "as possible."
276+
ewarn "\trc-update add udev-postmount default"
277+
fi
278+
279+
elog
280+
elog "For more information on eudev on Gentoo, writing udev rules, and"
281+
elog "fixing known issues visit: https://wiki.gentoo.org/wiki/Eudev"
282+
}

sys-fs/eudev/eudev-9999.ebuild

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ MULTILIB_WRAPPED_HEADERS=(
7777
/usr/include/udev.h
7878
)
7979

80+
PATCHES=(
81+
"${FILESDIR}"/${PN}-3.2.12-sticky-tags.patch
82+
)
83+
8084
pkg_pretend() {
8185
ewarn
8286
ewarn "As of 2013-01-29, ${PN} provides the new interface renaming functionality,"

0 commit comments

Comments
 (0)