File postgresql-jdbc.spec of Package postgresql-jdbc

#
# spec file for package postgresql-jdbc
#
# 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:           postgresql-jdbc
Version:        42.2.5
Release:        0
Summary:        Official JDBC Driver for PostgreSQL
License:        BSD-3-Clause
Group:          Development/Languages/Java
Url:            http://jdbc.postgresql.org
Source0:        http://jdbc.postgresql.org/download/%{name}-%{version}.src.tar.gz
Source1:        build.sh
#PATCH-FIX-OPENSUSE: don't fail build on warning
Patch0:         javadoc-pom-xml.patch
BuildRequires:  fdupes
BuildRequires:  java-devel >= 1.8
BuildRequires:  postgresql-jdbc-kit == e0e09f0da27006c0b7285a52b80c269c49c4be92
BuildRequires:  xz
BuildArch:      noarch
Provides:       mvn(:pgjdbc) == 42.2.5
Requires:       java >= 1.8

%description
PostgreSQL JDBC Driver allows Java programmers to connect to a PostgreSQL
database using standard, database independent Java code.

The driver provides are reasonably complete implementation of the JDBC 4
specification in addition to some PostgreSQL specific extensions.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Libraries/Java

%description javadoc
PostgreSQL JDBC Driver API documentation.

%prep
%setup -q -c -n src
%patch0 -p1
cp -f %{SOURCE1} .
cp -Rf %{_datadir}/tetra ../kit

%build
cd ..
sh src/build.sh

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
# create directory for installing the jars
install -d -m 755 %{buildroot}%{_javadir}
cp -a postgresql-jdbc-42.2-5.src/pgjdbc/target/original-postgresql-42.2.5.jar %{buildroot}%{_javadir}/original-postgresql-jdbc-42.2.5.jar
cp -a postgresql-jdbc-42.2-5.src/pgjdbc/target/postgresql-42.2.5.jar %{buildroot}%{_javadir}/postgresql-jdbc-42.2.5.jar

(cd %{buildroot}/%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)

# javadoc
install -d -m 755 %{buildroot}/%{_javadocdir}/%{name}
cp -pr postgresql-jdbc-42.2-5.src/pgjdbc/target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}

%files
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/original-%{name}-%{version}.jar
%{_javadir}/original-%{name}.jar

%files javadoc
%{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by