Name:           Judy
Version:        1.0.5
Release:        2%{?_dist_release}
Summary:        General purpose dynamic array
Summary(ja):    汎用の動的配列ライブラリ

Group:          System Environment/Libraries
License:        LGPLv2+
URL:            http://sourceforge.net/projects/judy/

Source0:        http://downloads.sourceforge.net/judy/Judy-%{version}.tar.gz
Source1:	README.Fedora
# Make tests use shared instead of static libJudy.
Patch0:		Judy-1.0.4-test-shared.patch
# The J1* man pages were incorrectly being symlinked to Judy, rather
# than Judy1.  This patch corrects that.  Submitted upstream 2008/11/27.
Patch1:		Judy-1.0.4-fix-Judy1-mans.patch
# Fix some code with undefined behavior, commented on and removed by gcc
Patch2:		Judy-1.0.5-undefined-behavior.patch

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

%description
Judy is a C library that provides a state-of-the-art core technology
that implements a sparse dynamic array. Judy arrays are declared
simply with a null pointer. A Judy array consumes memory only when it
is populated, yet can grow to take advantage of all available memory
if desired. Judy's key benefits are scalability, high performance, and
memory efficiency. A Judy array is extensible and can scale up to a
very large number of elements, bounded only by machine memory. Since
Judy is designed as an unbounded array, the size of a Judy array is
not pre-allocated but grows and shrinks dynamically with the array
population.


%package devel
Summary:	Development libraries and headers for Judy
Summary(ja):	Judy の開発用ライブラリとヘッダファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

%description devel
This package contains the development libraries and header files
for developing applications that use the Judy library.


%prep
%setup -q -n judy-%{version}
%patch0 -p1 -b .test-shared
%patch1 -p1 -b .fix-Judy1-mans
%patch2 -p1 -b .behavior
cp -p %{SOURCE1} .


%build
export CFLAGS="%{optflags} -fno-strict-aliasing -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-copy-prop -fno-tree-vrp"
%configure --disable-static
make 
# fails to compile properly with parallel make:
# http://sourceforge.net/tracker/index.php?func=detail&aid=2129019&group_id=55753&atid=478138


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# get rid of static libs and libtool archives
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.{a,la}
# clean out zero length and generated files from doc tree
rm -rf doc/man
rm -f doc/Makefile* doc/ext/README_deliver
[ -s doc/ext/COPYRIGHT ] || rm -f doc/ext/COPYRIGHT
[ -s doc/ext/LICENSE ] || rm -f doc/ext/LICENSE


%check
cd test
./Checkit


%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING README README.Fedora examples/
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc doc
%{_libdir}/*.so
%{_includedir}/*
%{_mandir}/man3/*


%changelog
* Wed Feb 11 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 1.0.5-2
- rebuilt on current VineSeed
- added patch2 from Fedora
  * Tue Feb 18 2014 Paul Howarth <paul@city-fan.org> - 1.0.5-8
  - Fix some code with undefined behavior

* Sat Feb 11 2012 NAKAMURA Kenta <kenta@vinelinux.org> - 1.0.5-1
- updated to 1.0.5

* Sun Jun 20 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0.4-7
- Initial build for Vine Linux

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Dec 13 2008 Charles R. Anderson <cra@wpi.edu> 1.0.4-4
- for Judy1 man page fix, patch Makefile.{am,in} instead of
  relying on autotools to regenerate the latter.
- Add README.Fedora with upstream's license explanation.

* Thu Nov 30 2008 Charles R. Anderson <cra@wpi.edu> 1.0.4-3
- fix Judy1 man page symlinks
- use valid tag License: LGPLv2+ confirmed with upstream
- use version macro in Source0
- remove Makefiles from installed doc tree

* Thu Nov 27 2008 Charles R. Anderson <cra@wpi.edu> 1.0.4-2
- patch tests to run with shared library
- run tests in check section

* Sun Oct 05 2008 Charles R. Anderson <cra@wpi.edu> 1.0.4-1
- Initial package for Fedora
