78 lines
2.9 KiB
Ruby
78 lines
2.9 KiB
Ruby
class Volk < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Vector Optimized Library of Kernels"
|
|
homepage "https://www.libvolk.org/"
|
|
url "https://github.com/gnuradio/volk/releases/download/v3.0.0/volk-3.0.0.tar.gz"
|
|
sha256 "797c208bd449f77186684c9fa368cc8577fb98ce3763db5de526e6809de32d28"
|
|
license "LGPL-3.0-or-later"
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "52ff9a4b5c47a0dc1f19db0058c4fafcc26b8163f28bbbf1b926efd782e5ab02"
|
|
sha256 arm64_monterey: "ff09e450bf0ae32fcd0562397c9a45839450f32f96d3559da7fafb61a3cb03c8"
|
|
sha256 arm64_big_sur: "f38aebc5c6ad1163e5ebc1791ccebfe5c269a1319aa06676bc5d295cfe01dd4d"
|
|
sha256 ventura: "79fcfa93cd4f681fe8af9e515e264608162cef5d8498fede1829bb6616e6878d"
|
|
sha256 monterey: "435296319b6a65ae72d6a5dd24e1df94552ca2ee3d6985c433b0be9cb42604fe"
|
|
sha256 big_sur: "943932be7a0e7fb6cc7d146ead74a6069cf014d4a30dca8167520ae7cb5d82d4"
|
|
sha256 x86_64_linux: "1432bc5c4b8ed803de9b2171a26ed1e5bb7735d6e8f137bed5e689c7888320d2"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "orc"
|
|
depends_on "pygments"
|
|
depends_on "python@3.11"
|
|
|
|
on_intel do
|
|
depends_on "cpu_features"
|
|
end
|
|
|
|
fails_with gcc: "5" # https://github.com/gnuradio/volk/issues/375
|
|
|
|
resource "Mako" do
|
|
url "https://files.pythonhosted.org/packages/05/5f/2ba6e026d33a0e6ddc1dddf9958677f76f5f80c236bd65309d280b166d3e/Mako-1.2.4.tar.gz"
|
|
sha256 "d60a3903dc3bb01a18ad6a89cdbe2e4eadc69c0bc8ef1e3773ba53d44c3f7a34"
|
|
end
|
|
|
|
resource "MarkupSafe" do
|
|
url "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz"
|
|
sha256 "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"
|
|
end
|
|
|
|
def install
|
|
python = "python3.11"
|
|
|
|
# Set up Mako
|
|
venv_root = libexec/"venv"
|
|
ENV.prepend_create_path "PYTHONPATH", venv_root/Language::Python.site_packages(python)
|
|
venv = virtualenv_create(venv_root, python)
|
|
venv.pip_install resources
|
|
|
|
# Avoid references to the Homebrew shims directory
|
|
inreplace "lib/CMakeLists.txt" do |s|
|
|
s.gsub! "${CMAKE_C_COMPILER}", ENV.cc
|
|
s.gsub! "${CMAKE_CXX_COMPILER}", ENV.cxx
|
|
end
|
|
|
|
# cpu_features fails to build on ARM macOS.
|
|
args = %W[
|
|
-DPYTHON_EXECUTABLE=#{venv_root}/bin/python
|
|
-DENABLE_TESTING=OFF
|
|
-DVOLK_CPU_FEATURES=#{Hardware::CPU.intel?}
|
|
]
|
|
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
|
|
# Set up volk_modtool paths
|
|
site_packages = prefix/Language::Python.site_packages(python)
|
|
pth_contents = "import site; site.addsitedir('#{site_packages}')\n"
|
|
(venv_root/Language::Python.site_packages(python)/"homebrew-volk.pth").write pth_contents
|
|
end
|
|
|
|
test do
|
|
system "volk_modtool", "--help"
|
|
system "volk_profile", "--iter", "10"
|
|
end
|
|
end
|