From 05f788e7041b8d88456e1dfbbc8f3229b8bd3936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 1 Jun 2021 08:49:40 +0200 Subject: [PATCH] Add support and directions for doing builds with --build-in-place --- README.build-in-place | 14 ++++++++++++++ systemd.spec | 21 ++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 README.build-in-place diff --git a/README.build-in-place b/README.build-in-place new file mode 100644 index 0000000..8b66077 --- /dev/null +++ b/README.build-in-place @@ -0,0 +1,14 @@ +== Building systemd rpms for local development using rpmbuild --build-in-place == + +This approach is based on https://github.com/filbranden/git-rpmbuild +and filbranden's talk during ASG2019 [https://cfp.all-systems-go.io/ASG2019/talk/JM7GDN/]. + +``` +git clone https://github.com/systemd/systemd +fedpkg clone systemd fedora-systemd +cd systemd +rpmbuild -bb --build-in-place --noprep --define "_sourcedir $PWD/../fedora-systemd" --define "_rpmdir $PWD/rpms" --with inplace ../systemd.spec +sudo dnf upgrade --setopt install_weak_deps=False rpms/*/*.rpm +``` + +`--without lto` and `--without tests` may be useful to speed up the build. diff --git a/systemd.spec b/systemd.spec index 0f6124b..f325779 100644 --- a/systemd.spec +++ b/systemd.spec @@ -23,10 +23,21 @@ %bcond_without tests %bcond_without lto +# Support for quick builds with rpmbuild --build-in-place. +# See README.build-in-place. +%bcond_with inplace + Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd +%if %{without inplace} Version: 248.3 Release: 1%{?dist} +%else +# determine the build information from local checkout +Version: %(tools/meson-vcs-tag.sh . error | sed -r 's/-([0-9])/.^\1/; s/-g/_g/') +Release: 1 +%endif + # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -481,7 +492,15 @@ CONFIGURE_OPTS=( %global _lto_cflags %nil %endif -%meson "${CONFIGURE_OPTS[@]}" +# Do configuration. If doing an inplace build, try to do +# reconfiguration to pick up new options. +%if %{with inplace} + command -v ccache 2>/dev/null && { CC="${CC:-ccache %__cc}"; CXX="${CXX:-ccache %__cxx}"; } + + [ -e %{_vpath_builddir}/build.ninja ] && + %__meson configure %{_vpath_builddir} "${CONFIGURE_OPTS[@]}" || +%endif +{ %meson "${CONFIGURE_OPTS[@]}"; } new_triggers=%{_vpath_builddir}/src/rpm/triggers.systemd.sh if ! diff -u %{SOURCE1} ${new_triggers}; then