From affff001304869e6beff4a36061d80af0ce04888dc00770adaee57b340af174f Mon Sep 17 00:00:00 2001 From: Xu Zhao Date: Mon, 27 Jun 2022 18:27:17 +0000 Subject: [PATCH] Accepting request 985163 from home:nuklly:branches:server:messaging - Add 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch * Fix the build on openSUSE 15.4 - Rename 0001-use-bundled-ranged-exptected-gsl.patch to 0001-use-bundled-webrtc.patch * Use system provided ranged, gsl, and ranges library. OBS-URL: https://build.opensuse.org/request/show/985163 OBS-URL: https://build.opensuse.org/package/show/server:messaging/telegram-desktop?expand=0&rev=230 --- 0001-use-bundled-webrtc.patch | 11 ++++++ ...d-rnnoise-expected-gsl-ranges-webrtc.patch | 32 +++++++++++++++++ rnnoise-git20210122.tar.gz | 3 ++ telegram-desktop.changes | 9 +++++ telegram-desktop.spec | 35 +++++++++++++++++-- 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 0001-use-bundled-webrtc.patch rename 0001-use-bundled-ranged-exptected-gsl.patch => 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch (56%) create mode 100644 rnnoise-git20210122.tar.gz diff --git a/0001-use-bundled-webrtc.patch b/0001-use-bundled-webrtc.patch new file mode 100644 index 0000000..65ee2c9 --- /dev/null +++ b/0001-use-bundled-webrtc.patch @@ -0,0 +1,11 @@ +--- a/cmake/external/webrtc/CMakeLists.txt ++++ b/cmake/external/webrtc/CMakeLists.txt +@@ -7,7 +7,7 @@ + add_library(external_webrtc INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_webrtc ALIAS external_webrtc) + +-if (DESKTOP_APP_USE_PACKAGED) ++if (NOT DESKTOP_APP_USE_PACKAGED) + find_package(tg_owt REQUIRED) + target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt) + return() diff --git a/0001-use-bundled-ranged-exptected-gsl.patch b/0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch similarity index 56% rename from 0001-use-bundled-ranged-exptected-gsl.patch rename to 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch index f2a27b5..d1fd50b 100644 --- a/0001-use-bundled-ranged-exptected-gsl.patch +++ b/0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch @@ -1,3 +1,35 @@ +--- a/cmake/external/rnnoise/CMakeLists.txt ++++ b/cmake/external/rnnoise/CMakeLists.txt +@@ -4,7 +4,7 @@ + # For license and copyright information please follow this link: + # https://github.com/desktop-app/legal/blob/master/LEGAL + +-if (DESKTOP_APP_USE_PACKAGED) ++if (NOT DESKTOP_APP_USE_PACKAGED) + add_library(external_rnnoise INTERFACE IMPORTED GLOBAL) + add_library(desktop-app::external_rnnoise ALIAS external_rnnoise) + +@@ -18,7 +18,7 @@ endif() + add_library(external_rnnoise STATIC IMPORTED GLOBAL) + add_library(desktop-app::external_rnnoise ALIAS external_rnnoise) + +-set(rnnoise_lib_loc ${libs_loc}/rnnoise/out) ++set(rnnoise_lib_loc ${libs_loc}/rnnoise/.libs) + if (WIN32) + target_include_directories(external_rnnoise SYSTEM + INTERFACE +@@ -40,9 +40,9 @@ elseif (APPLE) + else() + target_include_directories(external_rnnoise SYSTEM + INTERFACE +- /usr/local/include ++ ${libs_loc}/rnnoise/include + ) +- find_library(RNNOISE_LIBRARY librnnoise.a REQUIRED) ++ find_library(RNNOISE_LIBRARY librnnoise.a HINTS "${rnnoise_lib_loc}" REQUIRED) + set_target_properties(external_rnnoise PROPERTIES + IMPORTED_LOCATION "${RNNOISE_LIBRARY}" + ) --- a/cmake/external/expected/CMakeLists.txt +++ b/cmake/external/expected/CMakeLists.txt @@ -7,7 +7,7 @@ diff --git a/rnnoise-git20210122.tar.gz b/rnnoise-git20210122.tar.gz new file mode 100644 index 0000000..5a35abe --- /dev/null +++ b/rnnoise-git20210122.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:767b22cd9d72f1062f1d424b10538056d281d1677373f00034e4f61fc09112b2 +size 173774 diff --git a/telegram-desktop.changes b/telegram-desktop.changes index 52a6793..634eeb5 100644 --- a/telegram-desktop.changes +++ b/telegram-desktop.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Sun Jun 26 14:21:10 UTC 2022 - Xu Zhao + +- Add 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch + * Fix the build on openSUSE 15.4 +- Rename 0001-use-bundled-ranged-exptected-gsl.patch to + 0001-use-bundled-webrtc.patch + * Use system provided ranged, gsl, and ranges library. + ------------------------------------------------------------------- Sat Jun 25 08:19:33 UTC 2022 - Manfred Hollstein diff --git a/telegram-desktop.spec b/telegram-desktop.spec index b9cfa48..36b7216 100644 --- a/telegram-desktop.spec +++ b/telegram-desktop.spec @@ -47,8 +47,14 @@ Source0: https://github.com/telegramdesktop/tdesktop/releases/download/v% # Usage: python tg_owt-packager.py --repo-dir $PWD/tg_owt-master Source1: tg_owt-packager.py Source2: tg_owt-master.zip +%if 0%{?suse_version} > 01500 # PATCH-FIX-OPENSUSE -Patch1: 0001-use-bundled-ranged-exptected-gsl.patch +Patch1: 0001-use-bundled-webrtc.patch +%else +Source3: rnnoise-git20210122.tar.gz +# PATCH-FIX-OPENSUSE +Patch1: 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch +%endif # PATCH-FIX-OPENSUSE Patch3: 0003-revert-webrtc-cmake-target-file.patch # PATCH-FIX-OPENSUSE @@ -145,7 +151,17 @@ BuildRequires: pkgconfig(opusfile) BuildRequires: pkgconfig(opusurl) BuildRequires: pkgconfig(portaudio-2.0) BuildRequires: pkgconfig(portaudiocpp) +# Use system rnnoise on TW, self-build on others +%if 0%{?suse_version} > 01500 +BuildRequires: expect-devel +BuildRequires: range-v3-devel +BuildRequires: pkgconfig(gsl) BuildRequires: pkgconfig(rnnoise) +%else +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +%endif BuildRequires: pkgconfig(tslib) BuildRequires: pkgconfig(vdpau) BuildRequires: pkgconfig(vpx) @@ -187,10 +203,16 @@ The service also provides APIs to independent developers. %patch1 -p1 %patch3 -p1 %patch4 -p1 +mkdir ../Libraries + +# If not TW, unpack rnnoise source +%if 0%{?suse_version} <= 01500 +%setup -q -T -D -b 3 -n tdesktop-%{version}-full +mv ../rnnoise-git20210122 ../Libraries/rnnoise +%endif cd ../ unzip -q %{SOURCE2} -mkdir Libraries mv tg_owt-master Libraries/tg_owt %build @@ -202,6 +224,15 @@ export CXX=g++-10 # Fix build failures due to not finding installed headers for xkbcommon and wayland-client export CXXFLAGS+="`pkg-config --cflags xkbcommon wayland-client`" +# If not TW, build rnnoise +%if 0%{?suse_version} <= 01500 +pushd %{_builddir}/Libraries/rnnoise +./autogen.sh +%configure +%make_build +popd +%endif + cd %{_builddir}/Libraries/tg_owt mkdir -p out/Release cd out/Release