%global gtk3_version    %(pkg-config --modversion gtk+-3.0 2>/dev/null || echo bad)
%global gtk4_version    %(pkg-config --modversion gtk4 2>/dev/null || echo bad)
%global glib2_version   %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad)
%global nm_version      1:1.16.0
%global libnma_version  1.8.27
%global obsoletes_ver   1:0.9.7
 
%global rpm_version 1.18.0
%global real_version 1.18.0
%global release_version 1
 
%global real_version_major %(printf '%s' '%{real_version}' | sed -n 's/^\\([1-9][0-9]*\\.[1-9][0-9]*\\)\\.[1-9][0-9]*$/\\1/p')
 
%if 0%{?fedora} > 31 || 0%{?rhel} > 8
%bcond_with libnma_gtk4
%else
%bcond_without libnma_gtk4
%endif
 
Name: network-manager-applet
Summary: A network control and status applet for NetworkManager
Version: %{rpm_version}
Release: %{release_version}%{?dist}
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
Obsoletes: NetworkManager-gnome < %{obsoletes_ver}
 
Source: https://download.gnome.org/sources/network-manager-applet/%{real_version_major}/%{name}-%{real_version}.tar.xz
 
Requires: NetworkManager >= %{nm_version}
Requires: libnotify >= 0.4.3
Requires: nm-connection-editor%{?_isa} = %{version}-%{release}
Requires: libnma%{?_isa} >= %{libnma_version}
 
BuildRequires: NetworkManager-libnm-devel >= %{nm_version}
BuildRequires: libnma-devel >= %{libnma_version}
BuildRequires: ModemManager-glib-devel >= 1.0
BuildRequires: glib2-devel >= 2.32
BuildRequires: gtk3-devel >= 3.10
%if %{with libnma_gtk4}
BuildRequires: gtk4-devel >= 3.96
%endif
BuildRequires: gobject-introspection-devel >= 0.10.3
BuildRequires: gettext-devel
BuildRequires: /usr/bin/autopoint
BuildRequires: pkgconfig
BuildRequires: libnotify-devel >= 0.4
BuildRequires: meson
BuildRequires: intltool
BuildRequires: gtk-doc
BuildRequires: desktop-file-utils
BuildRequires: iso-codes-devel
BuildRequires: libgudev1-devel >= 147
BuildRequires: libsecret-devel >= 0.12
BuildRequires: jansson-devel
BuildRequires: gcr-devel
BuildRequires: libselinux-devel
BuildRequires: mobile-broadband-provider-info-devel
BuildRequires: libappindicator-gtk3-devel
BuildRequires: libdbusmenu-gtk3-devel
 
%description -n  libnma-devel
This package contains private header and pkg-config files to be used only by
nm-applet, nm-connection-editor, and the GNOME control center.
 
This package deprecates libnm-gtk.

%package_help
 
%prep
%autosetup -p1 -n "%{name}-%{real_version}"
 
%build
%meson \
    -Dgcr=true \
    -Dselinux=true \
    -Ddisable-static=true \
    -Dappindicator=yes
%meson_build
%install
%meson_install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gnome-vpn-properties
 
%find_lang nm-applet
cat nm-applet.lang >> %{name}.lang
 
# validate .desktop and autostart files
desktop-file-validate $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart/nm-applet.desktop
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/nm-connection-editor.desktop
 
%check
%meson_test

%ldconfig_scriptlets  -n libnma 
%ldconfig_scriptlets  -n libnm-gtk

%files
%defattr(-,root,root)
%license COPYING
%doc NEWS CONTRIBUTING
%{_bindir}/nm-applet
%{_datadir}/applications/nm-applet.desktop
%{_datadir}/icons/hicolor/22x22/apps/nm-s*.png
%{_datadir}/icons/hicolor/22x22/apps/nm-tech-*.png
%{_datadir}/icons/hicolor/22x22/apps/nm-vpn*.png
%{_datadir}/icons/hicolor/22x22/apps/nm-adhoc.png
%{_datadir}/icons/hicolor/22x22/apps/nm-wwan-tower.png
%{_datadir}/icons/hicolor/22x22/apps/nm-mb-roam.png
%{_datadir}/GConf/gsettings/nm-applet.convert
%{_sysconfdir}/xdg/autostart/nm-applet.desktop
 
%files -n    nm-connection-editor -f %{name}.lang
%defattr(-,root,root)
%{_bindir}/nm-connection-editor
%{_datadir}/applications/nm-connection-editor.desktop
%{_datadir}/icons/hicolor/*/apps/nm-d*
%{_datadir}/icons/hicolor/*/apps/nm-no-connection*
%{_datadir}/icons/hicolor/16x16/apps/nm-vpn-standalone-lock.png
%{_datadir}/glib-2.0/schemas/org.gnome.nm-applet.gschema.xml
%{_datadir}/metainfo/nm-connection-editor.appdata.xml
%dir %{_datadir}/gnome-vpn-properties
 
%if %{with libnm_gtk}
%files -n    libnm-gtk
%defattr(-,root,root)
%{_libdir}/libnm-gtk.so.*
%{_libdir}/girepository-1.0/NMGtk-1.0.typelib
 
%files -n    libnm-gtk-devel
%defattr(-,root,root)
%{_includedir}/libnm-gtk/*.h
%{_libdir}/pkgconfig/libnm-gtk.pc
%{_libdir}/libnm-gtk.so
%{_datadir}/gir-1.0/NMGtk-1.0.gir
%endif
 
%files -n    libnma
%defattr(-,root,root)
%{_libdir}/libnma.so.*
%{_libdir}/girepository-1.0/NMA-1.0.typelib
 
%files -n    libnma-devel
%defattr(-,root,root)
%{_includedir}/libnma/*.h
%{_libdir}/pkgconfig/libnma.pc
%{_libdir}/libnma.so
%{_datadir}/gir-1.0/NMA-1.0.gir
%{_datadir}/gtk-doc


%files      help
%defattr(-,root,root)
%{_mandir}/man1/nm-applet*
%{_mandir}/man1/nm-connection-editor*

%changelog
* Mon Jun 22 2020 Adam Williamson <awilliam@redhat.com> - 1.18.0-1
- Update to 1.18.0

* Thu Nov 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.8.22-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:add the libxslt in buildrequires

* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.8.22-1
- Package init
