aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/binwalk.rb
blob: 40a48c2258e791441fb3afc9d1a932257c34e9bd (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 Binwalk < Formula
  homepage 'http://binwalk.org/'
  url 'https://github.com/devttys0/binwalk/archive/v1.3.0.tar.gz'
  sha1 '6cab158b69e508081302305b354da12f45658272'

  head 'https://github.com/devttys0/binwalk.git'

  option 'with-matplotlib', 'Check for presence of matplotlib, which is required for entropy graphing support'

  depends_on 'swig' => :build
  depends_on :fortran
  depends_on 'libmagic' => 'with-python'
  depends_on 'matplotlib' => :python if build.with? 'matplotlib'
  depends_on 'pyside'
  depends_on :python

  resource 'pyqtgraph' do
    url 'http://www.pyqtgraph.org/downloads/pyqtgraph-0.9.8.tar.gz'
    sha1 '4ea6891f562c09ff13555ccb33fe05c315a70cf1'
  end

  resource 'numpy' do
    url 'http://downloads.sourceforge.net/project/numpy/NumPy/1.8.0/numpy-1.8.0.tar.gz'
    sha1 'a2c02c5fb2ab8cf630982cddc6821e74f5769974'
  end

  resource 'scipy' do
    url 'http://downloads.sourceforge.net/project/scipy/scipy/0.13.3/scipy-0.13.3.tar.gz'
    sha1 '2c7d53fc1d7bfe0a3ab5818ef6d84cb5d8cfcca4'
  end

  def install
    ENV.prepend_create_path 'PYTHONPATH', libexec+'lib/python2.7/site-packages'
    numpy_args = [ "build", "--fcompiler=gnu95",
                   "install", "--prefix=#{libexec}" ]
    resource('numpy').stage { system "python", "setup.py", *numpy_args }
    scipy_args = [ "build", "--fcompiler=gnu95",
                   "install", "--prefix=#{libexec}" ]
    resource('scipy').stage { system "python", "setup.py", *scipy_args }
    pyqtgraph_args = [ "setup.py", "install", "--prefix=#{libexec}" ]
    resource('pyqtgraph').stage { system "python", *pyqtgraph_args }

    cd "src" do
      binwalk_args = [ "install", "--prefix=#{prefix}" ]
      system "python", "setup.py", *binwalk_args
      bin.env_script_all_files(libexec+'bin', :PYTHONPATH => ENV['PYTHONPATH'])
    end
  end

  test do
    touch "binwalk.test"
    system "#{bin}/binwalk", "binwalk.test"
  end
end