]> git.ipfire.org Git - thirdparty/systemd.git/blame - mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot
Merge pull request #31648 from neighbourhoodie/review-content
[thirdparty/systemd.git] / mkosi.images / system / mkosi.conf.d / 10-centos-fedora / mkosi.build.chroot
CommitLineData
4d0f1451
DDM
1#!/bin/bash
2# SPDX-License-Identifier: LGPL-2.1-or-later
d008a9cf 3set -e
4d0f1451 4
d6f206b9
DDM
5# shellcheck source=/dev/null
6. /usr/lib/os-release
7
8if [ ! -f "pkg/$ID/systemd.spec" ]; then
9 echo "spec not found at pkg/$ID/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2
4d0f1451
DDM
10 exit 1
11fi
12
13if [ -d .git/ ] && [ -z "$(git status --porcelain)" ]; then
14 TS="$(git show --no-patch --format=%ct HEAD)"
15else
16 TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
17fi
18
4980ae0f
DDM
19# Fix the %install override so debuginfo packages are generated even when --build-in-place is used.
20# See https://github.com/rpm-software-management/rpm/issues/3042.
21tee --append /usr/lib/rpm/redhat/macros <<'EOF'
22%install %{?_enable_debug_packages:%{debug_package}}\
23%%install\
24%{nil}
25EOF
26
27IFS=
4d0f1451
DDM
28# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
29# https://github.com/mesonbuild/meson/pull/12835 is available.
30# shellcheck disable=SC2046
31rpmbuild \
32 -bb \
33 --build-in-place \
34 --with upstream \
0a6bf709
DDM
35 $( ((WITH_TESTS)) || echo "--nocheck") \
36 $( ((WITH_DOCS)) || echo "--without docs") \
4d0f1451 37 --define "_topdir /var/tmp" \
d6f206b9 38 --define "_sourcedir pkg/$ID" \
5524d283 39 --define "_rpmdir $OUTPUTDIR" \
4d0f1451
DDM
40 ${BUILDDIR:+--define} \
41 ${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \
42 --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
43 --define "_binary_payload w.ufdio" \
4980ae0f
DDM
44 $( ((WITH_DEBUG)) || echo --define) \
45 $( ((WITH_DEBUG)) || echo "debug_package %{nil}") \
4d0f1451
DDM
46 --define "version_override $(cat meson.version)" \
47 --define "release_override $(date "+%Y%m%d%H%M%S" --date "@$TS")" \
48 --define "_distro_extra_cflags -Og" \
49 --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \
50 --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \
51 --define "meson_extra_configure_options -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \
4980ae0f
DDM
52 $( ((WITH_DEBUG)) || echo --define) \
53 $( ((WITH_DEBUG)) || echo "__brp_strip %{nil}") \
4d0f1451
DDM
54 --define "__brp_compress %{nil}" \
55 --define "__brp_mangle_shebangs %{nil}" \
56 --define "__brp_strip_comment_note %{nil}" \
57 --define "__brp_strip_static_archive %{nil}" \
58 --define "__brp_check_rpaths %{nil}" \
59 --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \
60 --define "__script_requires %{nil}" \
61 --undefine _lto_cflags \
f1884281 62 --noclean \
d6f206b9 63 "pkg/$ID/systemd.spec"
5524d283
DDM
64
65cp "$OUTPUTDIR"/*.rpm "$PACKAGEDIR"