Add support and directions for doing builds with --build-in-place

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-06-01 08:49:40 +02:00
parent 975bf63eb5
commit 05f788e704
2 changed files with 34 additions and 1 deletions

14
README.build-in-place Normal file
View File

@ -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.

View File

@ -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