summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a20aee4dbcfd934db0e5c730dee95fcca9da07f9 (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
# Michael J. Pento <mjpento@verizon.net>
# Maintainer: Will Price <willprice94+arch@gmail.com>
# Contributor: Andrew67 (.desktop file, icon, 64bit compatibility)

pkgname=energia
pkgver=1.8.7E21
pkgrel=5
pkgdesc="Energia is a Arduino IDE clone for use with the MSP430 launchpad"
arch=('x86_64')
url="http://energia.nu/"
license=('GPL')
depends=('java-environment' 'java-rxtx' 'libusb-compat' 'gcc-libs-multilib')
provides=('energia')
# staticlibs keeps all *.a files which are necessary since we bundle a toolchain
# !strip disable stripping of debug symbols which are useful
options=(!strip staticlibs)
install='energia.install'
source=('energia.desktop'
        '71-ti-permissions.rules'
        "${pkgname}-${pkgver}.tar.xz::http://energia.nu/downloads/downloadv4.php?file=energia-${pkgver}-linux64.tar.xz")
md5sums=('a7ce061d9fc0f9530e058204e532b40b'
         '8633ff7228aed033d9c9befb82581af9'
         '74c5721079981e93ee74d09b3fda3c2d')

# Don't compress, takes too long
PKGEXT='.pkg.tar'

package() {
  _copy_src
  _link_binary_to_bin
  _patch_package_for_lock_issues
  _add_menu_entry_and_icon
  (_support_fhs)
}


_copy_src() {
  mkdir -p "$pkgdir"{/etc/{tmpfiles.d,udev/rules.d},/opt/energia,/usr/{bin,share/{applications,pixmaps,doc}}}

  # --archive copies recursively, preserves permissions and links
  cp --archive "${srcdir}/${pkgname}-${pkgver}/." \
               "$pkgdir/opt/energia"
}

_patch_package_for_lock_issues() {
  ln -sf /usr/lib/librxtxSerial.so \
         "$pkgdir/opt/energia/lib/librxtxSerial.so"
  ln -sf /usr/share/java/rxtx/RXTXcomm.jar \
         "$pkgdir/opt/energia/lib/RXTXcomm.jar"
  install -m755 "$srcdir/71-ti-permissions.rules" \
                "$pkgdir/etc/udev/rules.d/"
}

_link_binary_to_bin() {
  ln -s /opt/energia/energia \
        "$pkgdir/usr/bin/"
}

_add_menu_entry_and_icon() {
  install -m755 "$srcdir/energia.desktop" \
                "$pkgdir/usr/share/applications/"
  install -m755 "$pkgdir/opt/energia/lib/arduino.png" \
                "$pkgdir/usr/share/pixmaps/energia.png"
}

_support_fhs() {
  # To some extent ;)
  cd "$pkgdir/usr/share/doc"
  ln -s /opt/energia/reference energia
}