%define srcver 2.4
%define gitdate 20140606

Name:		rtmpdump
Version:	%{srcver}.git%{gitdate}
Release:	4%{?_dist_release}
Summary:	Toolkit for RTMP streams
Summary(ja):	RTMP ストリーム用のツール集

Group:		Applications/Internet
License:	GPLv2+
# Note that librtmp is actually LGPLv2, so if you package that separately
# (for which you'd probably want to make it a dynamic library) you should
# label its licence correctly. But the _tools_ are GPLv2.
URL:		http://rtmpdump.mplayerhq.hu/
Source0:	rtmpdump-%{srcver}-git%{gitdate}.tar.xz
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

BuildRequires:	gmp-devel gnutls-devel zlib-devel

%description
rtmpdump is a toolkit for RTMP streams. All forms of RTMP are supported,
including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://. 

%package -n librtmp
Summary:	Support library for RTMP streams
Summary(ja):	RTMP ストリーム用のサポートライブラリ
Group:		System Environment/Libraries
License:	LGPLv2+

%description -n librtmp
librtmp is a suport library for RTMP streams. All forms of RTMP are supported,
including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://. 

%package -n librtmp-devel
Summary:	Files for librtmp development
Summary(ja):	librtmp の開発用ファイル
Group:		Development/Libraries
License:	LGPLv2+
Requires:	librtmp = %{version}-%{release}
Requires:	gmp-devel

%description -n librtmp-devel
librtmp is a suport library for RTMP streams. The librtmp-devel package
contains include files needed to develop applications using librtmp.

%prep
%setup -q -c -n rtmpdump

%build
# The fact that we have to add -ldl for gnutls is Fedora bug #611318
%__make CRYPTO=GNUTLS SHARED=yes OPT="$RPM_OPT_FLAGS" LIB_GNUTLS="-lgnutls -lgcrypt -ldl" LIBRTMP=librtmp/librtmp.so


%install
%__rm -rf $RPM_BUILD_ROOT
%__make CRYPTO=GNUTLS SHARED=yes DESTDIR=$RPM_BUILD_ROOT prefix=/usr mandir=%{_mandir} libdir=%{_libdir} install

%__rm -f $RPM_BUILD_ROOT/%{_libdir}/librtmp.a


%clean
%__rm -rf $RPM_BUILD_ROOT

%post -n librtmp -p /sbin/ldconfig

%postun -n librtmp -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_bindir}/rtmpdump
%{_sbindir}/rtmpsrv
%{_sbindir}/rtmpgw
%{_sbindir}/rtmpsuck
%{_mandir}/man1/rtmpdump.1*
%{_mandir}/man8/rtmpgw.8*
%doc COPYING README

%files -n librtmp
%defattr(-,root,root,-)
%{_libdir}/librtmp.so.*
%doc librtmp/COPYING

%files -n librtmp-devel
%defattr(-,root,root,-)
%{_includedir}/librtmp
%{_libdir}/librtmp.so
%{_libdir}/pkgconfig/librtmp.pc
%{_mandir}/man3/librtmp.3*
%doc ChangeLog


%changelog
* Wed Dec 30 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.git20140606-4
- rebuilt with gnutls-3.4.

* Mon Oct 27 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.4.git20140606-3
- added Japanese summary
- moved librtmp to System Environment/Libraries Group
- moved librtmp-devel to Development/Libraries Group

* Tue Jun 17 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.4.git20140606-2
- add Requires: gmp-devel to librtmp-devel

* Thu Jun 5 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.git20140606-1
- updated sources to git master.

* Sat Mar 26 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.3-1
- initial build for VineSeed based on RPM Fusion development

* Sun Jul 04 2010 Dominik Mierzejewski <rpm@greysector.net> 2.3-2
- call ldconfig in post(un) scripts for the shared library
- add strict dependency on the library to -devel

* Sun Jul 04 2010 David Woodhouse <dwmw2@infradead.org> 2.3-1
- Update to 2.3; build shared library

* Mon Jun 28 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2.2e-1
- new upstream release

* Mon Jun 28 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2.2d-1
- built based on RPM Fusion

* Fri Apr 30 2010 David Woodhouse <dwmw2@infradead.org> 2.2d-1
- Update to 2.2d

* Tue Apr 20 2010 David Woodhouse <dwmw2@infradead.org> 2.2c-2
- Link with libgcrypt explicitly since we call it directly

* Mon Apr 19 2010 David Woodhouse <dwmw2@infradead.org> 2.2c-1
- Initial package