summaryrefslogtreecommitdiff
path: root/java/arduino/PKGBUILD
blob: 426664a372b7176f483f0b7b2a92cd57aae62b4d (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
101
# Maintainer: PyroPeter <googlemail.com@abi1789>

pkgname=arduino
pkgver=1.0.1
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 jh)
install="arduino.install"
source=("http://arduino.googlecode.com/files/arduino-$pkgver-src.tar.gz"
	'sig-patch.diff'
	'arduino.png'
	'arduino.desktop')

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

mksource() {
  cd "$srcdir/arduino-$pkgver"
  find . -name '*.jar' -delete
  find . -name '*.swp' -delete
  find . -name '*.so' -delete
  rm -rf build/linux/dist/*/*
}

build() {
  cd "$srcdir/arduino-$pkgver"
  eval `jh mksource build/shared/reference.zip`

  cd "$srcdir"
  mkdir empty.d
  cd empty.d
  bsdtar cjf ../empty.tar.bz2 .
  cd ..
  rmdir empty.d

  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/sig-patch.diff"

  #ln -s /.../RXTXcomm.jar app/lib # already on the classpath
  ln -s /usr/share/java/antlr2.jar app/lib/antlr.jar
  #ln -s /.../apple.jar app/lib # only used on Mac OS
  ln -s /usr/share/java/ecj.jar app/lib
  ln -s /usr/share/java/jna.jar app/lib
  ln -s /usr/bin/avrdude build/linux/dist/tools

  ln -s "$srcdir/empty.tar.bz2" build/linux/avr_tools_linux32.tar.bz2
  ln -s "$srcdir/empty.tar.bz2" build/linux/avr_tools_linux64.tar.bz2

  for d in methods preproc; do
      cd "$srcdir/arduino-$pkgver/core/$d"
      ant
  done

  cd "$srcdir/arduino-$pkgver/build"

  log=`mktemp`
  ant 2>&1|tee "$log"
  if egrep -q 'Error|FAILED' "$log"; then
      rm "$log"
      false
  else
      rm "$log"
  fi
}

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

  # arduino excutable should accept arguments
  sed -i 's|^java .* processing.app.Base$|\0 "$@"|' arduino
  sed -i 's|^APPDIR=.*|APPDIR=/usr/share/arduino|' arduino

  mkdir -p "$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:
  install -m755 "arduino" "$pkgdir/usr/bin/arduino"
  ln -s /usr/share/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=('03263613f4be4f865989244420be04fa'
         'acadc724cbe08c09711825f4bd5c04f6'
         '9e36d33891d5e68d38ec55d1494499a5'
         'eebc4d6495864bea99ad057af801afb9')