| # Copyright 2011-2021 Gentoo Authors |
| # Distributed under the terms of the GNU General Public License v2 |
| |
| EAPI=7 |
| PYTHON_COMPAT=( python3_{6..7} ) |
| |
| # Avoid QA warnings |
| TMPFILES_OPTIONAL=1 |
| |
| if [[ ${PV} == 9999 ]]; then |
| EGIT_REPO_URI="https://github.com/systemd/systemd.git" |
| inherit git-r3 |
| else |
| if [[ ${PV} == *.* ]]; then |
| MY_PN=systemd-stable |
| else |
| MY_PN=systemd |
| fi |
| MY_PV=${PV/_/-} |
| MY_P=${MY_PN}-${MY_PV} |
| S=${WORKDIR}/${MY_P} |
| SRC_URI="https://github.com/systemd/${MY_PN}/archive/v${MY_PV}/${MY_P}.tar.gz" |
| KEYWORDS="*" |
| fi |
| |
| inherit bash-completion-r1 linux-info meson-multilib python-any-r1 systemd toolchain-funcs udev usr-ldscript user |
| |
| DESCRIPTION="System and service manager for Linux" |
| HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd" |
| |
| LICENSE="GPL-2 LGPL-2.1 MIT public-domain" |
| SLOT="0/2" |
| # lakitu: Added "doc" USE flag to conditionalize the installation of docs. |
| # lakitu: Disable zstd feature as journal files created with this feature are |
| # not supported by older version and it breaks stackdriver logging. |
| IUSE="fido2 +gcrypt pkcs11 tpm test" |
| |
| RESTRICT="!test? ( test )" |
| |
| MINKV="3.11" |
| |
| OPENSSL_DEP=">=dev-libs/openssl-1.1.0:0=" |
| |
| COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}] |
| sys-libs/libcap:0=[${MULTILIB_USEDEP}] |
| virtual/libcrypt:=[${MULTILIB_USEDEP}] |
| fido2? ( dev-libs/libfido2:0= ) |
| gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] ) |
| pkcs11? ( app-crypt/p11-kit:0= ) |
| tpm? ( app-crypt/tpm2-tss:0= ) |
| >=sys-apps/systemd-${PV} |
| sys-fs/cryptsetup |
| " |
| |
| # Newer linux-headers needed by ia64, bug #480218 |
| # lakitu: Added conditional doc dependency |
| DEPEND="${COMMON_DEPEND} |
| >=sys-kernel/linux-headers-${MINKV} |
| " |
| |
| # baselayout-2.2 has /run |
| RDEPEND="${COMMON_DEPEND} |
| >=sys-apps/baselayout-2.2 |
| !sys-auth/nss-myhostname |
| !sys-fs/eudev |
| !sys-fs/udev |
| " |
| |
| # sys-apps/dbus: the daemon only (+ build-time lib dep for tests) |
| # lakitu: The following PDEPENDs are present in Gentoo upstream but don't make sense for |
| # lakitu. |
| # >=sys-fs/udev-init-scripts-34 |
| BDEPEND=" |
| dev-util/gperf |
| >=dev-util/meson-0.46 |
| >=sys-apps/coreutils-8.16 |
| sys-devel/gettext |
| virtual/pkgconfig |
| test? ( |
| app-text/tree |
| dev-lang/perl |
| sys-apps/dbus |
| ) |
| app-text/docbook-xml-dtd:4.2 |
| app-text/docbook-xml-dtd:4.5 |
| app-text/docbook-xsl-stylesheets |
| dev-libs/libxslt:0 |
| $(python_gen_any_dep 'dev-python/jinja[${PYTHON_USEDEP}]') |
| $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]') |
| " |
| |
| python_check_deps() { |
| has_version -b "dev-python/jinja[${PYTHON_USEDEP}]" && |
| has_version -b "dev-python/lxml[${PYTHON_USEDEP}]" |
| } |
| |
| pkg_pretend() { |
| if [[ ${MERGE_TYPE} != buildonly ]]; then |
| if use test && has pid-sandbox ${FEATURES}; then |
| ewarn "Tests are known to fail with PID sandboxing enabled." |
| ewarn "See https://bugs.gentoo.org/674458." |
| fi |
| |
| local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS |
| ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE |
| ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS |
| ~TIMERFD ~TMPFS_XATTR ~UNIX ~USER_NS |
| ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH |
| ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED |
| ~!SYSFS_DEPRECATED_V2" |
| |
| kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG" |
| kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES" |
| kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF" |
| |
| if kernel_is -lt 5 10 20; then |
| CONFIG_CHECK+=" ~CHECKPOINT_RESTORE" |
| else |
| CONFIG_CHECK+=" ~KCMP" |
| fi |
| |
| if linux_config_exists; then |
| local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH) |
| if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then |
| ewarn "It's recommended to set an empty value to the following kernel config option:" |
| ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}" |
| fi |
| if linux_chkconfig_present X86; then |
| CONFIG_CHECK+=" ~DMIID" |
| fi |
| fi |
| |
| if kernel_is -lt ${MINKV//./ }; then |
| ewarn "Kernel version at least ${MINKV} required" |
| fi |
| |
| check_extra_config |
| fi |
| } |
| |
| pkg_setup() { |
| : |
| } |
| |
| src_unpack() { |
| default |
| [[ ${PV} != 9999 ]] || git-r3_src_unpack |
| } |
| |
| src_prepare() { |
| # Do NOT add patches here |
| local PATCHES=() |
| |
| [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches ) |
| |
| # Add local patches here |
| PATCHES+=( |
| # Gentoo patches |
| "${FILESDIR}/gentoo-uucp-group-r1.patch" |
| #"${FILESDIR}/gentoo-systemd-user-pam.patch" |
| "${FILESDIR}/228-noclean-tmp.patch" |
| # lakitu: lakitu specific patches |
| # CL:*250967 |
| "${FILESDIR}"/232-tmpfiles-no-srv.patch |
| # CL:*256679 |
| "${FILESDIR}"/225-Force-re-creation-of-etc-localtime-symlink.patch |
| # This prevents the kernel from logging all audit messages to |
| # both dmesg and audit log. b/29581598. |
| "${FILESDIR}"/225-audit-set-pid.patch |
| # Allow networkd => hostnamed communication w/o polkit. |
| "${FILESDIR}"/225-allow-networkd-to-hostnamed.patch |
| # Work around the 64 bit restriction of hostname length from |
| # kernel. b/27702816. |
| "${FILESDIR}"/232-single-label-hostname.patch |
| # Make networkd default to not touch IP forwarding setting. |
| # b/33257712 |
| "${FILESDIR}"/225-networkd-default-ip-forwarding-to-kernel.patch |
| # Avoid render and kvm group |
| "${FILESDIR}"/239-avoid-render-and-kvm-group.patch |
| # init and reboot has to be in /sbin for kdump to work. |
| "${FILESDIR}"/239-change-paths-for-udev-rules-init-reboot.patch |
| # Boot into multi-user.target instead of graphical.target. |
| "${FILESDIR}"/239-default-target.patch |
| "${FILESDIR}"/239-Use-chronyd-as-the-default-NTP-service.patch |
| "${FILESDIR}"/248-remove-kvm-group.patch |
| # Remove this patch once stackdriver logging agent is |
| # upgraded with latest systemd version. |
| "${FILESDIR}"/248-systemd-journald-support-old-format.patch |
| "${FILESDIR}"/248-networkd-wait-online-any-option.patch |
| "${FILESDIR}"/249-machine-id-setup-generate-machine-id-from-DMI-produc.patch |
| "${FILESDIR}"/cryptsetup-static.patch |
| "${FILESDIR}"/249-seccomp-util-include-missing_syscall_def.h-to-make-_.patch |
| ) |
| |
| #if ! use vanilla; then |
| # PATCHES+=( |
| # "${FILESDIR}/gentoo-generator-path-r2.patch" |
| # "${FILESDIR}/gentoo-systemctl-disable-sysv-sync-r1.patch" |
| # "${FILESDIR}/gentoo-journald-audit.patch" |
| # ) |
| #fi |
| |
| default |
| } |
| |
| src_configure() { |
| # Prevent conflicts with i686 cross toolchain, bug 559726 |
| tc-export AR CC NM OBJCOPY RANLIB |
| multilib-minimal_src_configure |
| } |
| |
| multilib_src_configure() { |
| local myconf=( |
| --localstatedir="${EPREFIX}/var" |
| -Dsupport-url="https://gentoo.org/support/" |
| # avoid bash-completion dep |
| -Dbashcompletiondir="$(get_bashcompdir)" |
| # lakitu: Do not want the "split-usr" USE flag |
| # as it uses rootprefix as "/" and lakitu currently |
| # uses "/usr" |
| # make sure we get /bin:/sbin in PATH |
| -Dsplit-usr=true |
| -Dsplit-bin=true |
| -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")" |
| -Drootlibdir="${EPREFIX}/usr/$(get_libdir)" |
| # Avoid infinite exec recursion, bug 642724 |
| -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit" |
| # no deps |
| -Dima=true |
| -Ddefault-hierarchy=hybrid |
| # Optional components/dependencies |
| -Dacl=false |
| -Dapparmor=false |
| -Daudit=false |
| -Dlibcurl=false |
| -Ddns-over-tls=false |
| -Delfutils=false |
| $(meson_native_use_bool fido2 libfido2) |
| $(meson_use gcrypt) |
| -Dlibcryptsetup=true |
| -Dgnu-efi=false |
| -Dhomed=false |
| -Dmicrohttpd=false |
| -Didn=false |
| -Dimportd=false |
| -Dbzip2=false |
| -Dzlib=false |
| -Dkmod=false |
| -Dlz4=false |
| -Dxz=false |
| -Dzstd=false |
| -Dlibiptc=false |
| -Dpam=false |
| $(meson_native_use_bool pkcs11 p11kit) |
| -Dpcre2=false |
| $(meson_native_use_bool tpm tpm2) |
| # lakitu: specifying dbus policy dir path |
| -Ddbuspolicydir="${EPREFIX}/etc/dbus-1/system.d" |
| # Breaks screen, tmux, etc. |
| -Ddefault-kill-user-processes=false |
| -Dcreate-log-dirs=false |
| -Dstandalone-binaries=true |
| -Dstatic-libsystemd=true |
| -Dstatic-libudev=true |
| ) |
| |
| # lakitu: disable all features not used and not disabled by USE flags. |
| # multilib options |
| myconf+=( |
| -Dbacklight=false |
| -Defi=false |
| -Denvironment-d=false |
| -Dfirstboot=false |
| -Dhibernate=false |
| -Dhwdb=false |
| -Dlocaled=false |
| -Dmachined=false |
| -Dman=false |
| -Dquotacheck=false |
| -Drandomseed=false |
| -Drfkill=false |
| -Dsysusers=false |
| -Dtimesyncd=false |
| -Dvconsole=false |
| -Dbump-proc-sys-fs-file-max=false |
| -Dbump-proc-sys-fs-nr-open=false |
| -Ddefault-mdns=no |
| -Ddefault-llmnr=no |
| ) |
| |
| meson_src_configure "${myconf[@]}" |
| } |
| |
| multilib_src_test() { |
| unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR |
| meson_src_test |
| } |
| |
| multilib_src_install() { |
| find | grep cryptsetup |
| env | grep abi |
| exeinto /usr/lib/systemd/ |
| doexe "systemd-cryptsetup" |
| |
| exeinto /usr/lib/systemd/system-generators |
| doexe "systemd-cryptsetup-generator" |
| |
| dobin "systemd-cryptenroll" |
| } |
| |
| pkg_prerm() { |
| # If removing systemd completely, remove the catalog database. |
| if [[ ! ${REPLACED_BY_VERSION} ]]; then |
| rm -f -v "${EROOT}"/var/lib/systemd/catalog/database |
| fi |
| } |