homebrew-core/Formula/otf2.rb

86 lines
3.4 KiB
Ruby

class Otf2 < Formula
desc "Open Trace Format 2 file handling library"
homepage "https://www.vi-hps.org/projects/score-p/"
url "https://perftools.pages.jsc.fz-juelich.de/cicd/otf2/tags/otf2-3.0/otf2-3.0.tar.gz", using: :homebrew_curl
sha256 "6fff0728761556e805b140fd464402ced394a3c622ededdb618025e6cdaa6d8c"
license "BSD-3-Clause"
livecheck do
url :homepage
regex(/href=.*?otf2[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "d895185d92f105adde7e226c11c866d4b71c95222d20e6e96818405218fe9802"
sha256 arm64_big_sur: "3668159cd6c2f6e6a113ff22cafeb6e79bf2184c5fb7bf95a1c813f30d7f6904"
sha256 monterey: "a2a968708bea0bed2b534cfa9e7c5396cc8c0738e7b8488ec9e7ade2b19d91db"
sha256 big_sur: "016108e473931259c82aa88fcf43f1ef3094603f04364f4db9c8e83c862c5ab2"
sha256 catalina: "766c74896f03d156b54288289cda986e0cbc762a938a4379c438bb33f87ba74d"
sha256 x86_64_linux: "17697e2a84fadf8394ea50075566f80b403b6102ca8e28daa24de0a36373314c"
end
depends_on "sphinx-doc" => :build
depends_on "gcc" # for gfortran
depends_on "open-mpi"
depends_on "python@3.10"
depends_on "six"
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
directory "build-frontend"
end
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
directory "build-backend"
end
def install
ENV["PYTHON"] = which("python3.10")
ENV["SPHINX"] = Formula["sphinx-doc"].opt_bin/"sphinx-build"
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make"
system "make", "install"
inreplace pkgshare/"otf2.summary", "#{Superenv.shims_path}/", ""
end
test do
cp_r share/"doc/otf2/examples", testpath
workdir = testpath/"examples"
chdir "#{testpath}/examples" do
# Use -std=gnu99 to work around Linux error when compiling with -std=c99, which
# requires _POSIX_C_SOURCE >= 199309L in order to use POSIX time functions/macros.
inreplace "Makefile", "-std=c99", "-std=gnu99" if OS.linux?
# build serial tests
system "make", "serial", "mpi", "pthread"
%w[
otf2_mpi_reader_example
otf2_mpi_reader_example_cc
otf2_mpi_writer_example
otf2_pthread_writer_example
otf2_reader_example
otf2_writer_example
].each { |p| assert_predicate workdir/p, :exist? }
system "./otf2_writer_example"
assert_predicate workdir/"ArchivePath/ArchiveName.otf2", :exist?
system "./otf2_reader_example"
rm_rf "./ArchivePath"
system Formula["open-mpi"].opt_bin/"mpirun", "-n", "2", "./otf2_mpi_writer_example"
assert_predicate workdir/"ArchivePath/ArchiveName.otf2", :exist?
2.times do |n|
assert_predicate workdir/"ArchivePath/ArchiveName/#{n}.evt", :exist?
end
system Formula["open-mpi"].opt_bin/"mpirun", "-n", "2", "./otf2_mpi_reader_example"
system "./otf2_reader_example"
rm_rf "./ArchivePath"
system "./otf2_pthread_writer_example"
assert_predicate workdir/"ArchivePath/ArchiveName.otf2", :exist?
system "./otf2_reader_example"
end
end
end