File usql.spec of Package usql

#
# spec file for package usql
#
# 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:           usql
Version:        0.15.2
Release:        0
Summary:        Universal command-line interface for SQL databases
License:        MIT
URL:            https://github.com/xo/usql
Source:         https://github.com/xo/usql/archive/refs/tags/v%{verion}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  golang-packaging
BuildRequires:  pkgconfig(odbc)
ExclusiveArch:  x86_64 s390x ppc64le aarch64
%{go_nostrip}
%description
usql is a universal command-line interface for PostgreSQL, MySQL, Oracle Database,
SQLite3, Microsoft SQL Server, and many other databases including NoSQL and
non-relational databases!

usql provides a simple way to work with SQL and NoSQL databases via a command-line
inspired by PostgreSQL's psql. usql supports most of the core psql features,
such as variables, backticks, backslash commands and has additional features that
psql does not, such as multiple database support, copying between databases, syntax
highlighting, and context-based completion.

Database administrators and developers that would prefer to work with a tool like
psql with non-PostgreSQL databases, will find usql intuitive, easy-to-use, and a
great replacement for the command-line clients/tools for other databases.

%prep
%autosetup -p1 -a 1

%build
CGO_ENABLED=1 \
go build -buildmode=pie -mod=vendor \
-tags=" \
  all \
  sqlite_app_armor \
  sqlite_fts5 \
  sqlite_introspect \
  sqlite_json1 \
  sqlite_math_functions \
  sqlite_stat4 \
  sqlite_userauth \
  sqlite_vtable \
" \
-ldflags=" \
  -X github.com/xo/usql/text.CommandName=%{name}
  -X github.com/xo/usql/text.CommandVersion=%{version}
"
./usql --command='\drivers'
./usql --version

%install
install -D -m 0755 usql %{buildroot}%{_bindir}/usql

%files
%license LICENSE
%doc *.md
%{_bindir}/usql

%changelog
openSUSE Build Service is sponsored by