Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnuradio 3.8.1.0 #56628

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 79 additions & 67 deletions Formula/gnuradio.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
class Gnuradio < Formula
include Language::Python::Virtualenv

desc "SDK providing the signal processing runtime and processing blocks"
homepage "https://gnuradio.org/"
url "https://gnuradio.org/releases/gnuradio/gnuradio-3.7.13.4.tar.gz"
sha256 "c536c268b1e9c24f1206bbc881a5819ac46e662f4e8beaded6f3f441d3502f0d"
revision 14
url "https://github.com/gnuradio/gnuradio/releases/download/v3.8.1.0/gnuradio-3.8.1.0.tar.gz"
sha256 "e15311e7da9fe2bb790cc36321d7eb2d93b9dfa0c1552fa5d534dd99d22873be"
head "https://github.com/gnuradio/gnuradio.git"
revision 15

Comment on lines 8 to 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
head "https://github.com/gnuradio/gnuradio.git"
revision 15
head "https://github.com/gnuradio/gnuradio.git"

bottle do
sha256 "74aa8a8d8c32be557ea8a8864cb8617e82a939e667b73e11c45da13d72b52a3a" => :catalina
Expand All @@ -15,82 +17,87 @@ class Gnuradio < Formula
depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "pkg-config" => :build
depends_on "sphinx-doc" => :build
depends_on "swig" => :build
depends_on "adwaita-icon-theme"
depends_on "boost"
depends_on "cairo"
depends_on "cython"
depends_on "fftw"
depends_on "freetype"
depends_on "gdk-pixbuf"
depends_on "gmp"
depends_on "gsl"
depends_on :macos # Due to Python 2
depends_on "[email protected]"
depends_on "gtk+3"
depends_on "librtlsdr"
depends_on "libxml2"
depends_on "log4cpp"
depends_on "numpy"
depends_on "portaudio"
depends_on "pygobject3"
depends_on "pyqt"
depends_on "[email protected]"
depends_on "qt"
depends_on "qwt"
depends_on "uhd"
depends_on "zeromq"

# cheetah starts here
resource "Markdown" do
url "https://files.pythonhosted.org/packages/b3/73/fc5c850f44af5889192dff783b7b0d8f3fe8d30b65c8e3f78f8f0265fecf/Markdown-2.6.11.tar.gz"
sha256 "a856869c7ff079ad84a3e19cd87a64998350c2b94e9e08e44270faef33400f81"
end

resource "Cheetah" do
url "https://files.pythonhosted.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz"
sha256 "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550"
end
# cheetah ends here

resource "lxml" do
url "https://files.pythonhosted.org/packages/54/a6/43be8cf1cc23e3fa208cab04ba2f9c3b7af0233aab32af6b5089122b44cd/lxml-4.2.3.tar.gz"
sha256 "622f7e40faef13d232fb52003661f2764ce6cdef3edb0a59af7c1559e4cc36d1"
url "https://files.pythonhosted.org/packages/4e/72/e6a7d92279e3551db1b68fd336fd7a6e3d2f2ec742bf486486e6150d77d2/Cheetah3-3.2.4.tar.gz"
sha256 "caabb9c22961a3413ac85cd1e5525ec9ca80daeba6555f4f60802b6c256e252b"
end

resource "MarkupSafe" do
url "https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz"
sha256 "a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
url "https://files.pythonhosted.org/packages/4e/72/e6a7d92279e3551db1b68fd336fd7a6e3d2f2ec742bf486486e6150d77d2/Cheetah3-3.2.4.tar.gz"
sha256 "caabb9c22961a3413ac85cd1e5525ec9ca80daeba6555f4f60802b6c256e252b"
end

resource "Mako" do
url "https://files.pythonhosted.org/packages/eb/f3/67579bb486517c0d49547f9697e36582cd19dafb5df9e687ed8e22de57fa/Mako-1.0.7.tar.gz"
sha256 "4e02fde57bd4abb5ec400181e4c314f56ac3e49ba4fb8b0d50bba18cb27d25ae"
url "https://files.pythonhosted.org/packages/b0/3c/8dcd6883d009f7cae0f3157fb53e9afb05a0d3d33b3db1268ec2e6f4a56b/Mako-1.1.0.tar.gz"
sha256 "a36919599a9b7dc5d86a7a8988f23a9a3a3d083070023bab23d64f7f1d1e0a4b"
end

resource "six" do
url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"
sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
url "https://files.pythonhosted.org/packages/dd/bf/4138e7bfb757de47d1f4b6994648ec67a51efe58fa907c1e11e350cddfca/six-1.12.0.tar.gz"
sha256 "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
end

resource "PyYAML" do
url "https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz"
sha256 "01adf0b6c6f61bd11af6e10ca52b7d4057dd0be0343eb9283c878cf3af56aee4"
end

resource "cppzmq" do
url "https://raw.githubusercontent.com/zeromq/cppzmq/46fc0572c5e9f09a32a23d6f22fd79b841f77e00/zmq.hpp"
sha256 "964031c0944f913933f55ad1610938105a6657a69d1ac5a6dd50e16a679104d5"
end

# patch for boost 1.70.0, remove after next release
patch do
url "https://github.com/gnuradio/gnuradio/commit/6dc8229fd0dda25c054c2194ee2c9b28affe92d8.patch?full_index=1"
sha256 "9836235ea69b3d66b5cd4b2cdc89f80d010797d2bd59dc5c6631a96af921db8c"
resource "click" do
url "https://files.pythonhosted.org/packages/f8/5c/f60e9d8a1e77005f664b76ff8aeaee5bc05d0a91798afd7f53fc998dbc47/Click-7.0.tar.gz"
sha256 "5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
end

def install
ENV.prepend_path "PATH", "/System/Library/Frameworks/Python.framework/Versions/2.7/bin"
resource "matplotlib" do
url "https://files.pythonhosted.org/packages/4a/30/eb8e7dd8e3609f05c6920fa82f189302c832e5a0f6667aa96f952056bc0c/matplotlib-3.2.1.tar.gz"
sha256 "ffe2f9cdcea1086fc414e82f42271ecf1976700b8edd16ca9d376189c6d93aee"
end

ENV["CHEETAH_INSTALL_WITHOUT_SETUPTOOLS"] = "1"
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
resource "click-plugins" do
url "https://files.pythonhosted.org/packages/5f/1d/45434f64ed749540af821fd7e42b8e4d23ac04b1eda7c26613288d6cd8a8/click-plugins-1.1.1.tar.gz"
sha256 "46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b"
end

%w[Markdown Cheetah MarkupSafe Mako six].each do |r|
resource(r).stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
def install
ENV.cxx11
ENV.prepend_path "PATH", Formula["qt"].opt_bin

begin
# Fix "ld: file not found: /usr/lib/system/libsystem_darwin.dylib" for lxml
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
venv_root = libexec/"venv"
xy = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", "#{venv_root}/lib/python#{xy}/site-packages"
venv = virtualenv_create(venv_root, "python3")

resource("lxml").stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
ensure
ENV.delete("SDKROOT")
%w[Mako six Cheetah PyYAML click click-plugins].each do |r|
venv.pip_install resource(r)
end

resource("cppzmq").stage include.to_s
Expand All @@ -99,25 +106,39 @@ def install
-DGR_PKG_CONF_DIR=#{etc}/gnuradio/conf.d
-DGR_PREFSDIR=#{etc}/gnuradio/conf.d
-DENABLE_DEFAULT=OFF
-DPYTHON_EXECUTABLE=#{venv_root}/bin/python
-DPYTHON_VERSION_MAJOR=3
-DQWT_LIBRARIES=/usr/local/lib/qwt.framework/
-DCMAKE_PREFIX_PATH=#{Formula["qt"].opt_lib}
-DQT_BINARY_DIR=#{Formula["qt"].opt_bin}
-DENABLE_TESTING=OFF
]

enabled = %w[GR_ANALOG GR_FFT VOLK GR_FILTER GNURADIO_RUNTIME
GR_BLOCKS GR_PAGER GR_NOAA GR_CHANNELS GR_AUDIO
GR_FCD GR_VOCODER GR_FEC GR_DIGITAL GR_DTV GR_ATSC
GR_TRELLIS GR_ZEROMQ GR_WAVELET GR_UHD DOXYGEN SPHINX
PYTHON GR_UTILS]
enabled = %w[GNURADIO_RUNTIME GR_ANALOG GR_AUDIO GR_BLOCKS
GR_CHANNELS GR_DIGITAL GR_DTV GR_FEC GR_FFT GR_FILTER
GR_MODTOOL GR_TRELLIS GR_UHD GR_UTILS GR_VOCODER GR_QTGUI GR_WAVELET
GR_ZEROMQ PYTHON VOLK]
enabled.each do |c|
args << "-DENABLE_#{c}=ON"
end
args << "-DENABLE_GRC=ON"

ENV.append "LDFLAGS", "-undefined dynamic_lookup"

mkdir "build" do
system "cmake", "..", *args
system "make"
system "make", "install"
end

mv Dir[lib/"python#{xy}/dist-packages/*"], lib/"python#{xy}/site-packages/"
rm_rf lib/"python#{xy}/dist-packages"

site_packages = lib/"python#{xy}/site-packages"
pth_contents = "import site; site.addsitedir('#{site_packages}')\n"
(venv_root/"lib/python#{xy}/site-packages/homebrew-gnuradio.pth").write pth_contents

rm bin.children.reject(&:executable?)
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end

test do
Expand Down Expand Up @@ -153,9 +174,10 @@ class top_block : public gr::top_block {
top.run();
}
EOS
system ENV.cxx, "-L#{lib}", "-L#{Formula["boost"].opt_lib}",
system ENV.cxx, "-std=c++11", "-L#{lib}", "-L#{Formula["boost"].opt_lib}",
"-lgnuradio-blocks", "-lgnuradio-runtime", "-lgnuradio-pmt",
"-lboost_system", testpath/"test.c++", "-o", testpath/"test"
"-lboost_system", "-L#{Formula["log4cpp"].opt_lib}", "-llog4cpp",
testpath/"test.c++", "-o", testpath/"test"
system "./test"

(testpath/"test.py").write <<~EOS
Expand All @@ -182,16 +204,6 @@ def main(top_block_cls=top_block, options=None):

main()
EOS
system "python", testpath/"test.py"

cd testpath do
system "#{bin}/gr_modtool", "newmod", "test"

cd "gr-test" do
system "#{bin}/gr_modtool", "add", "-t", "general", "test_ff", "-l",
"python", "-y", "--argument-list=''", "--add-python-qa",
"--copyright=brew"
end
end
system "python3", testpath/"test.py"
end
end