openocd-0.6.1.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. inherit eutils multilib flag-o-matic toolchain-funcs
  5. if [[ ${PV} == "9999" ]] ; then
  6. inherit autotools git-2
  7. KEYWORDS=""
  8. EGIT_REPO_URI="git://git.code.sf.net/p/${PN}/code"
  9. EGIT_PROJECT="${PN}"
  10. else
  11. KEYWORDS="~amd64 ~x86"
  12. SRC_URI="mirror://sourceforge/project/${PN}/${PN}/${PV}/${P}.tar.bz2"
  13. fi
  14. DESCRIPTION="OpenOCD - Open On-Chip Debugger"
  15. HOMEPAGE="http://openocd.sourceforge.net"
  16. LICENSE="GPL-2"
  17. SLOT="0"
  18. IUSE="blaster dummy ftd2xx ftdi minidriver parport presto segger stlink usb versaloon"
  19. RESTRICT="strip" # includes non-native binaries
  20. # libftd2xx is the default because it is reported to work better.
  21. DEPEND=">=dev-lang/jimtcl-0.73
  22. usb? ( virtual/libusb:0 )
  23. presto? ( dev-embedded/libftd2xx )
  24. ftd2xx? ( dev-embedded/libftd2xx )
  25. ftdi? ( dev-embedded/libftdi )"
  26. RDEPEND="${DEPEND}"
  27. REQUIRED_USE="blaster? ( || ( ftdi ftd2xx ) ) ftdi? ( !ftd2xx )"
  28. src_prepare() {
  29. if [[ ${PV} == "9999" ]] ; then
  30. sed -i -e "/@include version.texi/d" doc/${PN}.texi || die
  31. AT_NO_RECURSIVE=yes eautoreconf
  32. fi
  33. # Disable craptastic build settings.
  34. sed -i \
  35. -e 's:if test "[$]OCDxprefix" != "[$]ac_default_prefix":if false:' \
  36. configure || die
  37. if use ftdi ; then
  38. local pc="libftdi$(has_version dev-embedded/libftdi:1 && echo 1)"
  39. # Use libftdi-1 paths #460916
  40. local libs=$($(tc-getPKG_CONFIG) --libs ${pc})
  41. sed -i \
  42. -e "s:-lftdi -lusb:${libs}:" \
  43. configure src/Makefile.in || die
  44. append-cppflags $($(tc-getPKG_CONFIG) --cflags ${pc})
  45. fi
  46. }
  47. src_configure() {
  48. # Here are some defaults
  49. local myconf=(
  50. --enable-buspirate
  51. --enable-ioutil
  52. --disable-werror
  53. --disable-internal-jimtcl
  54. --enable-amtjtagaccel
  55. --enable-ep93xx
  56. --enable-at91rm9200
  57. --enable-gw16012
  58. --enable-oocd_trace
  59. )
  60. if use usb; then
  61. myconf+=(
  62. --enable-usbprog
  63. --enable-jlink
  64. --enable-rlink
  65. --enable-vsllink
  66. --enable-arm-jtag-ew
  67. )
  68. fi
  69. # add explicitely the path to libftd2xx
  70. use ftd2xx && append-ldflags -L/opt/$(get_libdir)
  71. if use blaster; then
  72. use ftdi && myconf+=( --enable-usb_blaster_libftdi )
  73. use ftd2xx && myconf+=( --enable-usb_blaster_ftd2xx )
  74. fi
  75. econf \
  76. $(use_enable dummy) \
  77. $(use_enable ftdi ft2232_libftdi) \
  78. $(use_enable ftd2xx ft2232_ftd2xx) \
  79. $(use_enable minidriver minidriver-dummy) \
  80. $(use_enable parport) \
  81. $(use_enable presto presto_ftd2xx) \
  82. $(use_enable stlink) \
  83. $(use_enable segger jlink) \
  84. $(use_enable versaloon vsllink) \
  85. "${myconf[@]}"
  86. }
  87. src_install() {
  88. default
  89. env -uRESTRICT prepstrip "${ED}"/usr/bin "${ED}"/usr/$(get_libdir)
  90. }