Name:           yajl
Summary:        Yet Another JSON Library (YAJL)
Version:        2.1.0
Release:        1%{?_dist_release}
Group:          System Environment/Libraries

Vendor:         Project Vine
Distribution:   Vine Linux

License:        ISC
URL:            http://lloyd.github.com/yajl/

#
# NB, upstream does not provide pre-built tar.gz downloads. Instead
# they make you use the 'on the fly' generated tar.gz from GITHub's
# web interface
#
# The Source0 for any version is obtained by a URL
#
#   https://github.com/lloyd/yajl/releases/tag/2.1.0
#
Source0: %{name}-%{version}.tar.gz
Patch1: %{name}-%{version}-pkgconfig-location.patch
Patch2: %{name}-%{version}-pkgconfig-includedir.patch
Patch3: %{name}-%{version}-test-location.patch
Patch4: %{name}-%{version}-dynlink-binaries.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: cmake

%description
Yet Another JSON Library. YAJL is a small event-driven
(SAX-style) JSON parser written in ANSI C, and a small
validating JSON generator.

%package devel
Summary: Libraries, includes, etc to develop with YAJL
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Yet Another JSON Library. YAJL is a small event-driven
(SAX-style) JSON parser written in ANSI C, and a small
validating JSON generator.

This sub-package provides the libraries and includes
necessary for developing against the YAJL library

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

%build
# NB, we are not using upstream's 'configure'/'make'
# wrapper, instead we use cmake directly to better
# align with Fedora standards
mkdir build
cd build
%cmake ..
make VERBOSE=1 %{?_smp_mflags}


%install
rm -rf %{buildroot}
cd build
make install DESTDIR=%{buildroot}


# No static libraries
rm -f %{buildroot}%{_libdir}/libyajl_s.a


%check
cd test
(cd parsing && ./run_tests.sh)
(cd api && ./run_tests.sh)

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%license COPYING
%doc ChangeLog README TODO
%{_bindir}/json_reformat
%{_bindir}/json_verify
%{_libdir}/libyajl.so.2
%{_libdir}/libyajl.so.2.*

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/yajl
%{_includedir}/yajl/yajl_common.h
%{_includedir}/yajl/yajl_gen.h
%{_includedir}/yajl/yajl_parse.h
%{_includedir}/yajl/yajl_tree.h
%{_includedir}/yajl/yajl_version.h
%{_libdir}/libyajl.so
%{_libdir}/pkgconfig/yajl.pc


%changelog
* Wed Oct 23 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 2.1.0-1
- new upstream release.

* Tue Oct 29 2013 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.0.4-1
- updated to 2.0.4 release
- Patch1 and Patch2 imported from Fedora
- fix License tag: s/BSD/ISC/

* Wed Mar 28 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.0.1-2
- rebuild

* Sun Nov 20 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.0.1-1
- updated to 2.0.1

* Thu Aug 18 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.12-2
- Initial build for Vine Linux

* Tue May  3 2011 Daniel P. Berrange <berrange@redhat.com> - 1.0.12-1
- Update to 1.0.12 release

* Fri Dec 17 2010 Daniel P. Berrange <berrange@redhat.com> - 1.0.11-1
- Update to 1.0.11 release

* Mon Jan 11 2010 Daniel P. Berrange <berrange@redhat.com> - 1.0.7-3
- Fix ignoring of cflags (rhbz #547500)

* Tue Dec  8 2009 Daniel P. Berrange <berrange@redhat.com> - 1.0.7-2
- Change use of 'define' to 'global'

* Mon Dec  7 2009 Daniel P. Berrange <berrange@redhat.com> - 1.0.7-1
- Initial Fedora package
