summaryrefslogtreecommitdiff
path: root/pcr/mysql-jdbc/PKGBUILD
blob: 16c46a53eb5ce9f376db9e0e6a90c9150da46c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_libname=mysql-connector-java
pkgname=mysql-jdbc
pkgver=5.1.39
pkgrel=1.parabola1
pkgdesc='The official JDBC driver for MySQL'
arch=('any')
url='https://dev.mysql.com/downloads/connector/j/'
license=('GPL2')
depends=('java-runtime')
makedepends=('apache-ant' 'java-environment=8' 'jh' 'slf4j')
install=mysql-jdbc.install
source=("https://cdn.mysql.com/Downloads/Connector-J/${_libname}-$pkgver.tar.gz"
        'mysql-connector-java-fix_build.patch'
        'mysql-connector-java-java6_compilation.patch')
md5sums=('c8988d4fc6e44364a2f51efe5b5139c1'
         'c0273ce1c1257119bfa5a1485c382610'
         '784dce5d9e81f365c16cd710797173ae')

prepare() {
  cd "$srcdir/${_libname}-$pkgver"
  rm -v {,src/lib/}*.jar
  rm -v src/lib/*.zip
  rm -rv docs
  patch -Np1 -i "$srcdir/mysql-connector-java-fix_build.patch"
  patch -Np1 -i "$srcdir/mysql-connector-java-java6_compilation.patch"
  ln -sf /usr/share/java/slf4j-api.jar src/lib/slf4j-api.jar
}

build() {
  cd "$srcdir/${_libname}-$pkgver"
  ant \
    -Dcom.mysql.jdbc.jdk5.javac=/usr/lib/jvm/java-8-openjdk/bin/javac \
    -Dcom.mysql.jdbc.jdk8.javac=/usr/lib/jvm/java-8-openjdk/bin/javac \
    -Dsnapshot.version= \
    -Dant.java.version=1.5 \
    -Dant.build.javac.source=1.6 \
    -Dant.build.javac.target=1.7
}

package() {
  cd "$srcdir/${_libname}-$pkgver"

  # Install license file
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  # Install Maven artifacts
  export DESTDIR="$pkgdir"
  jh mvn-install mysql mysql-connector-java $pkgver \
    "build/${_libname}-$pkgver/doc/sources/pom.xml" \
    "build/${_libname}-$pkgver/${_libname}-$pkgver-bin.jar" \
    "${_libname}-$pkgver.jar"
  ln -s "/usr/share/java/${_libname}-$pkgver.jar" \
    "$pkgdir/usr/share/java/${_libname}.jar"
  ln -s "/usr/share/java/${_libname}-$pkgver.jar" \
    "$pkgdir/usr/share/java/mysql.jar"

  install -d "$pkgdir/usr/share/java/$pkgname"
  ln -s "/usr/share/java/${_libname}-$pkgver.jar" \
    "$pkgdir/usr/share/java/$pkgname/${_libname}.jar"
}