+#
+# Conditional build:
+%bcond_without static_libs # static library
+
Summary: Extensible Binary Meta Language access library
-Summary(pl): Biblioteka dostêpu rozszerzalnego metajêzyka binarnego
+Summary(pl.UTF-8): Biblioteka dostępu rozszerzalnego metajęzyka binarnego
Name: libmatroska
-Version: 0.4.4
+Version: 1.6.2
Release: 1
-License: GPL/QPL
+License: LGPL v2.1+
Group: Libraries
-Source0: http://matroska.free.fr/downloads/%{name}/%{name}-%{version}.tar.bz2
-# Source0-md5: 1d855dc5d7a16d562efcac53f9cbdf7b
-Patch0: %{name}-makefile.patch
-URL: http://www.matroska.org
+Source0: https://dl.matroska.org/downloads/libmatroska/%{name}-%{version}.tar.xz
+# Source0-md5: 933f56e73f452648d211592762de6389
+URL: https://www.matroska.org/
+BuildRequires: cmake >= 3.1.2
+BuildRequires: libebml-devel >= 1.4.0
+BuildRequires: libstdc++-devel >= 6:4.7
+BuildRequires: pkgconfig
+BuildRequires: rpmbuild(macros) >= 1.605
+Requires: libebml >= 1.4.0
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-Matroska is an extensible open standard Audio/Video container format,
-aiming to become the standard of Multimedia
-Container Formats one day. It is based on EBML (Extensible Binary
-Meta Language), a kind of binary version of XML. This way the
-significant advantages in terms of future format extensability
-are gained without breaking file support in old parsers.
-
-%description -l pl
-Matroska to rozszerzalny otwarty format kodowania d¼wiêku i obrazu,
-d±¿±cy do stania sie. Jest on oparty na EBML (rozszerzalny metajêzyk
-binarny), binarnym odpowiedniku XML. W ten sposób ma on przewagê nad
-innymi formatami pod wzglêdem przysz³ej rozszerzalno¶ci przy
-jednoczesnym zachowaniu kompatybilno¶ci wstecz.
+Matroska is an extensible open standard Audio/Video container format,
+aiming to become the standard of Multimedia Container Formats one day.
+It is based on EBML (Extensible Binary Meta Language), a kind of
+binary version of XML. This way the significant advantages in terms of
+future format extensibility are gained without breaking file support
+in old parsers.
+
+%description -l pl.UTF-8
+Matroska to rozszerzalny otwarty format kodowania dźwięku i obrazu,
+dążący do stania się pewnego dnia standardem formatów zawierających
+multimedia. Jest on oparty na EBML (rozszerzalnym metajęzyku
+binarnym), binarnym odpowiedniku XML-a. W ten sposób ma on przewagę
+nad innymi formatami pod względem przyszłej rozszerzalności przy
+jednoczesnym zachowaniu kompatybilności wstecz.
%package devel
-Summary: Developmment files and headers for matroska
-Summary(pl): Nag³ówki dla matroski
+Summary: Header files for matroska library
+Summary(pl.UTF-8): Nagłówki dla biblioteki matroska
Group: Development/Libraries
-Requires: %{name} >= %{version}
+Requires: %{name} = %{version}-%{release}
+Requires: libebml-devel >= 1.4.0
+Requires: libstdc++-devel >= 6:4.7
%description devel
-Developmment files and headers for matroska.
+Header files for matroska library.
-%description devel -l pl
-Nag³ówki dla matroski.
+%description devel -l pl.UTF-8
+Nagłówki dla biblioteki matroska.
%package static
-Summary: Static libraries for Extensible Binary Meta Language
-Summary(pl): Biblioteki statyczne dla rozszerzalnego metajêzyka binarnego
-Group: Libraries
+Summary: Static version of matroska library
+Summary(pl.UTF-8): Statyczna wersja biblioteki matroska
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
%description static
-Static libraries for matroska.
+Static version of matroska library.
-%description static -l pl
-Biblioteki statyczne dla matroski.
+%description static -l pl.UTF-8
+Statyczna wersja biblioteki matroska.
%prep
-%setup -q
-%patch0 -p1
+%setup -q
%build
-cd make/linux
-%{__make} clean
-%{__make} \
- prefix=%{_prefix} \
- CXX=%{__cxx} \
- LD=%{__cxx} \
- AR="%{__ar} rcvu" \
- RANLIB=%{__ranlib} \
- INSTALL=%{__install} \
- CXXFLAGS="%{rpmcflags}" \
- %{?debug:DEBUG=yes} \
- INSTALL_OPTS="" \
- INSTALL_OPTS_LIB="" \
- INSTALL_DIR_OPTS="" \
- LDFLAGS="-shared -lebml -L. -L%{_libdir}"\
- LIBEBML_INCLUDE_DIR="%{_includedir}/ebml/" \
- SRC_DIR=%{_builddir}/%{name}-%{version}/src/
+# .pc file generation expects relative CMAKE_INSTALL_{INCLUDE,LIB}DIR
+%if %{with static_libs}
+install -d build-static
+cd build-static
+%cmake .. \
+ -DBUILD_SHARED_LIBS:BOOL=OFF \
+ -DCMAKE_INSTALL_INCLUDEDIR=include \
+ -DCMAKE_INSTALL_LIBDIR=%{_lib}
+
+%{__make}
+cd ..
+%endif
+
+install -d build
+cd build
+%cmake .. \
+ -DCMAKE_INSTALL_INCLUDEDIR=include \
+ -DCMAKE_INSTALL_LIBDIR=%{_lib}
+
+%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT
-
-%{__make} -f make/linux/Makefile install \
- prefix=$RPM_BUILD_ROOT%{_prefix} \
- CXX=%{__cxx} \
- LD=%{__cxx} \
- AR="%{__ar} rcvu" \
- RANLIB=%{__ranlib} \
- INSTALL=%{__install} \
- %{?debug:DEBUG=yes} \
- INSTALL_OPTS="" \
- INSTALL_OPTS_LIB="" \
- INSTALL_DIR_OPTS="" \
- SRC_DIR=%{_builddir}/%{name}-%{version}/src/\
- LDFLAGS="-shared -lebml -L. -L%{_libdir}" \
- LIBEBML_INCLUDE_DIR="%{_includedir}/ebml/" \
- CXXFLAGS="%{rpmcflags}"
+
+%if %{with static_libs}
+%{__make} -C build-static install \
+ DESTDIR=$RPM_BUILD_ROOT
+%endif
+
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%files
+%files
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libmatroska.so
+%doc ChangeLog README.md
+%attr(755,root,root) %{_libdir}/libmatroska.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libmatroska.so.7
%files devel
%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libmatroska.so
%{_includedir}/matroska
+%{_pkgconfigdir}/libmatroska.pc
+%{_libdir}/cmake/Matroska
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libmatroska.a
+%endif