aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/open-ocd.rb
blob: 494e0fa12cbf2067bd15df63faf5c6bdbd01def4 (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
require 'formula'

class OpenOcd < Formula
  homepage 'http://sourceforge.net/projects/openocd/'
  url 'http://downloads.sourceforge.net/project/openocd/openocd/0.6.1/openocd-0.6.1.tar.bz2'
  sha1 'b286dd9c0c6ca5cc7a76d25e404ad99a488e2c61'

  option 'enable-ft2232_libftdi', 'Enable building support for FT2232 based devices with libftdi driver'
  option 'enable-ft2232_ftd2xx',  'Enable building support for FT2232 based devices with FTD2XX driver'

  depends_on 'libusb-compat'
  depends_on 'libftdi' if build.include? 'enable-ft2232_libftdi'

  # Per MacPorts, remove -gstabs, which is not supported by clang.
  def patches
    {:p0 => [
      "https://trac.macports.org/export/105669/trunk/dports/cross/openocd/files/patch-jimctl-configure.diff"
    ]}
  end

  def install
    # default options that don't imply additional dependencies
    args = %W[
      --enable-ftdi
      --enable-arm-jtag-ew
      --enable-jlink
      --enable-rlink
      --enable-stlink
      --enable-ulink
      --enable-usbprog
      --enable-vsllink
      --enable-ep93xx
      --enable-at91rm9200
      --enable-ecosboard
      --enable-opendous
      --enable-osbdm
      --enable-buspirate
    ]

    if build.include? "enable-ft2232_libftdi"
      args << "--enable-ft2232_libftdi"
      args << "--enable-presto_libftdi"
      args << "--enable-usb_blaster_libftdi"
    end

    if build.include? "enable-ft2232_ftd2xx"
      args << "--enable-ft2232_ftd2xx"
      args << "--enable-presto_ftd2xx"
    end

    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          *args
    system "make install"
  end
end