73 lines
2.2 KiB
Ruby
73 lines
2.2 KiB
Ruby
class Nim < Formula
|
|
desc "Statically typed compiled systems programming language"
|
|
homepage "https://nim-lang.org/"
|
|
url "https://nim-lang.org/download/nim-1.2.6.tar.xz"
|
|
sha256 "df88ea712e96ea847b610d56ef69f46ba587002052a46bf03c5c62affac7657e"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
rebuild 1
|
|
sha256 "6e05e9295d4fcde5dfd166b042be425d21538bb307a3f3deeb3b9c13faa1d5eb" => :catalina
|
|
sha256 "6abb369c6954938d780ba11bbb1dd4adbf60e65829c1d2eb8dcfa409815d084b" => :mojave
|
|
sha256 "00eb986f798a638aff7abcc0dde85c337fcff85eee58fc70985040b7a9f43381" => :high_sierra
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/nim-lang/Nim.git", branch: "devel"
|
|
resource "csources" do
|
|
url "https://github.com/nim-lang/csources.git"
|
|
end
|
|
end
|
|
|
|
depends_on "help2man" => :build
|
|
|
|
def install
|
|
if build.head?
|
|
resource("csources").stage do
|
|
system "/bin/sh", "build.sh"
|
|
(buildpath/"bin").install "bin/nim"
|
|
end
|
|
else
|
|
system "/bin/sh", "build.sh"
|
|
end
|
|
# Compile the koch management tool
|
|
system "bin/nim", "c", "-d:release", "koch"
|
|
# Build a new version of the compiler with readline bindings
|
|
system "./koch", "boot", "-d:release", "-d:useLinenoise"
|
|
# Build nimble/nimgrep/nimpretty/nimsuggest
|
|
system "./koch", "tools"
|
|
system "./koch", "geninstall"
|
|
system "/bin/sh", "install.sh", prefix
|
|
|
|
system "help2man", "bin/nim", "-o", "nim.1", "-N"
|
|
man1.install "nim.1"
|
|
|
|
target = prefix/"nim/bin"
|
|
bin.install_symlink target/"nim"
|
|
tools = %w[nimble nimgrep nimpretty nimsuggest]
|
|
tools.each do |t|
|
|
system "help2man", buildpath/"bin"/t, "-o", "#{t}.1", "-N"
|
|
man1.install "#{t}.1"
|
|
target.install buildpath/"bin"/t
|
|
bin.install_symlink target/t
|
|
end
|
|
end
|
|
|
|
test do
|
|
(testpath/"hello.nim").write <<~EOS
|
|
echo("hello")
|
|
EOS
|
|
assert_equal "hello", shell_output("#{bin}/nim compile --verbosity:0 --run #{testpath}/hello.nim").chomp
|
|
|
|
(testpath/"hello.nimble").write <<~EOS
|
|
version = "0.1.0"
|
|
author = "Author Name"
|
|
description = "A test nimble package"
|
|
license = "MIT"
|
|
requires "nim >= 0.15.0"
|
|
EOS
|
|
assert_equal "name: \"hello\"\n", shell_output("#{bin}/nimble dump").lines.first
|
|
end
|
|
end
|