Accepting request 316828 from home:scarabeus_iv:branches:devel:libraries:c_c++

- Use properly %cmake macro to build nicely with all the linker/cflags
- Use proper Url and Source
- Properly fails on crashing tests instead of finishing build
- Enable cmockery support

OBS-URL: https://build.opensuse.org/request/show/316828
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/cmocka?expand=0&rev=27
This commit is contained in:
Andreas Schneider 2015-07-15 08:33:23 +00:00 committed by Git OBS Bridge
parent 407e233776
commit e3598846b4
2 changed files with 30 additions and 37 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Jul 14 14:07:14 UTC 2015 - tchvatal@suse.com
- Use properly %cmake macro to build nicely with all the linker/cflags
- Use proper Url and Source
- Properly fails on crashing tests instead of finishing build
- Enable cmockery support
-------------------------------------------------------------------
Thu Mar 12 14:57:24 UTC 2015 - asn@cryptomilk.org

View File

@ -16,21 +16,18 @@
#
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
Url: http://cmocka.org
Source0: https://cmocka.org/files/1.0/%{name}-%{version}.tar.xz
Source1: baselibs.conf
BuildRequires: cmake
BuildRequires: glibc-devel
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -75,7 +72,6 @@ Features:
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++
@ -98,42 +94,28 @@ Static cmocka unit testing library.
%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} \
%cmake \
-DWITH_STATIC_LIB=ON \
%if %{_lib} == lib64
-DLIB_SUFFIX=64 \
%endif
-DUNIT_TESTING=ON \
%{_builddir}/%{name}-%{version}
-DWITH_CMOCKERY_SUPPORT=ON \
-DUNIT_TESTING=ON
%__make %{?_smp_mflags} VERBOSE=1
popd
make %{?_smp_mflags}
%install
pushd obj
%makeinstall
popd
%cmake_install
%check
pushd obj
%__make test || cat Testing/Temporary/LastTest.log
pushd build
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
make %{?_smp_mflags} test || {
cat Testing/Temporary/LastTest.log;
exit 1;
}
popd
%post -n libcmocka0
/sbin/ldconfig
%post -n libcmocka0 -p /sbin/ldconfig
%postun -n libcmocka0
/sbin/ldconfig
%clean
%{__rm} -rf %{buildroot}
%postun -n libcmocka0 -p /sbin/ldconfig
%files -n libcmocka0
%defattr(-,root,root)
@ -144,6 +126,9 @@ popd
%defattr(-,root,root)
%{_includedir}/cmocka.h
%{_includedir}/cmocka_pbc.h
%dir %{_includedir}/cmockery
%{_includedir}/cmockery/cmockery.h
%{_includedir}/cmockery/pbc.h
%{_libdir}/libcmocka.so
%{_libdir}/pkgconfig/cmocka.pc
%dir %{_libdir}/cmake/cmocka