54 lines
1.7 KiB
Ruby
54 lines
1.7 KiB
Ruby
class Spack < Formula
|
|
desc "Package manager that builds multiple versions and configurations of software"
|
|
homepage "https://spack.io"
|
|
url "https://github.com/spack/spack/archive/v0.16.1.tar.gz"
|
|
sha256 "8d893036b24d9ee0feee41ac33dd66e4fc68d392918f346f8a7a36a69c567567"
|
|
license any_of: ["Apache-2.0", "MIT"]
|
|
head "https://github.com/spack/spack.git", branch: "develop"
|
|
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "python@3.9"
|
|
|
|
def install
|
|
cp_r Dir["bin", "etc", "lib", "share", "var"], prefix.to_s
|
|
end
|
|
|
|
def post_install
|
|
mkdir_p prefix/"var/spack/junit-report" unless (prefix/"var/spack/junit-report").exist?
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/spack", "--version"
|
|
assert_match "zlib", shell_output("#{bin}/spack list zlib")
|
|
|
|
# Set up configuration file and build paths
|
|
%w[opt modules lmod stage test source misc cfg-store].each { |dir| (testpath/dir).mkpath }
|
|
(testpath/"cfg-store/config.yaml").write <<~EOS
|
|
config:
|
|
install_tree: #{testpath}/opt
|
|
module_roots:
|
|
tcl: #{testpath}/modules
|
|
lmod: #{testpath}/lmod
|
|
build_stage:
|
|
- #{testpath}/stage
|
|
test_stage: #{testpath}/test
|
|
source_cache: #{testpath}/source
|
|
misc_cache: #{testpath}/misc
|
|
EOS
|
|
|
|
# spack install using the config file
|
|
system "#{bin}/spack", "-C", "#{testpath}/cfg-store", "install", "--no-cache", "zlib"
|
|
|
|
# Get the path to one of the compiled library files
|
|
zlib_prefix = shell_output("#{bin}/spack -ddd -C #{testpath}/cfg-store find --format={prefix} zlib").strip
|
|
zlib_dylib_file = Pathname.new "#{zlib_prefix}/lib/libz.dylib"
|
|
assert_predicate zlib_dylib_file, :exist?
|
|
end
|
|
end
|