ZLMediaKit/package/rpm/ZLMediaKit.spec

169 lines
3.4 KiB
RPMSpec
Raw Permalink Normal View History

2020-12-17 19:45:43 +08:00
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
%global use_devtoolset 0
2020-12-17 20:14:49 +08:00
%bcond_without faac
%bcond_without x264
2021-06-23 09:44:37 +08:00
%bcond_without webrtc
2020-12-17 19:45:43 +08:00
%else
%global use_devtoolset 1
2020-12-17 20:14:49 +08:00
%bcond_with faac
%bcond_with x264
2021-06-23 09:44:37 +08:00
%bcond_with webrtc
2020-12-17 19:45:43 +08:00
%endif
2020-12-17 20:14:49 +08:00
%bcond_without openssl
%bcond_without mysql
2022-08-22 13:18:05 +08:00
# 默认不编译 API
%bcond_with api
%bcond_with cxx_api
2020-12-17 19:45:43 +08:00
Name: ZLMediaKit
Version: 5.0.0
Release: 1%{?dist}
Summary: A lightweight, high performance and stable stream server and client framework based on C++11.
Group: development
License: MIT
URL: https://github.com/xia-chu/ZLMediaKit
Source0: %{name}-%{version}.tar.xz
2020-12-17 20:14:49 +08:00
%if %{with openssl}
2021-06-23 10:00:46 +08:00
%if 0%{?rhel} <= 7 && %{with webrtc}
BuildRequires: openssl11-devel
%else
2020-12-17 19:45:43 +08:00
BuildRequires: openssl-devel
2020-12-17 20:14:49 +08:00
%endif
2021-06-23 10:00:46 +08:00
%endif
2020-12-17 20:14:49 +08:00
%if %{with mysql}
2020-12-17 19:45:43 +08:00
BuildRequires: mysql-devel
2020-12-17 20:14:49 +08:00
%endif
%if %{with faac}
2020-12-17 19:45:43 +08:00
BuildRequires: faac-devel
2020-12-17 20:14:49 +08:00
%endif
%if %{with x264}
2020-12-17 19:45:43 +08:00
BuildRequires: x264-devel
2020-12-17 20:14:49 +08:00
%endif
2020-12-17 19:45:43 +08:00
2021-06-23 09:44:37 +08:00
%if %{with webrtc}
BuildRequires: libsrtp-devel >= 2.0
%endif
2020-12-17 19:45:43 +08:00
%if 0%{?use_devtoolset}
BuildRequires: devtoolset-8-gcc-c++
%endif
%description
A lightweight RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181 server and client framework based on C++11.
%package media-server
2020-12-18 09:12:52 +08:00
Requires: %{name} = %{version}
2020-12-17 19:45:43 +08:00
Summary: A lightweight, high performance and stable stream server
%description media-server
A lightweight RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181 server.
2022-08-22 13:18:05 +08:00
%if %{with api}
2020-12-17 19:45:43 +08:00
%package c-libs
2020-12-18 09:12:52 +08:00
Requires: %{name} = %{version}
2020-12-17 19:45:43 +08:00
Summary: The %{name} C libraries.
%description c-libs
The %{name} C libraries.
%package c-devel
2020-12-18 09:12:52 +08:00
Requires: %{name}-c-libs = %{version}
2020-12-17 19:45:43 +08:00
Summary: The %{name} C API headers.
%description c-devel
The %{name} C API headers.
2022-08-22 13:18:05 +08:00
%endif
2020-12-17 19:45:43 +08:00
2022-08-22 13:18:05 +08:00
%if %{with cxx_api}
2020-12-17 19:45:43 +08:00
%package cxx-devel
2020-12-18 09:12:52 +08:00
Requires: %{name} = %{version}
2020-12-17 19:45:43 +08:00
Summary: The %{name} C++ API headers and development libraries.
%description cxx-devel
The %{name} C++ API headers and development libraries.
2022-08-22 13:18:05 +08:00
%endif
2020-12-17 19:45:43 +08:00
%prep
%setup -q
%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%if 0%{?use_devtoolset}
. /opt/rh/devtoolset-8/enable
%endif
2020-12-17 21:40:58 +08:00
%cmake3 \
2020-12-17 20:14:49 +08:00
-DCMAKE_BUILD_TYPE:STRING=Release \
2020-12-17 19:45:43 +08:00
-DENABLE_HLS:BOOL=ON \
2020-12-17 20:14:49 +08:00
-DENABLE_OPENSSL:BOOL=%{with openssl} \
-DENABLE_MYSQL:BOOL=%{with mysql} \
-DENABLE_FAAC:BOOL=%{with faac} \
-DENABLE_X264:BOOL=%{with x264} \
2021-06-23 09:44:37 +08:00
-DENABLE_WEBRTC:BOOL=%{with webrtc} \
2021-06-23 10:11:30 +08:00
%if %{with webrtc} && 0%{?rhel} <= 7
-DOPENSSL_ROOT_DIR:STRING="/usr/lib64/openssl11;/usr/include/openssl11" \
%endif
2020-12-17 19:45:43 +08:00
-DENABLE_MP4:BOOL=ON \
-DENABLE_RTPPROXY:BOOL=ON \
2022-08-22 13:18:05 +08:00
-DENABLE_API:BOOL=%{with api} \
-DENABLE_CXX_API:BOOL=%{with cxx_api} \
2020-12-17 19:45:43 +08:00
-DENABLE_TESTS:BOOL=OFF \
-DENABLE_SERVERL:BOOL=ON \
..
make %{?_smp_mflags}
popd
%install
rm -rf $RPM_BUILD_ROOT
pushd %{_target_platform}
%make_install
popd
install -m 0755 -d %{buildroot}%{_docdir}/%{name}
install -m 0644 LICENSE %{buildroot}%{_docdir}/%{name}
install -m 0644 README.md %{buildroot}%{_docdir}/%{name}
install -m 0644 README_en.md %{buildroot}%{_docdir}/%{name}
# TODO: service files
%clean
rm -rf $RPM_BUILD_ROOT
%files
%doc %{_docdir}/*
%files media-server
%{_bindir}/*
2022-08-22 13:18:05 +08:00
%if %{with api}
2020-12-17 19:45:43 +08:00
%files c-libs
%{_libdir}/libmk_api.so
%files c-devel
%{_includedir}/mk_*
2022-08-22 13:18:05 +08:00
%endif
2020-12-17 19:45:43 +08:00
2022-08-22 13:18:05 +08:00
%if %{with cxx_api}
2020-12-17 19:45:43 +08:00
%files cxx-devel
%{_includedir}/ZLMediaKit/*
%{_includedir}/ZLToolKit/*
%{_libdir}/libzlmediakit.a
%{_libdir}/libzltoolkit.a
%{_libdir}/libmpeg.a
%{_libdir}/libmov.a
%{_libdir}/libflv.a
2022-08-22 13:18:05 +08:00
%endif
2020-12-17 19:45:43 +08:00
%changelog