summaryrefslogtreecommitdiff
path: root/java/java-rxtx/PKGBUILD
blob: 4fcabe2a414f6ba8138d3a3a0cf6dbb1d15a1eb2 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Maintainer (Parabola): Luke Shumaker <lukeshu@sbcglobal.net>

_pkgver=2.1-7r2-arduino4
_gitver='commit=a8cd90f8505d7c472b57550b1192fe67885dd638'

####

pkgname=java-rxtx
pkgver=${_pkgver//-/.}
pkgdesc="A native library providing serial and parallel communication for Java"
license=(LGPL2.1)

pkgrel=3
arch=('i686' 'x86_64')
depends=('java-runtime')
makedepends=('java-environment' 'pacman>4.0.3')

case "$_pkgver" in
    *arduino*)
	url="https://github.com/arduino/RXTX"
	source=("git://github.com/arduino/RXTX.git#${_gitver}")
	md5sums=('SKIP')
	_dirname=RXTX
	;;
    *)
	url="http://rxtx.qbang.org/"
	source=("http://rxtx.qbang.org/pub/rxtx/rxtx-${_pkgver}.zip")
	md5sums=('9290b4832d46199f8d798a531209640b')
	_dirname=rxtx-{$_pkgver}
	;;
esac

source+=(
  0000-configure-java-version.patch
  0001-makefile-destdir.patch
  0002-makefile-javadoc-dir.patch
  0003-lockdir-location.patch
  GroupMembership.txt)

md5sums+=('a36caaca717018341d69605f962d1c2a'
          '39c88043032de742c6b51d90a26eee2c'
          'a910e0c75a9c687d2b2f782e3d9982e3'
          '19b19c2514bce563be2a812888e1d9b4'
          '9dc461eab358e3b78c4b688977997116')

_MAKEFLAGS=('JHOME=/usr/share/java' 'RXTX_PATH=/usr/lib')

_changelog() {
  t="`echo -e '\t'`"
  
  # Parabola changes
  ls "$srcdir"/*.patch | sort -r | while read file; do
    echo "${file##*/}"
    sed "1s/./$t$t&/;1q" "$file"
  done

  # Arduino changes
  if [[ -d "$srcdir/$_dirname/.git" ]]; then
    pushd "$srcdir/$_dirname" > /dev/null
    git log --pretty=format:"%h %ad%n$t$t%s" --date=short|head -n-2
    popd > /dev/null
  fi

  # RXTX ChangeLog
  grep "^[0-9 $t]" "$srcdir/$_dirname/ChangeLog"
}

build() {
  _changelog > "$srcdir/ChangeLog.txt"
  cd "$srcdir/$_dirname"
  . /etc/profile.d/jdk.sh

  patch -Np1 -i "$srcdir/0000-configure-java-version.patch" # requires autogen
  patch -Np1 -i "$srcdir/0001-makefile-destdir.patch" # requires autogen
  patch -Np1 -i "$srcdir/0002-makefile-javadoc-dir.patch" # requires autogen
  patch -Np1 -i "$srcdir/0003-lockdir-location.patch"
  rm *.m4 && ./autogen.sh

  ./configure --prefix=/usr
  make "${_MAKEFLAGS[@]}" all docs
}

package() {
  cd "$srcdir/$_dirname"
  . /etc/profile.d/jdk.sh

  make "${_MAKEFLAGS[@]}" DESTDIR="$pkgdir" install

  install -d "$pkgdir/usr/share/doc/$pkgname/"
  install -m644 "$srcdir/ChangeLog.txt" "$pkgdir/usr/share/doc/$pkgname/"
  install -m644 "$srcdir/GroupMembership.txt" "$pkgdir/usr/share/doc/$pkgname/"
  cp -r javadoc "$pkgdir/usr/share/doc/$pkgname/"
}