From a06b4321be5b7ec64a6869da5fc888fb894252f7 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Mon, 22 Aug 2022 13:11:17 +0800 Subject: [PATCH 1/2] cmake: fix install cxx api headers Close #1882 --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e1c60309..e8ed4547 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,7 +57,7 @@ update_cached_list(MK_LINK_LIBRARIES ZLMediaKit::MediaKit) # 未在使用 if(ENABLE_CXX_API) # 保留目录结构 - install(DIRECTORY ${MediaKit_Root}/ + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit REGEX ".*[.](md|cpp)$" EXCLUDE) install(TARGETS zlmediakit From 074d13be0cf768989d98e65b9f3cd892bbf8e7be Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Mon, 22 Aug 2022 13:18:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?rpm:=20=E9=BB=98=E8=AE=A4=E4=B8=8D=E6=89=93?= =?UTF-8?q?=E5=8C=85=20api/cxx-api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/rpm/ZLMediaKit.spec | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/package/rpm/ZLMediaKit.spec b/package/rpm/ZLMediaKit.spec index 61c5f86b..f62742f6 100644 --- a/package/rpm/ZLMediaKit.spec +++ b/package/rpm/ZLMediaKit.spec @@ -13,6 +13,10 @@ %bcond_without openssl %bcond_without mysql +# 默认不编译 API +%bcond_with api +%bcond_with cxx_api + Name: ZLMediaKit Version: 5.0.0 Release: 1%{?dist} @@ -61,6 +65,7 @@ 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. +%if %{with api} %package c-libs Requires: %{name} = %{version} Summary: The %{name} C libraries. @@ -72,12 +77,15 @@ Requires: %{name}-c-libs = %{version} Summary: The %{name} C API headers. %description c-devel The %{name} C API headers. +%endif +%if %{with cxx_api} %package cxx-devel Requires: %{name} = %{version} Summary: The %{name} C++ API headers and development libraries. %description cxx-devel The %{name} C++ API headers and development libraries. +%endif %prep %setup -q @@ -104,8 +112,8 @@ pushd %{_target_platform} %endif -DENABLE_MP4:BOOL=ON \ -DENABLE_RTPPROXY:BOOL=ON \ - -DENABLE_API:BOOL=ON \ - -DENABLE_CXX_API:BOOL=ON \ + -DENABLE_API:BOOL=%{with api} \ + -DENABLE_CXX_API:BOOL=%{with cxx_api} \ -DENABLE_TESTS:BOOL=OFF \ -DENABLE_SERVERL:BOOL=ON \ .. @@ -137,12 +145,15 @@ rm -rf $RPM_BUILD_ROOT %files media-server %{_bindir}/* +%if %{with api} %files c-libs %{_libdir}/libmk_api.so %files c-devel %{_includedir}/mk_* +%endif +%if %{with cxx_api} %files cxx-devel %{_includedir}/ZLMediaKit/* %{_includedir}/ZLToolKit/* @@ -151,6 +162,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libmpeg.a %{_libdir}/libmov.a %{_libdir}/libflv.a +%endif %changelog