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