%global oname   serf

Name:           libserf
Version:        1.3.9
Release:        4%{?_dist_release}
Summary:        High-Performance Asynchronous HTTP Client Library
Summary(ja):    高性能な非同期 HTTP クライアントのライブラリ
Group:          system
Vendor:         Project Vine
Distribution:   Vine Linux

License:        ASL 2.0
URL:            http://code.google.com/p/serf
Source0:        https://serf.googlecode.com/files/serf-%{version}.tar.bz2
Source1:        libserf-certs.tar.xz
Patch0:         %{name}-norpath.patch
Patch1:         %{name}-python3.patch
Patch2:         %{name}-1.3.9-bio-ctrl.patch
Patch3:         %{name}-1.3.9-errgetfunc.patch

# fallback to IPv4
# https://issues.apache.org/jira/browse/SERF-190
Patch1000:      serf_v6fallback.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  apr-devel
BuildRequires:  apr-util-devel
BuildRequires:  krb5-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  scons
BuildRequires:  zlib-devel

%description
The serf library is a C-based HTTP client library built upon the Apache 
Portable Runtime (APR) library. It multiplexes connections, running the
read/write communication asynchronously. Memory copies and transformations are
kept to a minimum to provide high performance operation.


%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{name} の開発用ファイル群
Group:          programming
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       apr-devel%{?_isa}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%debug_package


%prep
%autosetup -n serf-%{version} -p1

# Shared library versioning support in scons is worse than awful...
# minimally, here fix the soname to match serf-1.2.x.  Minor version
# handling should be fixed too; really requires better upstream support:
# http://scons.tigris.org/issues/show_bug.cgi?id=2869
sed -i '/SHLIBVERSION/s/MAJOR/0/' SConstruct

pushd test/server/
tar xvf %{SOURCE1}
popd


%build
scons \
      CFLAGS="%{build_cflags}" \
      LINKFLAGS="%{build_ldflags}" \
      PREFIX=%{_prefix} \
      LIBDIR=%{_libdir} \
      GSSAPI=%{_prefix} \
      %{?_smp_mflags}


%install
scons install --install-sandbox=%{buildroot}
find %{buildroot} -name '*.*a' -exec rm -vf {} ';'


%check
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
# disable tests temporarily because testcases are openssl-1.0 style
# and certificates for tests are expired.
scons check || true


%files
%license LICENSE NOTICE
%doc CHANGES README design-guide.txt
%{_libdir}/*.so.*

%files devel
%{_includedir}/%{oname}-1/
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{oname}*.pc


%changelog
* Tue Oct 05 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.3.9-4
- rebuilt with openssl-3.0.0.
- updated Patch2 and 3.

* Fri Mar 19 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.3.9-3
- dropped scriptlets.

* Mon Dec 16 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.3.9-2
- added Patch1000 to fallback to IPv4.

* Sun Nov 18 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 1.3.9-1
- updated to 1.3.9.
- imported Patch0-1 from rawhide.
- imported Patch2 from upstream.
- added Patch3 to build with openssl-1.1.1.
- added Source1 to replace expired certificates.

* Sun May 15 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.3.8-2
- rebuild with openssl-1.0.2

* Sat Dec 13 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 1.3.8-1
- updated to 1.3.8

* Sun Mar 16 2014 NAKAMURA Kenta <kenta@vinelinux.org> - 1.3.4-2
- initial build for Vine Linux

* Mon Feb 17 2014 Joe Orton <jorton@redhat.com> - 1.3.4-1
- update to 1.3.4

* Tue Dec 10 2013 Joe Orton <jorton@redhat.com> - 1.3.3-1
- update to 1.3.3

* Wed Nov  6 2013 Joe Orton <jorton@redhat.com> - 1.3.2-1
- update to 1.3.2
- require krb5-devel for libgssapi (#1027011)

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Jun 17 2013 Christopher Meng <rpm@cicku.me> - 1.2.1-3
- SPEC cleanup.

* Thu Jun 13 2013 Christopher Meng <rpm@cicku.me> - 1.2.1-2
- Fix the permission of the library.

* Sun Jun 09 2013 Christopher Meng <rpm@cicku.me> - 1.2.1-1
- Initial Package.
