SHA256
8
0
forked from pool/jsoncpp

Accepting request 264997 from home:pluskalm:branches:devel:libraries:c_c++

New release (1.0.0), enable cmake building

OBS-URL: https://build.opensuse.org/request/show/264997
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/jsoncpp?expand=0&rev=2
This commit is contained in:
Ismail Dönmez
2014-12-12 13:26:32 +00:00
committed by Git OBS Bridge
parent 62ac1ebd28
commit ca913d72ec
6 changed files with 164 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
#
# spec file for package
# spec file for package jsoncpp
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -15,21 +15,24 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: jsoncpp
Version: 0.6~rc2+git.1405320734.3b9b740
Release: 0
License: MIT
Summary: C++ library that allows manipulating with JSON
Url: https://github.com/open-source-parsers/jsoncpp
Group: Devel/Libraries/C and C++
Source0: jsoncpp-0.6~rc2+git.1405320734.3b9b740.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#strip unused dependencies from there
#BuildRequires: cmake
Name: jsoncpp
Version: 1.0.0
Release: 0
Summary: C++ library that allows manipulating with JSON
License: MIT
Group: Devel/Libraries/C and C++
Url: https://github.com/open-source-parsers/jsoncpp
Source0: https://github.com/open-source-parsers/%{name}/archive/%{version}.tar.gz
Patch0: jsoncpp-1.0.0-lib_suffix.patch
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: python
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRequires: python
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# On i386, jsoncpp fails it's own unittests
ExcludeArch: i586
%description
JSON is a lightweight data-interchange format. It can represent numbers,
@@ -43,7 +46,7 @@ format to store user input files.
%package devel
Summary: Development files for %{name}
Group: Development/Languages/C and C++
Requires: lib%{name}0 = %{version}
Requires: lib%{name}1 = %{version}
%description devel
JSON is a lightweight data-interchange format. It can represent numbers,
@@ -67,11 +70,11 @@ serialization and deserialization to and from strings. It can also preserve
existing comment in unserialization/serialization steps, making it a convenient
format to store user input files.
%package -n lib%{name}0
%package -n lib%{name}1
Summary: Shared library for %{name}
Group: Development/Languages/C and C++
%description -n lib%{name}0
%description -n lib%{name}1
JSON is a lightweight data-interchange format. It can represent numbers,
strings, ordered sequences of values, and collections of name/value pairs.
@@ -82,55 +85,39 @@ format to store user input files.
%prep
%setup -q
%patch0 -p1
%build
# ignore default cmake and use Gentoo's approach
# % {cmake} \
# -DJSONCPP_LIB_BUILD_SHARED=ON
python doxybuild.py --doxygen=%{_bindir}/doxygen
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;
FFLAGS="${FFLAGS:-%optflags%{?_fmoddir: -I%_fmoddir}}" ; export FFLAGS ;
# path needs to be exported otherwise unit tests will fail
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/build/lib
%cmake -DJSONCPP_LIB_BUILD_SHARED=ON
# This is the soname that other distros use.
soname="libjsoncpp.so.0"
echo ${PWD}/
c++ src/lib_json/*.cpp -Iinclude -shared -fPIC \
-Wl,-soname,${soname} -o ${soname}
ln -sf ${soname} libjsoncpp.so
%{__python} doxybuild.py --doxygen=%{_bindir}/doxygen
make %{?_smp_mflags}
%install
%cmake_install
# to have the same location as Gentoo, Debian, Ubuntu and Arch see gentoo bug #452234
mkdir -p %{buildroot}/%{_includedir}/jsoncpp
cp -ra include/json/ %{buildroot}/%{_includedir}/jsoncpp
%post -n lib%{name}1 -p /sbin/ldconfig
mkdir -p %{buildroot}/%{_libdir}/
cp -a libjsoncpp.so* %{buildroot}/%{_libdir}/
%postun -n lib%{name}1 -p /sbin/ldconfig
%post -n lib%{name}0 -p /sbin/ldconfig
%postun -n lib%{name}0 -p /sbin/ldconfig
%files -n lib%{name}0
%files -n lib%{name}1
%defattr(-,root,root)
%doc LICENSE
%{_libdir}/lib%{name}.so.0
%{_libdir}/lib%{name}.so.*
%files devel
%defattr(-,root,root)
%doc AUTHORS LICENSE NEWS.txt README.md
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}/
%{_includedir}/json/
%files doc
%defattr(-,root,root)
%doc dist/doxygen/jsoncpp*
%changelog