# Disable debug rpm on EPEL/CentOS Stream %global debug_package %{nil} # https://github.com/nginxinc/nginx-prometheus-exporter %global goipath github.com/nginxinc/nginx-prometheus-exporter Version: 1.0.0 %gometa %global common_description %{expand: NGINX Prometheus exporter makes it possible to monitor NGINX or NGINX Plus using Prometheus.} %global golicenses LICENSE Name: nginx-prometheus-exporter Release: 1%{?dist} Summary: NGINX Prometheus Exporter for NGINX and NGINX Plus URL: %{gourl} License: Apache-2.0 Source0: %{gosource} Source1: %{name}.service Source2: %{name}.conf Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description %{common_description} #%%gopkg %prep %autosetup %build go mod vendor CGO_ENABLED=0 go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback' -ldflags '-X %{goipath}/version=%{version} -compressdwarf=false -s -w' -o %{gobuilddir}/bin/%{name} %{goipath} %install install -D -p -m 0755 %{gobuilddir}/bin/%{name} %{buildroot}%{_bindir}/%{name} install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system/%{name}.service install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE %doc README.md CHANGELOG.md %{_bindir}/%{name} %{_prefix}/lib/systemd/system/%{name}.service %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}