forked from ttrftech/homebrew-gqrx
-
Notifications
You must be signed in to change notification settings - Fork 13
/
gnuradio.rb
91 lines (78 loc) · 2.98 KB
/
gnuradio.rb
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require 'formula'
class Gnuradio < Formula
homepage 'http://gnuradio.org'
url 'http://gnuradio.org/releases/gnuradio/gnuradio-3.7.7.1.tar.gz'
sha256 '2b27b13fc734ab5882e42c1661d433c0c097fd8b55b682f00626fa96c356584e'
head 'git://gnuradio.org/gnuradio/gnuradio.git'
depends_on 'cmake' => :build
depends_on 'scipy' => :python
depends_on 'boost'
depends_on 'fftw'
depends_on 'pygtk'
depends_on 'swig'
depends_on 'cppunit'
depends_on 'pyqt' if ARGV.include?('--with-qt')
depends_on 'pyqwt' if ARGV.include?('--with-qt')
depends_on 'doxygen' if ARGV.include?('--with-docs')
fails_with :clang do
build 421
cause "Fails to compile .S files."
end
def options
[
['--with-qt', 'Build gr-qtgui.'],
['--with-docs', 'Build docs.'],
]
end
def install
ENV.prepend_create_path 'PYTHONPATH', libexec+'lib/python2.7/site-packages'
install_args = [ "setup.py", "install", "--prefix=#{libexec}" ]
mkdir 'build' do
args = ["-DCMAKE_PREFIX_PATH=#{prefix}", "-DQWT_INCLUDE_DIRS=#{HOMEBREW_PREFIX}/lib/qwt.framework/Headers", "-DQWT_LIBRARIES=#{HOMEBREW_PREFIX}/lib/qwt.framework/qwt", ] + std_cmake_args
args << '-DENABLE_GR_QTGUI=OFF' unless ARGV.include?('--with-qt')
args << '-DENABLE_DOXYGEN=OFF' unless ARGV.include?('--with-docs')
# From opencv.rb
python_prefix = `python-config --prefix`.strip
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
# For Xcode-only systems, the headers of system's python are inside of Xcode
args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
else
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
end
else
python_lib = "#{python_prefix}/lib/lib#{which_python}"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
end
args << "-DPYTHON_PACKAGES_PATH='#{lib}/#{which_python}/site-packages'"
system 'cmake', '..', *args
system 'make'
system 'make install'
end
end
def python_path
python = Formula.factory('python')
kegs = python.rack.children.reject { |p| p.basename.to_s == '.DS_Store' }
kegs.find { |p| Keg.new(p).linked? } || kegs.last
end
def caveats
<<-EOS.undent
If you want to use custom blocks, create this file:
~/.gnuradio/config.conf
[grc]
local_blocks_path=/usr/local/share/gnuradio/grc/blocks
EOS
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end
__END__