File deepin-network-core.spec of Package deepin-network-core

#
# spec file for package deepin-network-core
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 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  _name  dde-network-core
%define  sover  2
%define  gtest_version    %(rpm -q --queryformat '%%{VERSION}' gtest)

Name:           deepin-network-core
Version:        2.0.57
Release:        0
License:        GPL-3.0+
Summary:        Deepin Network Framework
Group:          Productivity/Networking/System
URL:            https://github.com/linuxdeepin/dde-network-core
Source:         https://github.com/linuxdeepin/dde-network-core/archive/%{version}/%{_name}-%{version}.tar.gz
# PATCH-FOR-UPSTREAM do-not-hardcode-module-dir.patch hillwood@opensuse.org - Use variable instead of hardcode for module dir
Patch0:         do-not-hardcode-module-dir.patch
BuildRequires:  chrpath
BuildRequires:  fdupes
BuildRequires:  gtest
BuildRequires:  qt6-tools-linguist
BuildRequires:  polkit
BuildRequires:  cmake(DdeControlCenter)
BuildRequires:  cmake(KF6NetworkManagerQt)
BuildRequires:  cmake(DdeSessionShell)
BuildRequires:  cmake(DdeDock)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(Qt6DBus)
BuildRequires:  pkgconfig(Qt6Network)
BuildRequires:  pkgconfig(Qt6Svg)
BuildRequires:  pkgconfig(Qt6Xml)
BuildRequires:  pkgconfig(Qt6Qml)
BuildRequires:  pkgconfig(Qt6Concurrent)
BuildRequires:  pkgconfig(Qt6Linguist)
BuildRequires:  pkgconfig(dtk6widget)
BuildRequires:  pkgconfig(dframeworkdbus)
BuildRequires:  pkgconfig(gsettings-qt)
BuildRequires:  pkgconfig(libnm)
BuildRequires:  pkgconfig(libudev)
Recommends:     %{name}-lang = %{version}

%description
DDE network library framework.

%package -n lib%{_name}6-%{sover}
Summary:        Deepin Network Framework library
Group:          System/Libraries

%description -n lib%{_name}6-%{sover}
Deepin Network Framework library.

%package -n deepin-control-center-plugin-network
Summary:        Deepin Control Center Network Plugin
Requires:       %{name} = %{version}

%description -n deepin-control-center-plugin-network
Network plugin of Deepin Control Center.

%package -n deepin-session-shell-plugin-network
Summary:        Deepin Seesion Shell Network Plugin
Requires:       %{name} = %{version}

%description -n deepin-session-shell-plugin-network
Network plugin of Deepin Seesion Shell.

%package -n deepin-service-manager-network
Summary:        Network Module of Deepin Service Manager
Requires:       %{name} = %{version}

%description -n deepin-service-manager-network
Network Module of Deepin Service Manager.

%package -n deepin-dock-plugin-network
Summary:        Network Plugin of Deepin Shell
Requires:       %{name} = %{version}

%description -n deepin-dock-plugin-network
Network Plugin of Deepin Shell.

%package devel
Summary:        Development tools for Deepin Network Framework
Group:          Development/Libraries/C and C++
Requires:       lib%{_name}%{sover} = %{version}-%{release}

%description devel
The deepin-network-utils-devel package contains the header files for
deepin-network-utils.

%lang_package

%prep
%autosetup -p1 -n %{_name}-%{version}
sed -i "s/lupdate/lupdate6/g" dcc-network-plugin/lupdate.sh \
        dock-hotspot-plugin/lupdate.sh \
        dock-network-plugin/lupdate.sh \
        dss-network-plugin/lupdate.sh \
        network-service-plugin/lupdate.sh \
        src/lupdate.sh
%if "%{gtest_version}" >= "1.14.0"
sed -i "/CMAKE_CXX_STANDARD/s|11|14|" tests/CMakeLists.txt
%endif

%build
%cmake
%cmake_build

%install
%cmake_install

%find_lang network --with-qt
%find_lang %{_name} --with-qt
%find_lang network-service-plugin --with-qt
%find_lang dock-network-plugin --with-qt
%find_lang dss-network-plugin --with-qt
cat *.lang > %{name}.lang

%fdupes %{buildroot}%{_datadir}
chrpath --delete %{buildroot}%{_libdir}/dde-control-center/plugins_v1.0/network/network.so

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

%files
%doc README.zh_CN.md README.md
%license LICENSE
%dir %{_datadir}/dsg
%dir %{_datadir}/dsg/configs
%dir %{_datadir}/dsg/configs/org.deepin.dde.network
%{_datadir}/dsg/configs/org.deepin.dde.network/org.deepin.dde.network.json
%{_datadir}/polkit-1/rules.d/50-dss-network-plugin.rules
%{_datadir}/dbus-1/system.d/*.conf

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

%files -n deepin-control-center-plugin-network
%dir %{_libdir}/dde-control-center
%dir %{_libdir}/dde-control-center/plugins_v1.0
%{_libdir}/dde-control-center/plugins_v1.0/network

%files -n deepin-service-manager-network
%dir %{_libdir}/deepin-service-manager
%{_libdir}/deepin-service-manager/libnetwork-service.so
%dir %{_datadir}/deepin-service-manager
%dir %{_datadir}/deepin-service-manager/*
%{_datadir}/deepin-service-manager/*/*.json

%files -n deepin-dock-plugin-network
%dir %{_libdir}/dde-dock
%dir %{_libdir}/dde-dock/plugins
%dir %{_libdir}/dde-dock/plugins/system-trays/
%{_libdir}/dde-dock/plugins/system-trays/libdock-network-plugin.so
%dir %{_datadir}/dde-dock
%dir %{_datadir}/dde-dock/icons
%dir %{_datadir}/dde-dock/icons/dcc-setting
%{_datadir}/dde-dock/icons/dcc-setting/dcc-network.dci

%files -n deepin-session-shell-plugin-network
%dir %{_libdir}/dde-session-shell
%dir %{_libdir}/dde-session-shell/modules
%{_libdir}/dde-session-shell/modules/libdss-network-plugin.so

%files devel
%{_libdir}/lib%{_name}6.so
%{_libdir}/pkgconfig/%{_name}.pc
%{_includedir}/libddenetworkcore

%files lang -f %{name}.lang
%dir %{_datadir}/dde-control-center
%dir %{_datadir}/dde-control-center/translations
%dir %{_datadir}/dde-control-center/translations/v1.0
%dir %{_datadir}/dde-network-core
%dir %{_datadir}/dde-network-core/translations
%{_datadir}/dde-network-core/translations/dde-network-core.qm
%dir %{_datadir}/deepin-service-manager
%dir %{_datadir}/deepin-service-manager/network-service
%dir %{_datadir}/deepin-service-manager/network-service/translations
%{_datadir}/deepin-service-manager/network-service/translations/network-service-plugin.qm
%dir %{_datadir}/dock-network-plugin
%dir %{_datadir}/dock-network-plugin/translations
%{_datadir}/dock-network-plugin/translations/dock-network-plugin.qm
%dir %{_datadir}/dss-network-plugin
%dir %{_datadir}/dss-network-plugin/translations
%{_datadir}/dss-network-plugin/translations/dss-network-plugin.qm

%changelog

openSUSE Build Service is sponsored by