openocd-0.10.0.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils multilib flag-o-matic toolchain-funcs udev user
  5. # One ebuild to rule them all
  6. if [[ ${PV} == "9999" ]] ; then
  7. inherit autotools git-2
  8. EGIT_REPO_URI="git://git.code.sf.net/p/${PN}/code"
  9. EGIT_PROJECT="${PN}"
  10. else
  11. MY_PV="${PV/_/-}"
  12. MY_P="${PN}-${MY_PV}"
  13. S="${WORKDIR}"/${MY_P}
  14. KEYWORDS="~amd64 ~arm ~x86"
  15. SRC_URI="mirror://sourceforge/project/${PN}/${PN}/${MY_PV}/${MY_P}.tar.gz"
  16. fi
  17. DESCRIPTION="OpenOCD - Open On-Chip Debugger"
  18. HOMEPAGE="http://openocd.sourceforge.net"
  19. LICENSE="GPL-2+"
  20. SLOT="0"
  21. IUSE="+cmsis-dap dummy +ftdi +jlink parport +usb verbose-io"
  22. RESTRICT="strip" # includes non-native binaries
  23. RDEPEND=">=dev-lang/jimtcl-0.76
  24. cmsis-dap? ( dev-libs/hidapi )
  25. jlink? ( dev-embedded/libjaylink )
  26. usb? (
  27. virtual/libusb:0
  28. virtual/libusb:1
  29. )
  30. ftdi? ( dev-embedded/libftdi:= )"
  31. DEPEND="${RDEPEND}
  32. virtual/pkgconfig"
  33. [[ ${PV} == "9999" ]] && DEPEND+=" >=sys-apps/texinfo-5" #549946
  34. pkg_setup() {
  35. enewgroup plugdev
  36. }
  37. src_prepare() {
  38. epatch_user
  39. if [[ ${PV} == "9999" ]] ; then
  40. AT_NO_RECURSIVE=yes eautoreconf
  41. fi
  42. }
  43. src_configure() {
  44. # Here are some defaults
  45. local myconf=(
  46. --enable-buspirate
  47. --disable-werror
  48. --disable-internal-jimtcl
  49. --disable-internal-libjaylink
  50. --enable-amtjtagaccel
  51. --enable-ep93xx
  52. --enable-at91rm9200
  53. --enable-gw16012
  54. --enable-arm-jtag-ew
  55. --enable-sysfsgpio
  56. --enable-bcm2835gpio
  57. )
  58. # Adapters requiring usb/libusb-1.X support
  59. if use usb; then
  60. myconf+=(
  61. --enable-aice
  62. --enable-usb-blaster-2
  63. --enable-ftdi
  64. --enable-ti-icdi
  65. --enable-ulink
  66. --enable-osbdm
  67. --enable-opendous
  68. --enable-usbprog
  69. --enable-rlink
  70. --enable-stlink
  71. --enable-vsllink
  72. --enable-armjtagew
  73. $(use_enable verbose-io verbose-usb-io)
  74. $(use_enable verbose-io verbose_usb_comms)
  75. )
  76. else
  77. myconf+=(
  78. --disable-aice
  79. --disable-usb-blaster-2
  80. --disable-ftdi
  81. --disable-ti-icdi
  82. --disable-ulink
  83. --disable-osbdm
  84. --disable-opendous
  85. --disable-usbprog
  86. --disable-rlink
  87. --disable-stlink
  88. --disable-vsllink
  89. --disable-armjtagew
  90. )
  91. fi
  92. if use jlink; then
  93. myconf+=(
  94. --enable-jlink
  95. )
  96. else
  97. myconf+=(
  98. --disable-jlink
  99. )
  100. fi
  101. if use ftdi; then
  102. myconf+=(
  103. --enable-usb-blaster
  104. --enable-openjtag
  105. --enable-presto
  106. )
  107. else
  108. myconf+=(
  109. --disable-openjtag
  110. --disable-presto
  111. --disable-usb-blaster
  112. )
  113. fi
  114. econf \
  115. $(use_enable dummy) \
  116. $(use_enable cmsis-dap) \
  117. $(use_enable parport) \
  118. $(use_enable parport parport_ppdev) \
  119. $(use_enable verbose-io verbose-jtag-io) \
  120. "${myconf[@]}"
  121. }
  122. src_install() {
  123. default
  124. env -uRESTRICT prepstrip "${ED}"/usr/bin
  125. udev_dorules "${D}"/usr/share/${PN}/contrib/*.rules
  126. }
  127. pkg_postinst() {
  128. elog "To access openocd devices as user you must be in the plugdev group"
  129. }