File psqlODBC.spec of Package psqlODBC
#
# spec file for package psqlODBC
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: psqlODBC
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: openssl-devel
BuildRequires: postgresql-devel
BuildRequires: unixODBC-devel
Url: https://odbc.postgresql.org/
%define tarname psqlodbc
Summary: ODBC Driver for PostgreSQL
License: LGPL-2.1+
Group: Productivity/Databases/Clients
Version: 10.01.0000
Release: 0
Source0: https://ftp.postgresql.org/pub/odbc/versions/src/%tarname-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: /usr/bin/odbcinst
Obsoletes: pg_odbc
Obsoletes: postgresql-odbc
Provides: pg_iface:/usr/lib/pgsql/odbcinst.ini
Provides: pg_odbc
Provides: postgresql-odbc
%description
This package contains the ODBC (Open DataBase Connectivity) driver and
sample configuration files needed for applications to access a
PostgreSQL database using ODBC.
%prep
%setup -q -n %tarname-%version
%build
autoreconf -fi
# they don't ship configure.in, so we have to patch configure :(
sed -i '/LDFLAGS=/s/\$pg_libs//' configure
export CFLAGS="%optflags -fno-strict-aliasing -I/usr/include/pgsql"
%configure --with-unixodbc
%install
make DESTDIR=%buildroot install
rm -f %buildroot%_libdir/*.la
%post
/sbin/ldconfig
# odbcinst uses reference counting, so we don't
# need to take care for the update case here.
odbcinst -i -l -d %_libdir/psqlodbcw.so -r <<EOF
[PSQL]
Description = PostgreSQL
%ifarch x86_64 ppc64 ia64 s390x
Driver64 = %_libdir/psqlodbcw.so
%else
Driver = %_libdir/psqlodbcw.so
%endif
EOF
%postun
/sbin/ldconfig
# odbcinst uses reference counting, so we don't
# need to take care for the update case here.
odbcinst -u -l -d %_libdir/psqlodbcw.so -n PSQL
%files
%defattr(-,root,root,-)
%doc *.txt docs/*
%_libdir/psql*
%changelog