Name:           globalprotect-openconnect
Version:        @VERSION@
Release:        @REVISION@
Summary:        A GlobalProtect VPN client powered by OpenConnect
Group:          Productivity/Networking/PPP

License:        GPL-3.0
URL:            https://github.com/yuezk/GlobalProtect-openconnect
Source:         %{name}.tar.gz

BuildRequires:  make
BuildRequires:  rust
BuildRequires:  cargo
BuildRequires:  jq
BuildRequires:  pkg-config
BuildRequires:  openconnect-devel
BuildRequires:  openssl-devel
BuildRequires:  wget
BuildRequires:  file
BuildRequires:  perl

BuildRequires:  (webkit2gtk4.0-devel or webkit2gtk3-soup2-devel)
BuildRequires:  (libappindicator-gtk3-devel or libappindicator3-1)
BuildRequires:  (librsvg2-devel or librsvg-devel)

Requires:       openconnect >= 8.20, (libayatana-appindicator or libappindicator-gtk3)
Conflicts:      globalprotect-openconnect-snapshot

%global debug_package %{nil}

%description
A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method.

%prep
%setup

%postun
rm -f %{_bindir}/gpgui

%build
# The injected RUSTFLAGS could fail the build
unset RUSTFLAGS
make build OFFLINE=@OFFLINE@ BUILD_FE=0

%install
%make_install

%files
%defattr(-,root,root)
%{_bindir}/*
%{_datadir}/applications/gpgui.desktop
%{_datadir}/icons/hicolor/32x32/apps/gpgui.png
%{_datadir}/icons/hicolor/128x128/apps/gpgui.png
%{_datadir}/icons/hicolor/256x256@2/apps/gpgui.png
%{_datadir}/icons/hicolor/scalable/apps/gpgui.svg
%{_datadir}/polkit-1/actions/com.yuezk.gpgui.policy

%dir /usr/lib/NetworkManager
%dir /usr/lib/NetworkManager/dispatcher.d
%dir /usr/lib/NetworkManager/dispatcher.d/pre-down.d

/usr/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down
/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook

%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/icons/hicolor/128x128
%dir %{_datadir}/icons/hicolor/128x128/apps
%dir %{_datadir}/icons/hicolor/256x256@2
%dir %{_datadir}/icons/hicolor/256x256@2/apps
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%dir %{_datadir}/polkit-1
%dir %{_datadir}/polkit-1/actions

%changelog
* @DATE@ Kevin Yue <k3vinyue@gmail.com> - @VERSION@
- Bugfix and improvements
