Line 0
Link Here
|
|
|
1 |
# Copyright 2020 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=7 |
5 |
|
6 |
MINKV="3.11" |
7 |
PYTHON_COMPAT=( python3_{7..9} ) |
8 |
inherit meson python-any-r1 |
9 |
|
10 |
DESCRIPTION="Creates, deletes and cleans up volatile and temporary files and directories" |
11 |
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" |
12 |
SRC_URI="https://github.com/systemd/systemd/archive/v${PV}.tar.gz -> systemd-${PV}.tar.gz |
13 |
elibc_musl? ( https://dev.gentoo.org/~gyakovlev/distfiles/${P}-musl.tar.xz )" |
14 |
|
15 |
LICENSE="BSD-2 GPL-2 LGPL-2.1 MIT public-domain" |
16 |
SLOT="0" |
17 |
KEYWORDS="*" |
18 |
IUSE="selinux test" |
19 |
RESTRICT="!test? ( test )" |
20 |
|
21 |
DEPEND=" |
22 |
sys-apps/acl:0= |
23 |
>=sys-apps/util-linux-2.30:0= |
24 |
>=sys-kernel/linux-headers-${MINKV} |
25 |
sys-libs/libcap:0= |
26 |
selinux? ( sys-libs/libselinux:0= ) |
27 |
" |
28 |
RDEPEND="${DEPEND} |
29 |
!sys-apps/opentmpfiles |
30 |
!sys-apps/systemd |
31 |
" |
32 |
|
33 |
BDEPEND=" |
34 |
app-text/docbook-xml-dtd:4.2 |
35 |
app-text/docbook-xml-dtd:4.5 |
36 |
app-text/docbook-xsl-stylesheets |
37 |
dev-libs/libxslt:0 |
38 |
>=dev-util/meson-0.46 |
39 |
>=dev-util/intltool-0.50 |
40 |
>=sys-apps/coreutils-8.16 |
41 |
sys-devel/m4 |
42 |
virtual/pkgconfig |
43 |
test? ( ${PYTHON_DEPS} ) |
44 |
" |
45 |
|
46 |
S="${WORKDIR}/systemd-${PV}" |
47 |
|
48 |
pkg_setup() { |
49 |
use test && python-any-r1_pkg_setup |
50 |
} |
51 |
|
52 |
src_prepare() { |
53 |
# musl patchset from: |
54 |
# http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd |
55 |
use elibc_musl && eapply "${WORKDIR}/${P}-musl" |
56 |
default |
57 |
} |
58 |
|
59 |
src_configure() { |
60 |
# disable everything until configure says "enabled features: ACL, tmpfiles" |
61 |
local systemd_disable_options=( |
62 |
adm-group |
63 |
analyze |
64 |
apparmor |
65 |
audit |
66 |
backlight |
67 |
binfmt |
68 |
blkid |
69 |
bzip2 |
70 |
coredump |
71 |
dbus |
72 |
efi |
73 |
elfutils |
74 |
environment-d |
75 |
fdisk |
76 |
gcrypt |
77 |
glib |
78 |
gshadow |
79 |
gnutls |
80 |
hibernate |
81 |
hostnamed |
82 |
hwdb |
83 |
idn |
84 |
ima |
85 |
initrd |
86 |
firstboot |
87 |
kernel-install |
88 |
kmod |
89 |
ldconfig |
90 |
libcryptsetup |
91 |
libcurl |
92 |
libfido2 |
93 |
libidn |
94 |
libidn2 |
95 |
libiptc |
96 |
link-networkd-shared |
97 |
link-systemctl-shared |
98 |
link-timesyncd-shared |
99 |
link-udev-shared |
100 |
localed |
101 |
logind |
102 |
lz4 |
103 |
machined |
104 |
microhttpd |
105 |
networkd |
106 |
nss-myhostname |
107 |
nss-resolve |
108 |
nss-systemd |
109 |
openssl |
110 |
p11kit |
111 |
pam |
112 |
pcre2 |
113 |
polkit |
114 |
portabled |
115 |
pstore |
116 |
pwquality |
117 |
randomseed |
118 |
resolve |
119 |
rfkill |
120 |
seccomp |
121 |
$(usex selinux '' selinux) |
122 |
smack |
123 |
sysusers |
124 |
timedated |
125 |
timesyncd |
126 |
tpm |
127 |
qrencode |
128 |
quotacheck |
129 |
userdb |
130 |
utmp |
131 |
vconsole |
132 |
wheel-group |
133 |
xdg-autostart |
134 |
xkbcommon |
135 |
xz |
136 |
zlib |
137 |
zstd |
138 |
) |
139 |
|
140 |
# prepend -D and append =false, e.g. zstd becomes -Dzstd=false |
141 |
systemd_disable_options=( ${systemd_disable_options[@]/#/-D} ) |
142 |
systemd_disable_options=( ${systemd_disable_options[@]/%/=false} ) |
143 |
|
144 |
local emesonargs=( |
145 |
-Dacl=true |
146 |
-Dtmpfiles=true |
147 |
-Dstandalone-binaries=true # this and below option does the magic |
148 |
-Dstatic-libsystemd=true |
149 |
-Dsysvinit-path='' |
150 |
${systemd_disable_options[@]} |
151 |
) |
152 |
meson_src_configure |
153 |
} |
154 |
|
155 |
src_compile() { |
156 |
# tmpfiles and sysusers can be built as standalone, link systemd-shared in statically. |
157 |
# https://github.com/systemd/systemd/pull/16061 original implementation |
158 |
# we just need to pass -Dstandalone-binaries=true and |
159 |
# use <name>.standalone target below. |
160 |
# check meson.build for if have_standalone_binaries condition per target. |
161 |
local mytargets=( |
162 |
systemd-tmpfiles.standalone |
163 |
man/tmpfiles.d.5 |
164 |
man/systemd-tmpfiles.8 |
165 |
) |
166 |
meson_src_compile "${mytargets[@]}" |
167 |
} |
168 |
|
169 |
src_install() { |
170 |
# lean and mean installation, single binary and man-pages |
171 |
pushd "${BUILD_DIR}" > /dev/null || die |
172 |
into / |
173 |
newbin systemd-tmpfiles.standalone systemd-tmpfiles |
174 |
|
175 |
doman man/{systemd-tmpfiles.8,tmpfiles.d.5} |
176 |
|
177 |
popd > /dev/null || die |
178 |
|
179 |
# service files adapter from opentmpfiles |
180 |
newinitd "${FILESDIR}"/stmpfiles-dev.initd stmpfiles-dev |
181 |
newinitd "${FILESDIR}"/stmpfiles-setup.initd stmpfiles-setup |
182 |
|
183 |
# same content, but install as different file |
184 |
newconfd "${FILESDIR}"/stmpfiles.confd stmpfiles-dev |
185 |
newconfd "${FILESDIR}"/stmpfiles.confd stmpfiles-setup |
186 |
} |
187 |
|
188 |
src_test() { |
189 |
# 'meson test' will compile full systemd, but we can still outsmart it |
190 |
python_fix_shebang src/test/test-systemd-tmpfiles.py |
191 |
"${EPYTHON}" src/test/test-systemd-tmpfiles.py \ |
192 |
"${BUILD_DIR}"/systemd-tmpfiles.standalone || die "${FUNCNAME} failed" |
193 |
} |
194 |
|
195 |
# adapted from opentmpfiles ebuild |
196 |
add_service() { |
197 |
local initd=$1 |
198 |
local runlevel=$2 |
199 |
|
200 |
elog "Auto-adding '${initd}' service to your ${runlevel} runlevel" |
201 |
mkdir -p "${EROOT}/etc/runlevels/${runlevel}" |
202 |
ln -snf "${EROOT}/etc/init.d/${initd}" "${EROOT}/etc/runlevels/${runlevel}/${initd}" |
203 |
} |
204 |
|
205 |
pkg_postinst() { |
206 |
if [[ -z $REPLACING_VERSIONS ]]; then |
207 |
add_service stmpfiles-dev sysinit |
208 |
add_service stmpfiles-setup boot |
209 |
fi |
210 |
} |