File dtkmultimedia.spec of Package dtkmultimedia

#
# spec file for package dtkmultimedia 
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2023 Hillwood Yang <hillwood@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define  sover  1
%define  _name  dtk6multimedia

Name:           dtkmultimedia
Version:        6.0.4
Release:        0
Summary:        Development Tool Kit Multimedia
License:        LGPL-3.0+
Group:          System/GUI/Other
URL:            https://github.com/linuxdeepin/dtkmultimedia
Source0:        https://github.com/linuxdeepin/dtkmultimedia/archive/%{version}/%{name}-%{version}.tar.gz
# https://github.com/linuxdeepin/dtkmultimedia/pull/61
Patch0:         fix-build-libavcode_61.patch
# PATCH-FIX-UPSTREAM drop-set_vulkan_compute.patch hillwood@opensuse.org - set_vulkan_compute has been removed from ncnn 20250916
Patch1:         drop-set_vulkan_compute.patch
# PATCH-FIX-UPSTREAM support-Qt-6_10.patch hillwood@opensuse.org
# https://github.com/linuxdeepin/dtkmultimedia/pull/78
Patch2:         support-Qt-6_10.patch
# PATCH-FIX-UPSTREAM audio_codecs_ffmpeg_compat.patch hillwood@opensuse.org
# https://github.com/linuxdeepin/dtkmultimedia/pull/78
Patch3:         audio_codecs_ffmpeg_compat.patch
BuildRequires:  doxygen
BuildRequires:  gstreamer-plugins-base-devel
BuildRequires:  qt6-tools-helpgenerators
BuildRequires:  qt6-core-private-devel
BuildRequires:  qt6-gui-private-devel
BuildRequires:  cmake(OpenCV)
BuildRequires:  cmake(Qt6Linguist)
BuildRequires:  cmake(Qt6ToolsTools)
BuildRequires:  pkgconfig(gobject-2.0)
BuildRequires:  pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(dtk6core)
BuildRequires:  pkgconfig(dtk6widget)
BuildRequires:  pkgconfig(ncnn)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libffmpegthumbnailer)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libv4l1)
BuildRequires:  pkgconfig(mpv)
BuildRequires:  pkgconfig(portaudio-2.0)
BuildRequires:  pkgconfig(spdlog)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6Gui)
BuildRequires:  pkgconfig(Qt6Multimedia)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(Qt6DBus)
BuildRequires:  pkgconfig(Qt6Network)
BuildRequires:  pkgconfig(Qt6Concurrent)
BuildRequires:  pkgconfig(Qt6MultimediaWidgets)
BuildRequires:  pkgconfig(Qt6Xml)
BuildRequires:  pkgconfig(Qt6OpenGLWidgets)
%if 0%{?suse_version} < 1600
BuildRequires:  gcc13
BuildRequires:  gcc13-c++
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Development Tool Kit (DtkMultimedia) is the base development tool of all C++/Qt
Developer work on Deepin.

%package -n lib%{_name}%{sover}
Summary:        Deepin Multimedia Toolkit Core libraries
Group:          System/Libraries

%description -n lib%{_name}%{sover}
Deepin Multimedia Toolkit is the base devlopment tool of all C++/Qt Developer
work on Deepin.

%package -n lib%{_name}widgets%{sover}
Summary:        Deepin Multimedia Widgets Toolkit Core libraries
Group:          System/Libraries

%description -n lib%{_name}widgets%{sover}
Deepin Multimedia Widgets Toolkit is the base devlopment tool of all C++/Qt
Developer work on Deepin.

%package -n libdtk6ocr%{sover}
Summary:        Deepin Multimedia Widgets Toolkit Core libraries
Group:          System/Libraries
Requires:       libdtk6ocr-data = %{version}

%description -n libdtk6ocr%{sover}
Deepin Multimedia Widgets Toolkit is the base devlopment tool of all C++/Qt
Developer work on Deepin.

%package -n libdtk6ocr-data
Summary:        The database of libdtk6ocr
Group:          Productivity/Graphics/Other
BuildArch:      noarch

%description -n libdtk6ocr-data
The database of libdtk6ocr

%package doc
Summary:        Documents of dtkmultimedia
Group:          Documentation/Other
BuildArch:      noarch

%description doc
Documents of dtkmultimedia

%package devel
Summary:        Development tools for dtkmultimedia
Group:          Development/Languages/C and C++
Requires:       dtkcommon
Requires:       lib%{name}%{sover} = %{version}
Requires:       lib%{name}widgets%{sover}
Requires:       libdtkocr%{sover}

%description devel
The dtkmultimedia-devel package contains the header files and developer
docs for dtkmultimedia.

%prep
%autosetup -p1
sed -i 's/opencv_mobile/opencv4/g' src/ocr/CMakeLists.txt

%build
%if 0%{?suse_version} < 1600
    export CC=gcc-13
    export CXX=g++-13
%endif
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
      -DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
      -DCMAKE_CXX_FLAGS="${CXXFLAGS:-%optflags}" \
      ..
#      -DCMAKE_EXE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \
#      -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" 

%cmake_build

%install
%cmake_install

%post -n lib%{_name}%{sover} -p /sbin/ldconfig
%postun -n lib%{_name}%{sover} -p /sbin/ldconfig

%post -n lib%{_name}widgets%{sover} -p /sbin/ldconfig
%postun -n lib%{_name}widgets%{sover} -p /sbin/ldconfig

%post -n libdtk6ocr%{sover} -p /sbin/ldconfig
%postun -n libdtk6ocr%{sover} -p /sbin/ldconfig

%files -n lib%{_name}%{sover}
%{_libdir}/lib%{_name}.so.*

%files -n lib%{_name}widgets%{sover}
%{_libdir}/lib%{_name}widgets.so.*

%files -n libdtk6ocr%{sover}
%{_libdir}/libdtk6ocr.so.*

%files -n libdtk6ocr-data
%{_datadir}/libdtk6ocr

%files doc
%{_datadir}/qt6/doc/*.qch

%files devel
%doc README.md README.zh_CN.md
%license LICENSE
%{_libdir}/lib%{_name}.so
%{_libdir}/lib%{_name}widgets.so
%{_libdir}/libdtk6ocr.so
%{_libdir}/qt6/mkspecs/modules/*.pri
%{_libdir}/pkgconfig/*.pc
%{_libdir}/cmake/%{_name}
%{_libdir}/cmake/dtk6ocr
%{_includedir}/%{_name}
%{_includedir}/%{_name}widgets
%{_includedir}/dtk6ocr

%changelog

openSUSE Build Service is sponsored by