57 lines
2.1 KiB
Ruby
57 lines
2.1 KiB
Ruby
class Odin < Formula
|
|
desc "Programming language with focus on simplicity, performance and modern systems"
|
|
homepage "https://odin-lang.org/"
|
|
url "https://github.com/odin-lang/Odin.git",
|
|
tag: "dev-2022-07",
|
|
revision: "1676c643dfd9ef45f2aaa4dfddb69cea4bcf80fc"
|
|
version "2022-07"
|
|
license "BSD-3-Clause"
|
|
head "https://github.com/odin-lang/Odin.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "5b3bdfebf981c9a493ef5ff64219ac6d7959b9cf61ea8ce122da60be5e46666b"
|
|
sha256 cellar: :any, arm64_big_sur: "e26552b8028335a62184199c9aa138eeb315f53f0ae16d4416e82f2d2b84688a"
|
|
sha256 cellar: :any, monterey: "bfcb5cd1468bbf2d49678e6056d17bcdc4df5aabcff055e0aac94873975c2085"
|
|
sha256 cellar: :any, big_sur: "8270c0c05cc3e80129d931332662341e248145b36753cd3ac1aa70846d077f48"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "d8e2214cd00c5e3fb1deac87a5eef246a0947c115aa2f74782ab0b9a90ba2fb0"
|
|
end
|
|
|
|
depends_on "llvm"
|
|
# Build failure on macOS 10.15 due to `__ulock_wait2` usage.
|
|
# Issue ref: https://github.com/odin-lang/Odin/issues/1773
|
|
depends_on macos: :big_sur
|
|
|
|
fails_with gcc: "5" # LLVM is built with GCC
|
|
|
|
def install
|
|
# Keep version number consistent and reproducible for tagged releases.
|
|
# Issue ref: https://github.com/odin-lang/Odin/issues/1772
|
|
inreplace "build_odin.sh", "dev-$(date +\"%Y-%m\")", "dev-#{version}" unless build.head?
|
|
|
|
system "make", "release"
|
|
libexec.install "odin", "core", "shared"
|
|
(bin/"odin").write <<~EOS
|
|
#!/bin/bash
|
|
export PATH="#{Formula["llvm"].opt_bin}:$PATH"
|
|
exec -a odin "#{libexec}/odin" "$@"
|
|
EOS
|
|
pkgshare.install "examples"
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/odin version")
|
|
|
|
(testpath/"hellope.odin").write <<~EOS
|
|
package main
|
|
|
|
import "core:fmt"
|
|
|
|
main :: proc() {
|
|
fmt.println("Hellope!");
|
|
}
|
|
EOS
|
|
system "#{bin}/odin", "build", "hellope.odin", "-file"
|
|
assert_equal "Hellope!\n", shell_output("./hellope.bin")
|
|
end
|
|
end
|