homebrew-core/Formula/meson.rb

54 lines
1.6 KiB
Ruby

class Meson < Formula
desc "Fast and user friendly build system"
homepage "https://mesonbuild.com/"
url "https://github.com/mesonbuild/meson/releases/download/0.61.1/meson-0.61.1.tar.gz"
sha256 "feb2cefb325b437dbf36146df7c6b87688ddff0b0205caa31dc64055c6da410c"
license "Apache-2.0"
head "https://github.com/mesonbuild/meson.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, all: "4e7a608cbefd2c07d3a649adc57dee99bdbef2828a535b96088a7a1bfda5a79e"
end
depends_on "ninja"
depends_on "python@3.10"
def install
python3 = Formula["python@3.10"].opt_bin/"python3"
system python3, *Language::Python.setup_install_args(prefix)
# Make the bottles uniform. This also ensures meson checks `HOMEBREW_PREFIX`
# for fulfilling dependencies rather than just `/usr/local`.
mesonbuild = prefix/Language::Python.site_packages(python3)/"mesonbuild"
inreplace_files = %w[
coredata.py
dependencies/boost.py
dependencies/cuda.py
dependencies/qt.py
mesonlib/universal.py
modules/python.py
].map { |f| mesonbuild/f }
# Passing `build.stable?` ensures a failed `inreplace` won't fail HEAD installs.
inreplace inreplace_files, "/usr/local", HOMEBREW_PREFIX, build.stable?
end
test do
(testpath/"helloworld.c").write <<~EOS
main() {
puts("hi");
return 0;
}
EOS
(testpath/"meson.build").write <<~EOS
project('hello', 'c')
executable('hello', 'helloworld.c')
EOS
mkdir testpath/"build" do
system bin/"meson", ".."
assert_predicate testpath/"build/build.ninja", :exist?
end
end
end