Add a few more convenience conditionals
Allow optionally building without `make test`, fuzz tests, `make scan`, or without the -doc subpackage. You can now e.g. quickly build locally without tests as follows: fedpkg mockbuild --without test Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
This commit is contained in:
parent
eee399ccc3
commit
f95b05caae
@ -31,6 +31,15 @@
|
||||
#bcond_without cppcheck
|
||||
%endif
|
||||
|
||||
# Use `--without test` to build without running the tests
|
||||
%bcond_without test
|
||||
# Use `--without fuzz_test` to skip the fuzz test during build
|
||||
%bcond_without fuzz_test
|
||||
# Use `--without doc` to build without the -doc subpackage
|
||||
%bcond_without doc
|
||||
# Use `--without clang_sa` to skip clang static analysis during build
|
||||
%bcond_without clang_sa
|
||||
|
||||
# This package needs at least Linux Kernel v4.10.0.
|
||||
%global min_kernel_ver 4.10.0
|
||||
|
||||
@ -127,19 +136,23 @@ Source2: sha512hmac-openssl.sh
|
||||
Source3: fipshmac-openssl.sh
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: clang
|
||||
BuildRequires: coreutils
|
||||
BuildRequires: docbook-utils-pdf
|
||||
BuildRequires: gcc
|
||||
BuildRequires: git-core
|
||||
BuildRequires: hardlink
|
||||
BuildRequires: kernel-headers >= %{min_kernel_ver}
|
||||
BuildRequires: libtool
|
||||
BuildRequires: make
|
||||
BuildRequires: openssl
|
||||
BuildRequires: perl-interpreter
|
||||
BuildRequires: systemd
|
||||
BuildRequires: xmlto
|
||||
BuildRequires: make
|
||||
%if %{with doc}
|
||||
BuildRequires: docbook-utils-pdf
|
||||
%endif
|
||||
%if %{with clang_sa}
|
||||
BuildRequires: clang
|
||||
%endif
|
||||
%if %{with cppcheck}
|
||||
BuildRequires: cppcheck
|
||||
%endif
|
||||
@ -172,6 +185,7 @@ Requires: %{name}%{?_isa} == %{version}-%{release}
|
||||
Header files for applications that use %{name}.
|
||||
|
||||
|
||||
%if %{with doc}
|
||||
%package doc
|
||||
Summary: User documentation for the %{name} package
|
||||
BuildArch: noarch
|
||||
@ -182,6 +196,7 @@ Requires: %{name} == %{version}-%{release}
|
||||
|
||||
%description doc
|
||||
User documentation for %{name}.
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with replace_coreutils}
|
||||
@ -327,7 +342,11 @@ EOF
|
||||
--enable-sum-prefix= \
|
||||
--enable-sum-dir=/%{_lib} \
|
||||
--with-pkgconfigdir=%{_libdir}/pkgconfig
|
||||
%if %{with doc}
|
||||
%make_build all doc
|
||||
%else
|
||||
%make_build all man
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
@ -344,8 +363,14 @@ EOF
|
||||
%if %{with_sysctl_tweak}
|
||||
README.%{distroname_ext} \
|
||||
%endif
|
||||
README.md CHANGES.md TODO doc/%{name}.p{df,s}
|
||||
%if %{with doc}
|
||||
doc/%{name}.p{df,s} \
|
||||
%endif
|
||||
README.md CHANGES.md TODO
|
||||
|
||||
%if %{with doc}
|
||||
%{__cp} -pr lib/doc/html %{buildroot}%{_pkgdocdir}
|
||||
%endif
|
||||
|
||||
# Install replacement tools, if enabled.
|
||||
%if !%{with replace_coreutils}
|
||||
@ -371,11 +396,13 @@ EOF
|
||||
# Remove 0-size files.
|
||||
%{_bindir}/find %{buildroot} -type f -size 0 -print -delete
|
||||
|
||||
%if %{with doc}
|
||||
# Make sure all docs have non-exec permissions, except for the dirs.
|
||||
%{_bindir}/find %{buildroot}%{_pkgdocdir} -type f -print | \
|
||||
%{_bindir}/xargs %{__chmod} -c 0644
|
||||
%{_bindir}/find %{buildroot}%{_pkgdocdir} -type d -print | \
|
||||
%{_bindir}/xargs %{__chmod} -c 0755
|
||||
%endif
|
||||
|
||||
# Possibly save some space by hardlinking.
|
||||
for d in %{_mandir} %{_pkgdocdir}; do
|
||||
@ -385,11 +412,14 @@ done
|
||||
|
||||
%check
|
||||
# Some basic sanity checks.
|
||||
%if %{with clang_sa}
|
||||
%make_build scan
|
||||
%endif
|
||||
%if %{with cppcheck}
|
||||
%make_build cppcheck
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
# On some arches `/proc/sys/net/core/optmem_max` is lower than 20480,
|
||||
# which is the lowest limit needed to run the testsuite. If that limit
|
||||
# is not met, we do not run it.
|
||||
@ -398,12 +428,15 @@ done
|
||||
%if %{lua:print(rpm.vercmp(posix.uname('%r'), '5.1'));} >= 0
|
||||
# Real testsuite.
|
||||
pushd test
|
||||
%if %{with fuzz_test}
|
||||
ENABLE_FUZZ_TEST=1 \
|
||||
%endif
|
||||
NO_32BIT_TEST=1 \
|
||||
./test-invocation.sh
|
||||
popd
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
|
||||
%ldconfig_scriptlets
|
||||
@ -432,10 +465,12 @@ popd
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
|
||||
|
||||
%if %{with doc}
|
||||
%files doc
|
||||
%doc %{_pkgdocdir}/html
|
||||
%doc %{_pkgdocdir}/%{name}.pdf
|
||||
%doc %{_pkgdocdir}/%{name}.ps
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with replace_coreutils}
|
||||
|
Loading…
Reference in New Issue
Block a user