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.60.3/meson-0.60.3.tar.gz"
sha256 "87ca5fa9358a01864529392bd64e027158eb94afca7c7766b1866ef27eccb98e"
license "Apache-2.0"
head "https://github.com/mesonbuild/meson.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, all: "b51016f9a5f261da9baa0f30e3e36f9eddcf147494970f3f1baa68ac8b83e666"
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