From f6d10a9f80fac98398acffa5e81792594df37757 Mon Sep 17 00:00:00 2001 From: Ryan Govostes Date: Sat, 21 Nov 2020 16:59:13 -0500 Subject: [PATCH] Improve formulae - Rename i-i-o-oscilloscope to the more natural iio-oscilloscope - Invoke CMake with Homebrew's standard arguments - Fix identification of build-time vs runtime dependencies - Update packages to latest versions - Add SHA-256 checksums to verify file integrity - Add simple test cases The formulae now pass `brew audit`. --- i-i-o-oscilloscope.rb | 45 ---------------------------------------- iio-oscilloscope.rb | 48 +++++++++++++++++++++++++++++++++++++++++++ libad9361-iio.rb | 25 ++++++++++++++++------ libiio.rb | 43 +++++++++++++++++++------------------- 4 files changed, 88 insertions(+), 73 deletions(-) delete mode 100644 i-i-o-oscilloscope.rb create mode 100644 iio-oscilloscope.rb diff --git a/i-i-o-oscilloscope.rb b/i-i-o-oscilloscope.rb deleted file mode 100644 index 1dd89d2..0000000 --- a/i-i-o-oscilloscope.rb +++ /dev/null @@ -1,45 +0,0 @@ - -class IIOOscilloscope < Formula - - desc "IIO Oscilloscope" - homepage "https://github.com/analogdevicesinc/iio-oscilloscope/wiki" - url "https://github.com/analogdevicesinc/iio-oscilloscope/archive/v0.10-master.tar.gz" - sha256 "45feffd087f2bb53b9b9d1e2fa00e7423e94f024c8adc5cedc8f145ff3afb4ea" - head "https://github.com/analogdevicesinc/iio-oscilloscope.git" - - depends_on "libusb" - depends_on "cmake" => :build - depends_on "gtk+" => :build - depends_on "glib" => :build - depends_on "cairo" => :build - depends_on "pixman" => :build - depends_on "fontconfig" => :build - depends_on "freetype" => :build - depends_on "libpng" => :build - depends_on "pango" => :build - depends_on "fribidi" => :build - depends_on "atk" => :build - depends_on "gdk-pixbuf" => :build - depends_on "gtkdatabox" => :build - depends_on "fftw" => :build - depends_on "curl" => :build - depends_on "jansson" => :build - depends_on "libxml2" => :build - depends_on "pkg-config" => :build - depends_on "libmatio" => :build - depends_on "gettext" => :build - depends_on "harfbuzz" => :build - depends_on "graphite2" => :build - depends_on "libffi" => :build - - def install - ENV.deparallelize - system "cmake ./CMakeLists.txt -DCMAKE_INSTALL_PREFIX='#{prefix}'" - system "make", "install" - end - - test do - system "false" - end - -end diff --git a/iio-oscilloscope.rb b/iio-oscilloscope.rb new file mode 100644 index 0000000..b12213e --- /dev/null +++ b/iio-oscilloscope.rb @@ -0,0 +1,48 @@ +class IioOscilloscope < Formula + desc "GTK+ based oscilloscope application for interfacing with various IIO devices" + homepage "https://wiki.analog.com/resources/tools-software/linux-software/iio_oscilloscope" + url "https://github.com/analogdevicesinc/iio-oscilloscope/archive/v0.11-master.tar.gz" + sha256 "df31ae208f806f8291c3d4fd53d57d2e54acff4ab65c5ae52c18730fc76c6e64" + license "GPL-2.0" + head "https://github.com/analogdevicesinc/iio-oscilloscope.git" + + depends_on "cmake" => :build + depends_on "pkg-config" => :build + + depends_on "atk" + depends_on "cairo" + depends_on "curl" + depends_on "fftw" + depends_on "gdk-pixbuf" + depends_on "gettext" + depends_on "glib" + depends_on "gtk+" + depends_on "gtkdatabox" + depends_on "harfbuzz" + depends_on "jansson" + depends_on "libad9361-iio" + depends_on "libiio" + depends_on "libmatio" + depends_on "libserialport" + depends_on "pango" + + uses_from_macos "libxml2" + + def install + # Do not disable peer certificate verification when checking for updates; + # this crashes on macOS. + inreplace "phone_home.c" do |s| + s.gsub! /(CURLOPT_SSL_VERIFYPEER), false/, '\1, true' + end + + mkdir "build" do + system "cmake", "..", *std_cmake_args + system "make", "install" + end + end + + test do + assert_match "osc: the IIO visualization and control tool", + shell_output("#{bin}/osc --help", 255) + end +end diff --git a/libad9361-iio.rb b/libad9361-iio.rb index 7a860a0..e26bd06 100644 --- a/libad9361-iio.rb +++ b/libad9361-iio.rb @@ -1,19 +1,32 @@ class Libad9361Iio < Formula - desc "" - homepage "" + desc "IIO AD9361 library for filter design and handling, multi-chip sync, etc." + homepage "https://analogdevicesinc.github.io/libad9361-iio/" + url "https://github.com/analogdevicesinc/libad9361-iio/archive/v0.2.tar.gz" + sha256 "f0d935eb7f70fde8596d98e9eb1f311b408b87662fc1fff45ae3ed455697b747" + license "LGPL-2.1" head "https://github.com/analogdevicesinc/libad9361-iio.git" depends_on "cmake" => :build depends_on "pkg-config" => :build + depends_on "libiio" def install - # ENV.deparallelize # if your formula fails when building in parallel - system "cmake ./CMakeLists.txt -DCMAKE_INSTALL_PREFIX='#{prefix}'" - system "make", "install" # if this fails, try separate make/make install steps + mkdir "build" do + cmake_args = [ + "-DOSX_PACKAGE=OFF", + ] + system "cmake", "..", *cmake_args, *std_cmake_args + system "make" + system "make", "install" + end + + # For some reason they install a framework in lib/ + frameworks.install_symlink lib/"ad9361.framework" end test do - system "false" + assert_match "ad9361_fmcomms5_phase_sync", + shell_output("nm #{frameworks}/ad9361.framework/ad9361") end end diff --git a/libiio.rb b/libiio.rb index d3a4534..c7cf4dc 100644 --- a/libiio.rb +++ b/libiio.rb @@ -1,32 +1,31 @@ - class Libiio < Formula - desc "libIIO" - homepage "https://github.com/analogdevicesinc/iio-oscilloscope/wiki" -# head "https://github.com/analogdevicesinc/libiio.git" - url "https://github.com/analogdevicesinc/libiio/archive/v0.17.tar.gz" + desc "Library for interfacing with local and remote Linux IIO devices" + homepage "https://analogdevicesinc.github.io/libiio/" + url "https://github.com/analogdevicesinc/libiio/archive/v0.21.tar.gz" + sha256 "03d13165cbeb83b036743cbd9a10e336c728da162714f39d13250a3d94305cac" + license "LGPL-2.1" + head "https://github.com/analogdevicesinc/libiio.git" - # libusb libxml2 depends_on "cmake" => :build -# depends_on "gtk+" => :build -# depends_on "glib" => :build -# depends_on "libcdk5-dev" => :build -# depends_on "bison" => :build -# depends_on "flex" => :build - depends_on "doxygen" => build - depends_on "libxml2" => :build - depends_on "libusb" => :build + + depends_on "libserialport" + depends_on "libusb" + + uses_from_macos "libxml2" def install - ENV.deparallelize # if your formula fails when building in parallel - system "mkdir build" - system "cd build" - system "pwd" - system "cmake .." - system "make" - #system "make","DESTDIR=#{prefix}","install-common-files" + mkdir "build" do + cmake_args = [ + "-DOSX_INSTALL_FRAMEWORKSDIR=#{frameworks}", + "-DOSX_PACKAGE=OFF", + ] + system "cmake", "..", *cmake_args, *std_cmake_args + system "make" + system "make", "install" + end end test do - system "false" + system "#{frameworks}/iio.framework/Tools/iio_info", "--help" end end