You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 line
3.4KB

  1. %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
  2. %global use_devtoolset 0
  3. %bcond_without faac
  4. %bcond_without x264
  5. %bcond_without webrtc
  6. %else
  7. %global use_devtoolset 1
  8. %bcond_with faac
  9. %bcond_with x264
  10. %bcond_with webrtc
  11. %endif
  12. %bcond_without openssl
  13. %bcond_without mysql
  14. # 默认不编译 API
  15. %bcond_with api
  16. %bcond_with cxx_api
  17. Name: ZLMediaKit
  18. Version: 5.0.0
  19. Release: 1%{?dist}
  20. Summary: A lightweight, high performance and stable stream server and client framework based on C++11.
  21. Group: development
  22. License: MIT
  23. URL: https://github.com/xia-chu/ZLMediaKit
  24. Source0: %{name}-%{version}.tar.xz
  25. %if %{with openssl}
  26. %if 0%{?rhel} <= 7 && %{with webrtc}
  27. BuildRequires: openssl11-devel
  28. %else
  29. BuildRequires: openssl-devel
  30. %endif
  31. %endif
  32. %if %{with mysql}
  33. BuildRequires: mysql-devel
  34. %endif
  35. %if %{with faac}
  36. BuildRequires: faac-devel
  37. %endif
  38. %if %{with x264}
  39. BuildRequires: x264-devel
  40. %endif
  41. %if %{with webrtc}
  42. BuildRequires: libsrtp-devel >= 2.0
  43. %endif
  44. %if 0%{?use_devtoolset}
  45. BuildRequires: devtoolset-8-gcc-c++
  46. %endif
  47. %description
  48. 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.
  49. %package media-server
  50. Requires: %{name} = %{version}
  51. Summary: A lightweight, high performance and stable stream server
  52. %description media-server
  53. A lightweight RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181 server.
  54. %if %{with api}
  55. %package c-libs
  56. Requires: %{name} = %{version}
  57. Summary: The %{name} C libraries.
  58. %description c-libs
  59. The %{name} C libraries.
  60. %package c-devel
  61. Requires: %{name}-c-libs = %{version}
  62. Summary: The %{name} C API headers.
  63. %description c-devel
  64. The %{name} C API headers.
  65. %endif
  66. %if %{with cxx_api}
  67. %package cxx-devel
  68. Requires: %{name} = %{version}
  69. Summary: The %{name} C++ API headers and development libraries.
  70. %description cxx-devel
  71. The %{name} C++ API headers and development libraries.
  72. %endif
  73. %prep
  74. %setup -q
  75. %build
  76. mkdir -p %{_target_platform}
  77. pushd %{_target_platform}
  78. %if 0%{?use_devtoolset}
  79. . /opt/rh/devtoolset-8/enable
  80. %endif
  81. %cmake3 \
  82. -DCMAKE_BUILD_TYPE:STRING=Release \
  83. -DENABLE_HLS:BOOL=ON \
  84. -DENABLE_OPENSSL:BOOL=%{with openssl} \
  85. -DENABLE_MYSQL:BOOL=%{with mysql} \
  86. -DENABLE_FAAC:BOOL=%{with faac} \
  87. -DENABLE_X264:BOOL=%{with x264} \
  88. -DENABLE_WEBRTC:BOOL=%{with webrtc} \
  89. %if %{with webrtc} && 0%{?rhel} <= 7
  90. -DOPENSSL_ROOT_DIR:STRING="/usr/lib64/openssl11;/usr/include/openssl11" \
  91. %endif
  92. -DENABLE_MP4:BOOL=ON \
  93. -DENABLE_RTPPROXY:BOOL=ON \
  94. -DENABLE_API:BOOL=%{with api} \
  95. -DENABLE_CXX_API:BOOL=%{with cxx_api} \
  96. -DENABLE_TESTS:BOOL=OFF \
  97. -DENABLE_SERVERL:BOOL=ON \
  98. ..
  99. make %{?_smp_mflags}
  100. popd
  101. %install
  102. rm -rf $RPM_BUILD_ROOT
  103. pushd %{_target_platform}
  104. %make_install
  105. popd
  106. install -m 0755 -d %{buildroot}%{_docdir}/%{name}
  107. install -m 0644 LICENSE %{buildroot}%{_docdir}/%{name}
  108. install -m 0644 README.md %{buildroot}%{_docdir}/%{name}
  109. install -m 0644 README_en.md %{buildroot}%{_docdir}/%{name}
  110. # TODO: service files
  111. %clean
  112. rm -rf $RPM_BUILD_ROOT
  113. %files
  114. %doc %{_docdir}/*
  115. %files media-server
  116. %{_bindir}/*
  117. %if %{with api}
  118. %files c-libs
  119. %{_libdir}/libmk_api.so
  120. %files c-devel
  121. %{_includedir}/mk_*
  122. %endif
  123. %if %{with cxx_api}
  124. %files cxx-devel
  125. %{_includedir}/ZLMediaKit/*
  126. %{_includedir}/ZLToolKit/*
  127. %{_libdir}/libzlmediakit.a
  128. %{_libdir}/libzltoolkit.a
  129. %{_libdir}/libmpeg.a
  130. %{_libdir}/libmov.a
  131. %{_libdir}/libflv.a
  132. %endif
  133. %changelog