openocd-0.8.0.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 parport +usb verbose-io"
  22. RESTRICT="strip" # includes non-native binaries
  23. RDEPEND=">=dev-lang/jimtcl-0.75
  24. cmsis-dap? ( dev-libs/hidapi )
  25. usb? (
  26. virtual/libusb:0
  27. virtual/libusb:1
  28. )
  29. ftdi? ( dev-embedded/libftdi:= )"
  30. DEPEND="${RDEPEND}
  31. virtual/pkgconfig"
  32. pkg_setup() {
  33. enewgroup plugdev
  34. }
  35. src_prepare() {
  36. epatch_user
  37. # jimtcl-0.75 compatibility. Remove it on the
  38. # next version bump
  39. epatch "${FILESDIR}"/${P}-jimtcl-0.75.patch
  40. if [[ ${PV} == "9999" ]] ; then
  41. AT_NO_RECURSIVE=yes eautoreconf
  42. fi
  43. }
  44. src_configure() {
  45. # Here are some defaults
  46. local myconf=(
  47. --enable-buspirate
  48. --disable-werror
  49. --disable-internal-jimtcl
  50. --enable-amtjtagaccel
  51. --enable-ep93xx
  52. --enable-at91rm9200
  53. --enable-gw16012
  54. --enable-oocd_trace
  55. --enable-arm-jtag-ew
  56. --enable-sysfsgpio
  57. --enable-bcm2835gpio
  58. )
  59. # Adapters requiring usb/libusb-1.X support
  60. if use usb; then
  61. myconf+=(
  62. --enable-aice
  63. --enable-usb-blaster-2
  64. --enable-ftdi
  65. --enable-ti-icdi
  66. --enable-ulink
  67. --enable-osbdm
  68. --enable-opendous
  69. --enable-usbprog
  70. --enable-jlink
  71. --enable-rlink
  72. --enable-stlink
  73. --enable-vsllink
  74. --enable-armjtagew
  75. $(use_enable verbose-io verbose-usb-io)
  76. $(use_enable verbose-io verbose_usb_comms)
  77. )
  78. else
  79. myconf+=(
  80. --disable-aice
  81. --disable-usb-blaster-2
  82. --disable-ftdi
  83. --disable-ti-icdi
  84. --disable-ulink
  85. --disable-osbdm
  86. --disable-opendous
  87. --disable-usbprog
  88. --disable-jlink
  89. --disable-rlink
  90. --disable-stlink
  91. --disable-vsllink
  92. --disable-armjtagew
  93. )
  94. fi
  95. if use ftdi; then
  96. myconf+=(
  97. --enable-usb_blaster_libftdi
  98. --enable-openjtag_ftdi
  99. --enable-presto_libftdi
  100. )
  101. else
  102. myconf+=(
  103. --disable-openjtag_ftdi
  104. --disable-presto_libftdi
  105. --disable-usb_blaster_libftdi
  106. )
  107. fi
  108. econf \
  109. $(use_enable dummy) \
  110. $(use_enable cmsis-dap) \
  111. $(use_enable parport) \
  112. $(use_enable parport parport_ppdev) \
  113. $(use_enable verbose-io verbose-jtag-io) \
  114. "${myconf[@]}"
  115. }
  116. src_install() {
  117. default
  118. env -uRESTRICT prepstrip "${ED}"/usr/bin "${ED}"/usr/$(get_libdir)
  119. udev_dorules "${D}"/usr/share/${PN}/contrib/*.rules
  120. }
  121. pkg_postinst() {
  122. elog "To access openocd devices as user you must be in the plugdev group"
  123. }