Skip to content

Commit

Permalink
Improve formulae
Browse files Browse the repository at this point in the history
- 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`.
  • Loading branch information
rgov committed Nov 21, 2020
1 parent 838f9da commit f6d10a9
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 73 deletions.
45 changes: 0 additions & 45 deletions i-i-o-oscilloscope.rb

This file was deleted.

48 changes: 48 additions & 0 deletions iio-oscilloscope.rb
Original file line number Diff line number Diff line change
@@ -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
25 changes: 19 additions & 6 deletions libad9361-iio.rb
Original file line number Diff line number Diff line change
@@ -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
43 changes: 21 additions & 22 deletions libiio.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f6d10a9

Please sign in to comment.