mysql-connector-java/mysql-connector-java.spec

140 lines
4.2 KiB
RPMSpec

#
# spec file for package mysql-connector-java
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#
# icecream 0
Name: mysql-connector-java
Version: 5.1.19
Release: 0
Summary: Official JDBC Driver for MySQL
License: GPL-2.0+
Group: Development/Libraries/Java
Url: http://www.mysql.com/downloads/api-jdbc-stable.html
# docs are now under very strict proprietary license by Oracle, so lets not distribute them
# remove bundled jars as well
# tar -xf %{name}-%{version}.tar.gz
# rm -rf %{name}-%{version}/docs
# find %{name}-%{version} -name '*jar' -delete
# tar -xJf %{name}-%{version}-suse.tar.xz
Source0: %{name}-%{version}-suse.tar.xz
# Patch to build with JDBC 4.1/Java 7
Patch0: mysql-connector-java-5.1.19-java7.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: ant
BuildRequires: ant-contrib
BuildRequires: apache-commons-logging
BuildRequires: java-1_5_0-gcj-compat-devel
BuildRequires: java-devel
BuildRequires: jta
BuildRequires: junit
BuildRequires: slf4j
#!BuildIgnore: maven2-bootstrap
BuildRequires: log4j-mini
Requires: jta >= 1.0
Requires: log4j
Requires: slf4j
Provides: mm.mysql = %{version}
Obsoletes: mm.mysql < %{version}
# manual is no longer distributed
Provides: %{name}-manual = %{version}
Obsoletes: %{name}-manual < %{version}
%description
MySQL Connector/J is a native Java driver that converts JDBC (Java
Database Connectivity) calls into the network protocol used by the
MySQL database. It lets developers working with the Java programming
language easily build programs and applets that interact with MySQL and
connect all corporate data, even in a heterogeneous environment. MySQL
Connector/J is a Type IV JDBC driver and has a complete JDBC feature
set that supports the capabilities of MySQL.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
# dup
rm -f README
# wrong end of line encoding
sed -i -e 's/.$//' README.txt
%build
# disable jboss integration
rm -rf src/com/mysql/jdbc/integration/jboss
rm src/testsuite/regression/ConnectionRegressionTest.java
rm src/testsuite/regression/DataSourceRegressionTest.java
rm src/testsuite/simple/ReadOnlyCallableStatementTest.java
rm src/testsuite/simple/jdbc4/StatementsTest.java
export CLASSPATH=$(build-classpath \
ant-contrib \
commons-logging \
slf4j \
jdbc-stdext\
jta \
junit \
log4j)
# we need jdk5 for jdbc3.0
# XXX: JAVA_HOME must be setup **after** CLASSPATH
export JAVA_HOME=%{_libdir}/jvm/java-1.5.0-gcj
ant -DbuildDir=build-mysql-jdbc \
-DdistDir=dist-mysql-jdbc \
-Dcom.mysql.jdbc.java6.javac="%{javac}" \
-Dcom.mysql.jdbc.java6.java="%{java}" \
-Dcom.mysql.jdbc.java6.rtjar"=%{java_home}/jre/lib/rt.jar"
%install
install -d -m 755 %{buildroot}%{_javadir}
install ./build-mysql-jdbc/%{name}-%{version}-SNAPSHOT/%{name}-%{version}-SNAPSHOT-bin.jar \
%{buildroot}%{_javadir}/%{name}.jar
rm -rf %{buildroot}%{name}-%{version}/docs/release-test-output
# Install the Maven build information
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 src/doc/sources/pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
sed -i 's/>@.*</>%{version}</' %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_to_maven_depmap mysql %{name} %{version} JPP %{name}
%post
%update_maven_depmap
%postun
%update_maven_depmap
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%files
%defattr(0644,root,root,0755)
%doc CHANGES COPYING README.txt
%attr(0644,root,root) %{_javadir}/%{name}.jar
%config(noreplace) %{_mavendepmapfragdir}/*
%{_mavenpomdir}/*.pom
%changelog