cmocka/cmocka.spec

158 lines
4.2 KiB
RPMSpec

#
# spec file for package cmocka
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
BuildRequires: cmake
BuildRequires: glibc-devel
BuildRequires: pkg-config
Name: cmocka
Version: 1.0.1
Release: 0
#
Summary: Lightweight library to simplify and generalize unit tests for C
License: Apache-2.0
Group: Productivity/Networking/Other
Url: http://open.cryptomilk.org/cmocka
#
Source0: %{name}-%{version}.tar.xz
Source1: baselibs.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
cmocka is an elegant unit testing framework for C with support for mock
objects. It only requires the standard C library, works on a range of computing
platforms (including embedded) and with different compilers.
Features:
* Support for mock objects
* Only requires the C library
* Several supported output formats (Subunit, TAP, jUnit XML)
* Fully documented API
* Test fixtures
* Exception handling for signals (SIGSEGV, SIGILL, ...)
* No fork() used
* Very well tested
* Testing of memory leaks, buffer overflows and underflows.
Also, CMocka tries to avoid the use of some of the newer features of C
compilers.
%package -n libcmocka0
Summary: Lightweight library to simplify and generalize unit tests for C
Group: System/Libraries
%description -n libcmocka0
cmocka is an elegant unit testing framework for C with support for mock
objects. It only requires the standard C library, works on a range of computing
platforms (including embedded) and with different compilers.
Features:
* Support for mock objects
* Only requires the C library
* Several supported output formats (Subunit, TAP, jUnit XML)
* Fully documented API
* Test fixtures
* Exception handling for signals (SIGSEGV, SIGILL, ...)
* No fork() used
* Very well tested
* Testing of memory leaks, buffer overflows and underflows.
Also, CMocka tries to avoid the use of some of the newer features of C
compilers.
%package -n libcmocka-devel
Summary: Development headers for the cmocka library
Group: Development/Libraries/C and C++
Requires: cmake
Requires: libcmocka0 = %{version}
Requires: pkg-config
%description -n libcmocka-devel
Development headers for the cmocka unit testing library.
%package -n libcmocka-devel-static
Summary: Static cmocka library
Group: Development/Libraries/C and C++
Requires: libcmocka-devel = %{version}
%description -n libcmocka-devel-static
Static cmocka unit testing library.
%prep
%setup -q
%build
if test ! -e "obj"; then
mkdir obj
fi
pushd obj
cmake \
-DCMAKE_C_FLAGS:STRING="%{optflags}" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DWITH_STATIC_LIB=ON \
%if %{_lib} == lib64
-DLIB_SUFFIX=64 \
%endif
-DUNIT_TESTING=ON \
%{_builddir}/%{name}-%{version}
%__make %{?_smp_mflags} VERBOSE=1
popd
%install
pushd obj
%makeinstall
popd
%check
pushd obj
%__make test || cat Testing/Temporary/LastTest.log
popd
%post -n libcmocka0
/sbin/ldconfig
%postun -n libcmocka0
/sbin/ldconfig
%clean
%{__rm} -rf %{buildroot}
%files -n libcmocka0
%defattr(-,root,root)
%doc AUTHORS README ChangeLog COPYING
%{_libdir}/libcmocka.so.*
%files -n libcmocka-devel
%defattr(-,root,root)
%{_includedir}/cmocka.h
%{_includedir}/cmocka_pbc.h
%{_libdir}/libcmocka.so
%{_libdir}/pkgconfig/cmocka.pc
%dir %{_libdir}/cmake/cmocka
%{_libdir}/cmake/cmocka/cmocka-config-version.cmake
%{_libdir}/cmake/cmocka/cmocka-config.cmake
%files -n libcmocka-devel-static
%defattr(-,root,root)
%{_libdir}/libcmocka.a
%changelog