From 9a05c2be4d580732b8c880bebe7091d346b8b903 Mon Sep 17 00:00:00 2001 From: wxf Date: Thu, 17 Dec 2020 19:43:17 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=B0=83=E6=95=B4=20linux=20=E4=B8=8B?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 ++- server/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5332e02d..aec266ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,8 +180,9 @@ if (WIN32) set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib) set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include) else () - set(INSTALL_PATH_LIB lib) + set(INSTALL_PATH_LIB lib${LIB_SUFFIX}) set(INSTALL_PATH_INCLUDE include) + set(INSTALL_PATH_EXECUTABLE bin) endif () if(ENABLE_CXX_API) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 092a4221..9b9692b3 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -10,8 +10,8 @@ add_executable(MediaServer ${MediaServer_src_list}) if(WIN32) set_target_properties(MediaServer PROPERTIES COMPILE_FLAGS ${VS_FALGS} ) +else() + install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_EXECUTABLE}) endif() target_link_libraries(MediaServer jsoncpp ${LINK_LIB_LIST}) - - From acc5ecb937159cf87a5fd164a0d7bb1f887db0f6 Mon Sep 17 00:00:00 2001 From: wxf Date: Thu, 17 Dec 2020 19:45:43 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20rpm=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/rpm/ZLMediaKit.spec | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 package/rpm/ZLMediaKit.spec diff --git a/package/rpm/ZLMediaKit.spec b/package/rpm/ZLMediaKit.spec new file mode 100644 index 00000000..e3af386d --- /dev/null +++ b/package/rpm/ZLMediaKit.spec @@ -0,0 +1,123 @@ +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%global use_devtoolset 0 +%else +%global use_devtoolset 1 +%endif + +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 + +BuildRequires: openssl-devel +BuildRequires: mysql-devel +BuildRequires: faac-devel +BuildRequires: x264-devel + +%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 +Requires: %{name}-%{version} +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. + +%package c-libs +Requires: %{name}-%{version} +Summary: The %{name} C libraries. +%description c-libs +The %{name} C libraries. + +%package c-devel +Requires: %{name}-c-libs-%{version} +Summary: The %{name} C API headers. +%description c-devel +The %{name} C API headers. + +%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. + +%prep +%setup -q + +%build +mkdir -p %{_target_platform} + +pushd %{_target_platform} + +%if 0%{?use_devtoolset} +. /opt/rh/devtoolset-8/enable +%endif + +%cmake \ + -DENABLE_HLS:BOOL=ON \ + -DENABLE_OPENSSL:BOOL=ON \ + -DENABLE_MYSQL:BOOL=ON \ + -DENABLE_FAAC:BOOL=ON \ + -DENABLE_X264:BOOL=ON \ + -DENABLE_MP4:BOOL=ON \ + -DENABLE_RTPPROXY:BOOL=ON \ + -DENABLE_API:BOOL=ON \ + -DENABLE_CXX_API:BOOL=ON \ + -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}/* + +%files c-libs +%{_libdir}/libmk_api.so + +%files c-devel +%{_includedir}/mk_* + +%files cxx-devel +%{_includedir}/ZLMediaKit/* +%{_includedir}/ZLToolKit/* +%{_libdir}/libzlmediakit.a +%{_libdir}/libzltoolkit.a +%{_libdir}/libmpeg.a +%{_libdir}/libmov.a +%{_libdir}/libflv.a + +%changelog + From af6446507eef80766f44eed3e778051c7d662a1f Mon Sep 17 00:00:00 2001 From: wxf Date: Thu, 17 Dec 2020 20:14:49 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/rpm/ZLMediaKit.spec | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/package/rpm/ZLMediaKit.spec b/package/rpm/ZLMediaKit.spec index e3af386d..09d0838c 100644 --- a/package/rpm/ZLMediaKit.spec +++ b/package/rpm/ZLMediaKit.spec @@ -1,9 +1,16 @@ %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 %global use_devtoolset 0 +%bcond_without faac +%bcond_without x264 %else %global use_devtoolset 1 +%bcond_with faac +%bcond_with x264 %endif +%bcond_without openssl +%bcond_without mysql + Name: ZLMediaKit Version: 5.0.0 Release: 1%{?dist} @@ -14,10 +21,21 @@ License: MIT URL: https://github.com/xia-chu/ZLMediaKit Source0: %{name}-%{version}.tar.xz +%if %{with openssl} BuildRequires: openssl-devel +%endif + +%if %{with mysql} BuildRequires: mysql-devel +%endif + +%if %{with faac} BuildRequires: faac-devel +%endif + +%if %{with x264} BuildRequires: x264-devel +%endif %if 0%{?use_devtoolset} BuildRequires: devtoolset-8-gcc-c++ @@ -64,11 +82,12 @@ pushd %{_target_platform} %endif %cmake \ + -DCMAKE_BUILD_TYPE:STRING=Release \ -DENABLE_HLS:BOOL=ON \ - -DENABLE_OPENSSL:BOOL=ON \ - -DENABLE_MYSQL:BOOL=ON \ - -DENABLE_FAAC:BOOL=ON \ - -DENABLE_X264:BOOL=ON \ + -DENABLE_OPENSSL:BOOL=%{with openssl} \ + -DENABLE_MYSQL:BOOL=%{with mysql} \ + -DENABLE_FAAC:BOOL=%{with faac} \ + -DENABLE_X264:BOOL=%{with x264} \ -DENABLE_MP4:BOOL=ON \ -DENABLE_RTPPROXY:BOOL=ON \ -DENABLE_API:BOOL=ON \ From 2242f7ecc5afb7744c6e21bccdb4c34784ed2126 Mon Sep 17 00:00:00 2001 From: wxf Date: Thu, 17 Dec 2020 20:43:38 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20CentOS=206=20=E4=B8=8B?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20devtoolset=208=20=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 inttypes.h 提供的 PRIu64 需要定义 __STDC_FORMAT_MACROS, 而 cinttypes 会定义该宏. https://stackoverflow.com/a/8132440/5218590 --- src/Http/HlsParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/HlsParser.cpp b/src/Http/HlsParser.cpp index b6b35f01..60e578d7 100644 --- a/src/Http/HlsParser.cpp +++ b/src/Http/HlsParser.cpp @@ -9,7 +9,7 @@ */ #include -#include +#include #include "HlsParser.h" #include "Util/util.h" #include "Common/Parser.h" From 6a2709bec2c44fa4aac0cf49ffd2597b2f650978 Mon Sep 17 00:00:00 2001 From: wxf Date: Thu, 17 Dec 2020 21:40:58 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E9=9C=80=E8=A6=81=20cmake3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/rpm/ZLMediaKit.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/rpm/ZLMediaKit.spec b/package/rpm/ZLMediaKit.spec index 09d0838c..c4e5c855 100644 --- a/package/rpm/ZLMediaKit.spec +++ b/package/rpm/ZLMediaKit.spec @@ -81,7 +81,7 @@ pushd %{_target_platform} . /opt/rh/devtoolset-8/enable %endif -%cmake \ +%cmake3 \ -DCMAKE_BUILD_TYPE:STRING=Release \ -DENABLE_HLS:BOOL=ON \ -DENABLE_OPENSSL:BOOL=%{with openssl} \ From e467cf10c341e420ea53cbb7efe1b59bd7dba760 Mon Sep 17 00:00:00 2001 From: wxf Date: Fri, 18 Dec 2020 09:12:52 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20rpm=20=E5=8C=85?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/rpm/ZLMediaKit.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/rpm/ZLMediaKit.spec b/package/rpm/ZLMediaKit.spec index c4e5c855..58b2b633 100644 --- a/package/rpm/ZLMediaKit.spec +++ b/package/rpm/ZLMediaKit.spec @@ -45,26 +45,26 @@ BuildRequires: devtoolset-8-gcc-c++ 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 -Requires: %{name}-%{version} +Requires: %{name} = %{version} 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. %package c-libs -Requires: %{name}-%{version} +Requires: %{name} = %{version} Summary: The %{name} C libraries. %description c-libs The %{name} C libraries. %package c-devel -Requires: %{name}-c-libs-%{version} +Requires: %{name}-c-libs = %{version} Summary: The %{name} C API headers. %description c-devel The %{name} C API headers. %package cxx-devel -Requires: %{name}-%{version} +Requires: %{name} = %{version} Summary: The %{name} C++ API headers and development libraries. %description cxx-devel The %{name} C++ API headers and development libraries.