SHA256
1
0
forked from pool/doggo
doggo/doggo.spec
Jeff Kowalczyk b0f5ee7207 Accepting request 1118746 from home:jfkw:branches:devel:languages:go
- Packaging improvements:
  * Use subpackages for fish-completion and zsh-completion.
    Upstream currently has no bash completion scripts. Fish and zsh
    subpackages are marked Suggests: and not installed by default.
    If a bash-completion subpackage becomes available, we should
    install that by default.
  * Build PIE with pattern that may become recommended procedure:
    %%ifnarch ppc64 GOFLAGS="-buildmode=pie" %%endif go build
    A go toolchain buildmode default config would be preferable
    but none exist at this time.
  * Remove ldflags -X entries for upstream import path and version.
    This information is embedded in binaries with go1.18+ and
    available via go version -m or runtime/debug.ReadBuildInfo().
  * Remove ldflags -s (Omit symbol table and debug info) and -w
    (Omit DWARF symbol table). This information is used to produce
    separate debuginfo packages and binaries are stripped for
    reduced size by GNU strip during RPM build.
  * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable
  * Use %%name macro where applicable to normalize common lines
    across Go app packages. Also makes renaming binary easier when
    required to handle package name conflict.
  * Remove bash loop for two paramaterized calls of go build.
    The loop technique is nice for large lists, but making the two
    go build calls explicit seems a better readability tradeoff.
  * Add sample API config as doc

OBS-URL: https://build.opensuse.org/request/show/1118746
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/doggo?expand=0&rev=2
2023-10-20 03:42:49 +00:00

92 lines
2.6 KiB
RPMSpec

#
# spec file for package doggo
#
# Copyright (c) 2023 SUSE LLC
#
# 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/
#
Name: doggo
Version: 0.5.7
Release: 0
Summary: CLI tool and API server DNS client implemented in Go
License: GPL-3.0
URL: https://github.com/mr-karan/doggo
Source0: %{name}-%{version}.tar
Source1: vendor.tar.xz
BuildRequires: golang(API) >= 1.20
Suggests: %{name}-fish-completion
Suggests: %{name}-zsh-completion
%description
doggo is a modern command-line DNS client (like dig) implemented in Go.
It outputs information in a neat concise manner and supports protocols
like DoH, DoT, DoQ, and DNSCrypt as well.
%package fish-completion
Summary: fish completion for %{name}
Group: System/Shells
Requires: fish-completion
Supplements: (%{name} and fish-completion)
BuildArch: noarch
%description fish-completion
fish completion scripts for %{name}
%package zsh-completion
Summary: zsh completion for %{name}
Group: System/Shells
Requires: zsh-completion
Supplements: (%{name} and zsh-completion)
BuildArch: noarch
%description zsh-completion
zsh completion scripts for %{name}
%prep
%autosetup -a1
%build
%ifnarch ppc64
export GOFLAGS="-buildmode=pie"
%endif
go build ./cmd/%{name}
go build ./cmd/api
%install
install -d %{buildroot}%{_bindir}
install -D %{name} %{buildroot}%{_bindir}/%{name}
install -D api %{buildroot}%{_bindir}/%{name}-api
install -Dm644 completions/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}
install -Dm644 completions/%{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
%files
%license LICENSE
%doc README.md
%doc config-api-sample.toml
%{_bindir}/%{name}
%{_bindir}/%{name}-api
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%files fish-completion
%{_datadir}/fish/vendor_completions.d/%{name}
%files zsh-completion
%{_datadir}/zsh/site-functions/_%{name}
%changelog