89 lines
3.0 KiB
Ruby
89 lines
3.0 KiB
Ruby
class Singular < Formula
|
|
desc "Computer algebra system for polynomial computations"
|
|
homepage "https://www.singular.uni-kl.de/"
|
|
url "https://www.singular.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-3-1/singular-4.3.1p2.tar.gz"
|
|
version "4.3.1p2"
|
|
sha256 "95814bba0f0bd0290cd9799ec1d2ecc6f4c8a4e6429d9a02eb7f9c4e5649682a"
|
|
license "GPL-2.0-or-later"
|
|
|
|
livecheck do
|
|
url "https://www.singular.uni-kl.de/ftp/pub/Math/Singular/SOURCES/"
|
|
regex(%r{href=["']?v?(\d+(?:[.-]\d+)+)/?["' >]}i)
|
|
strategy :page_match do |page, regex|
|
|
# Match versions from directories
|
|
versions = page.scan(regex)
|
|
.flatten
|
|
.uniq
|
|
.map { |v| Version.new(v.tr("-", ".")) }
|
|
.reject { |v| v.patch >= 90 }
|
|
.sort
|
|
next versions if versions.blank?
|
|
|
|
# Assume the last-sorted version is newest
|
|
newest_version = versions.last
|
|
|
|
# Fetch the page for the newest version directory
|
|
dir_page = Homebrew::Livecheck::Strategy.page_content(
|
|
URI.join(@url, "#{newest_version.to_s.tr(".", "-")}/"),
|
|
)
|
|
next versions if dir_page[:content].blank?
|
|
|
|
# Identify versions from files in the version directory
|
|
dir_versions = dir_page[:content].scan(/href=.*?singular[._-]v?(\d+(?:\.\d+)+(?:p\d+)?)\.t/i).flatten
|
|
|
|
dir_versions || versions
|
|
end
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "7570ef9396f60a13517a9e42735f991f2bd5d08402808633299e43814d40ddb1"
|
|
sha256 arm64_big_sur: "c549c126c15a56777dd54e20ee408fa1cf7945bd735fd615ab92c6e369bfaefd"
|
|
sha256 monterey: "150e76c1e1eb10366afa1aefa3053c171e75e8813eaa4814298db4804659cdd8"
|
|
sha256 big_sur: "e1acc9bf2daa815379592b57c3c1cecfcc7e7e2e167bd3c5e6ea90fc5ece2454"
|
|
sha256 catalina: "732a3d7fc116f9b896042b73a727d6631f575885449eb5d7f2479d6410afe51f"
|
|
sha256 x86_64_linux: "af277c92c81c40b8d53041986baea5713367e80d0d4b85f9dd5edd4e53dd4db6"
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/Singular/Singular.git", branch: "spielwiese"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "gmp"
|
|
depends_on "mpfr"
|
|
depends_on "ntl"
|
|
depends_on "python@3.10"
|
|
|
|
on_macos do
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
def install
|
|
# Run autogen on macOS so that -flat_namespace flag is not used.
|
|
system "./autogen.sh" if build.head? || OS.mac?
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}",
|
|
"--with-python=#{which("python3.10")}",
|
|
"CXXFLAGS=-std=c++11"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
testinput = <<~EOS
|
|
ring r = 0,(x,y,z),dp;
|
|
poly p = x;
|
|
poly q = y;
|
|
poly qq = z;
|
|
p*q*qq;
|
|
EOS
|
|
assert_match "xyz", pipe_output("#{bin}/Singular", testinput, 0)
|
|
end
|
|
end
|