File postgresql-jdbc.spec of Package postgresql-jdbc

#
# spec file for package postgresql-jdbc
#
# Copyright (c) 2015 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/
#


%define         buildnum 1201
Name:           postgresql-jdbc
Version:        9.4
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}-%{buildnum}.src.tar.gz
# Original build.xml without maven
Source1:        build.xml
Patch0:         jdbc-postgresql-9.4_p1201-remove-sspi.patch
BuildRequires:  ant
BuildRequires:  java-devel
BuildRequires:  javapackages-tools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%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 3
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 -n %{name}-%{version}-%{buildnum}.src
%patch0 -p1
# remove all third party jars
find . -iname '*.jar' | xargs rm -rf

# replace the build script
cp -f %{SOURCE1} build.xml

# remove NTDSAPI class
rm -f org/postgresql/sspi/NTDSAPI.java
rm -f org/postgresql/sspi/NTDSAPIWrapper.java
rm -f org/postgresql/sspi/SSPIClient.java

%build
ant

# build the public api
ant publicapi

%install
%if 0%{?suse_version} == 1110
export NO_BRP_CHECK_BYTECODE_VERSION=true
%endif

# create directory for installing the jars
install -d -m 755 %{buildroot}%{_javadir}
install -m 655 $RPM_BUILD_DIR/%{name}-%{version}-%{buildnum}.src/jars/postgresql.jar \
 %{buildroot}/%{_javadir}/%{name}-%{version}.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 build/publicapi/* %{buildroot}%{_javadocdir}/%{name}

%files
%defattr(-,root,root,0755)
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar

%files javadoc
%defattr(-,root,root)
%{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by