%global debug_package   %{nil}
%global repo deepin-network-proxy

Name:           deepin-proxy
Version:        1.1.0.9
Release:        1
Summary:        Most simple RPM package
License:        GPLv3

URL:            https://github.com/linuxdeepin/%{repo}
Source0:        %{repo}-%{version}.tar.gz
Source1:        vendor.tar.gz

BuildRequires:  golang
BuildRequires:  pkgconfig(gdk-3.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gobject-2.0)
BuildRequires:  gtest-devel
Obsoletes:      deepin-network-proxy

%description
This is my first RPM package, which does nothing.

%prep
%autosetup -n %{repo}-%{version}
patch -p1 < rpm/lib-to-libexec.patch

tar -xf %{SOURCE1}

%build
%ifarch loongarch64
export CGO_ENABLED=1
export GOOS=linux
%endif

sed -i 's|gocode$|gocode:%{_builddir}/%{repo}-%{version}/vendor:|' Makefile
%make_build GO_BUILD_FLAGS=-trimpath

%install
%make_install

%files
%config %{_sysconfdir}/deepin/deepin-proxy/*
%{_datadir}/dbus-1/system.d/*
%{_datadir}/dbus-1/system-services/*
%{_libexecdir}/deepin-daemon/*

%changelog
* Mon Aug 14 2023 leeffo <liweiganga@uniontech.com> - 1.1.0.9-1
- init package
