spacepaste

  1.  
  2. # Copyright 1999-2015 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # $Id$
  5. EAPI=5
  6. JAVA_PKG_IUSE="doc examples"
  7. inherit eutils java-pkg-2 java-ant-2
  8. MY_P="Arduino"
  9. PNS="arduino"
  10. DESCRIPTION="An open-source AVR electronics prototyping platform"
  11. HOMEPAGE="http://arduino.cc/ https://arduino.googlecode.com/"
  12. SRC_URI="https://github.com/arduino/${MY_P}/archive/${PV}.tar.gz -> ${P}.tar.gz
  13. mirror://gentoo/arduino-icons.tar.bz2"
  14. LICENSE="GPL-2 GPL-2+ LGPL-2 CC-BY-SA-3.0"
  15. SLOT="0"
  16. KEYWORDS="~amd64 ~x86"
  17. RESTRICT="strip binchecks"
  18. IUSE=""
  19. COMMONDEP="
  20. dev-java/jna:0
  21. >dev-java/rxtx-2.1:2"
  22. RDEPEND="${COMMONDEP}
  23. dev-embedded/arduino-libs
  24. dev-embedded/avrdude
  25. sys-devel/crossdev
  26. >=virtual/jre-1.8"
  27. DEPEND="${COMMONDEP}
  28. >=virtual/jdk-1.8"
  29. S="${WORKDIR}/${MY_P}-${PV}"
  30. EANT_GENTOO_CLASSPATH="jna,rxtx-2"
  31. EANT_EXTRA_ARGS="-Dversion=${PV}"
  32. EANT_BUILD_TARGET="build"
  33. JAVA_ANT_REWRITE_CLASSPATH="yes"
  34. java_prepare() {
  35. # Patch launcher script to include rxtx class/ld paths
  36. epatch "${FILESDIR}/${P}-script.patch"
  37. }
  38. src_compile() {
  39. eant -f arduino-core/build.xml
  40. EANT_GENTOO_CLASSPATH_EXTRA="../core/core.jar"
  41. eant -f app/build.xml
  42. eant "${EANT_EXTRA_ARGS}" -f build/build.xml
  43. }
  44. src_install() {
  45. cd "${S}"/build/linux/work || die
  46. java-pkg_dojar lib/*.jar
  47. java-pkg_dolauncher ${PNS} --pwd /usr/share/${PNS} --main processing.app.Base
  48. if use examples; then
  49. java-pkg_doexamples examples
  50. docompress -x /usr/share/doc/${P}/examples/
  51. fi
  52. if use doc; then
  53. dodoc revisions.txt "${S}"/README.md
  54. dohtml -r reference
  55. fi
  56. insinto "/usr/share/${PNS}/"
  57. #doins -r hardware libraries tools tools-builder dist
  58. doins -r tools tools-builder dist
  59. #fowners -R root:uucp "/usr/share/${PNS}/hardware"
  60. insinto "/usr/share/${PNS}/lib"
  61. doins -r lib/*.txt lib/theme lib/*.png lib/*.bmp lib/*.key lib/*.so lib/*.ico lib/*.conf
  62. # install menu and icons
  63. sed -e 's/Exec=FULL_PATH\/arduino/Exec=arduino/g' -i arduino.desktop
  64. sed -e 's/Icon=FULL_PATH\/lib\/arduino.png/Icon=arduino/g' -i arduino.desktop
  65. sed -e 's/x-arduino/x-arduino;/g' -i arduino.desktop
  66. domenu "${PNS}.desktop"
  67. for sz in 16 24 32 48 128 256; do
  68. newicon -s $sz \
  69. "${WORKDIR}/${PNS}-icons/debian_icons_${sz}x${sz}_apps_${PNS}.png" \
  70. "${PNS}.png"
  71. done
  72. }
  73. pkg_postinst() {
  74. [ ! -x /usr/bin/avr-g++ ] && ewarn "Missing avr-g++; you need to crossdev -s4 avr"
  75. elog "I have *NOT* tested if this ebuild even works, because I don't use it myself."
  76. elog "If you encounter issues with the installation, please report them to me, and"
  77. elog "I will try my best to fix them."
  78. }
  79.