summaryrefslogtreecommitdiff
path: root/java/arduino/PKGBUILD
blob: 19ab118740aad9aa2e958e11b634a8c69dc58987 (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
94
95
96
97
98
99
100
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Maintainer (AUR): PyroPeter <googlemail.com@abi1789>

pkgname=arduino
pkgver=1.0.2
pkgrel=2
pkgdesc="Arduino SDK and IDE"
arch=('i686' 'x86_64')
url="http://arduino.cc/en/Main/Software"
options=(!strip)
license=('GPL')

depends=('avr-gcc' 'avr-libc' 'libusb-compat' 'java-runtime' 'avrdude'
    'java-rxtx' 'antlr2' 'eclipse-ecj' 'jna')
makedepends=(java-environment apache-ant)
install="arduino.install"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/arduino/Arduino/archive/${pkgver}.tar.gz"
	'avrlibc-signals.patch'
	'external-avrtools.patch'
	'arduino.png'
	'arduino.desktop')

unset _JAVA_OPTIONS
. /etc/profile.d/jre.sh

prepare() {
  cd "$srcdir/Arduino-$pkgver"
  find . -name '*.hex' -delete
  find . -name '*.jar' -delete
  find . -name '*.so'  -delete
  find . -name '*.swp' -delete
  rm -f build/linux/dist/tools/avrdude*
  rm -rf hardware/arduino/firmwares/wifishield
}

_link_jars() {
  for jar in rxtx/RXTXcomm.jar antlr2.jar ecj.jar jna.jar; do
    ln -sf /usr/share/java/$jar .
  done
}

_patch() {
  cd "$srcdir/Arduino-$pkgver"

  # Fix issue 955 to be compatible with newer versions of avr-libc
  # https://code.google.com/p/arduino/issues/detail?id=955
  # Note: this patch is not the patch given in the comments
  patch -Np1 -i "$srcdir/avrlibc-signals.patch"
  grep -rl 'SIGNAL\s*(' . | xargs sed -ri 's/SIGNAL\s*\(([^)]*_vect)\)/ISR(\1)/g'

  # Don't look for pre-compiled avr-tools
  patch -Np1 -i "$srcdir/external-avrtools.patch"

  rm -rf app/src/processing/app/macosx
  rm -rf app/src/processing/app/windows

  cd app/lib
  _link_jars
}

build() {
  _patch

  # build submodules
  for submodule in core/methods core/preproc; do
    cd "$srcdir/Arduino-$pkgver/$submodule"
    ant
  done

  # build the main package
  cd "$srcdir/Arduino-$pkgver/build"
  ant

  # symlink jar files to the system locations
  cd "linux/work/lib"
  _link_jars
}

package() {
  cd "$srcdir/Arduino-$pkgver/build/linux/work"

  install -d "$pkgdir"/usr/{bin,share/{doc,applications,pixmaps}}

  # copy the whole SDK to /usr/share/arduino/
  cp -r . "$pkgdir/usr/share/arduino"

  # at least support the FHS a little bit:
  ln -s ../share/arduino/arduino "$pkgdir/usr/bin/arduino"
  ln -s ../arduino/reference     "$pkgdir/usr/share/doc/arduino"

  # desktop icon
  install -m644 "$srcdir/arduino.desktop" "$pkgdir/usr/share/applications/"
  install -m644 "$srcdir/arduino.png" "$pkgdir/usr/share/pixmaps/"
}

md5sums=('9f3378b2b092f9c6e7f32a65231aad1c'
         'e44975d31aa1770e4f5ac6e6867b0864'
         '9c696c2361d57027be41ae64436182aa'
         '9e36d33891d5e68d38ec55d1494499a5'
         'eebc4d6495864bea99ad057af801afb9')