homebrew-core/Formula/chapel.rb

130 lines
5.1 KiB
Ruby

class Chapel < Formula
desc "Programming language for productive parallel computing at scale"
homepage "https://chapel-lang.org/"
url "https://github.com/chapel-lang/chapel/releases/download/1.29.0/chapel-1.29.0.tar.gz"
sha256 "f87bc7285c4641ed540f806c63ab904137b650b1e232a11c15f76e874e079804"
license "Apache-2.0"
head "https://github.com/chapel-lang/chapel.git", branch: "main"
bottle do
sha256 arm64_ventura: "e51cb39f28cf347f72b1ec2f05c74af9f0f3f4272d977aac489ba785f0fb9a79"
sha256 arm64_monterey: "cbfe50dc7f2fd6fe962378f8cbfabbe7ad4488a581d74c85ce29255cf14afa73"
sha256 arm64_big_sur: "09261fe1b84ec271feac68d6da2ec0048f7b9fb73d3f0a17101e7d16acf0763e"
sha256 ventura: "623949fa32c6bf31a7210e552d0dc65939817f7d261f9d167925ca6b5ffd0820"
sha256 monterey: "229f681a694385448cdb7d7c5a46163c477a39f064a945c1ff74efe30eba7a82"
sha256 big_sur: "7062a499e10d338ae265101feaf0a81f71f0e712c9fc7235e2f6ffb784e0bdd9"
sha256 x86_64_linux: "4a89d208b5cb191266b3be9cf79ded54b397502621cb706c1a54af950045f620"
end
depends_on "cmake"
depends_on "gmp"
depends_on "llvm@14"
depends_on "python@3.10"
# LLVM is built with gcc11 and we will fail on linux with gcc version 5.xx
fails_with gcc: "5"
# Work around Homebrew 11-arm64 CI issue, which outputs unwanted objc warnings like:
# objc[42134]: Class ... is implemented in both ... One of the two will be used. Which one is undefined.
# These end up incorrectly failing checkChplInstall test script when it checks for stdout/stderr.
# TODO: remove when Homebrew CI no longer outputs these warnings or 11-arm64 is no longer used.
patch :DATA
def llvm
deps.map(&:to_formula).find { |f| f.name.match? "^llvm" }
end
def install
# Always detect Python used as dependency rather than needing aliased Python formula
python = "python3.10"
# It should be noted that this will expand to: 'for cmd in python3.10 python3 python python2; do'
# in our find-python.sh script.
inreplace "util/config/find-python.sh", /^(for cmd in )(python3 )/, "\\1#{python} \\2"
libexec.install Dir["*"]
# Chapel uses this ENV to work out where to install.
ENV["CHPL_HOME"] = libexec
ENV["CHPL_GMP"] = "system"
# This enables a workaround for
# https://github.com/llvm/llvm-project/issues/54438
ENV["CHPL_HOST_USE_SYSTEM_LIBCXX"] = "yes"
# don't try to set CHPL_LLVM_GCC_PREFIX since the llvm
# package should be configured to use a reasonable GCC
(libexec/"chplconfig").write <<~EOS
CHPL_RE2=bundled
CHPL_GMP=system
CHPL_LLVM_CONFIG=#{llvm.opt_bin}/llvm-config
CHPL_LLVM_GCC_PREFIX=none
EOS
# Must be built from within CHPL_HOME to prevent build bugs.
# https://github.com/Homebrew/legacy-homebrew/pull/35166
cd libexec do
system "./util/printchplenv", "--all"
with_env(CHPL_PIP_FROM_SOURCE: "1") do
system "make", "test-venv"
end
with_env(CHPL_LLVM: "none") do
system "make"
end
with_env(CHPL_LLVM: "system") do
system "make"
end
with_env(CHPL_PIP_FROM_SOURCE: "1") do
system "make", "chpldoc"
end
system "make", "mason"
system "make", "cleanall"
rm_rf("third-party/llvm/llvm-src/")
rm_rf("third-party/gasnet/gasnet-src")
rm_rf("third-party/libfabric/libfabric-src")
rm_rf("third-party/fltk/fltk-1.3.5-source.tar.gz")
rm_rf("third-party/libunwind/libunwind-1.1.tar.gz")
rm_rf("third-party/gmp/gmp-src/")
rm_rf("third-party/qthread/qthread-src/installed")
end
# Install chpl and other binaries (e.g. chpldoc) into bin/ as exec scripts.
platform = if OS.linux? && Hardware::CPU.is_64_bit?
"linux64-#{Hardware::CPU.arch}"
else
"#{OS.kernel_name.downcase}-#{Hardware::CPU.arch}"
end
bin.install libexec.glob("bin/#{platform}/*")
bin.env_script_all_files libexec/"bin"/platform, CHPL_HOME: libexec
man1.install_symlink libexec.glob("man/man1/*.1")
end
test do
ENV["CHPL_HOME"] = libexec
ENV["CHPL_INCLUDE_PATH"] = HOMEBREW_PREFIX/"include"
ENV["CHPL_LIB_PATH"] = HOMEBREW_PREFIX/"lib"
cd libexec do
with_env(CHPL_LLVM: "system") do
system "util/test/checkChplInstall"
end
with_env(CHPL_LLVM: "none") do
system "util/test/checkChplInstall"
end
end
system bin/"chpl", "--print-passes", "--print-commands", libexec/"examples/hello.chpl"
end
end
__END__
diff --git a/util/test/checkChplInstall b/util/test/checkChplInstall
index 7d2eb78a88..a9ddf22054 100755
--- a/util/test/checkChplInstall
+++ b/util/test/checkChplInstall
@@ -189,6 +189,7 @@ fi
if [ -n "${TEST_COMP_OUT}" ]; then
# apply "prediff"-like filter to remove gmake "clock skew detected" warnings, if any
TEST_COMP_OUT=$( grep <<<"${TEST_COMP_OUT}" -v \
+ -e '^objc\(\[[0-9]*\]\)*: Class .* is implemented in both .* One of the two will be used\. Which one is undefined\. *$' \
-e '^g*make\(\[[0-9]*\]\)*: Warning: File .* has modification time .* in the future *$' \
-e '^g*make\(\[[0-9]*\]\)*: warning: Clock skew detected\. Your build may be incomplete\. *$' )
fi