homebrew-core/Formula/minimal-racket.rb
2017-01-31 10:16:18 +01:00

77 lines
2.3 KiB
Ruby

class MinimalRacket < Formula
desc "Modern programming language in the Lisp/Scheme family"
homepage "https://racket-lang.org/"
url "https://mirror.racket-lang.org/installers/6.8/racket-minimal-6.8-src-builtpkgs.tgz"
version "6.8"
sha256 "db17e919cd4216a9fdfc6f7c49ba09f67927000d128e2ba8ada82d6fb3df3e20"
bottle do
sha256 "23ae8dafa6071ec3b468898e3cd75f369efdff002e623b78d3fb223621a0d31a" => :sierra
sha256 "7ae11f9e863353e78a97bf662a3f6372f2288dd6d5e7cb2ca35f5105087cf96d" => :el_capitan
sha256 "78157ad14904c4a2e3ce4120105323e23e29ff16f48248308d46c89eecf1adb5" => :yosemite
end
# these two files are amended when (un)installing packages
skip_clean "lib/racket/launchers.rktd", "lib/racket/mans.rktd"
def install
cd "src" do
args = %W[
--disable-debug
--disable-dependency-tracking
--enable-macprefix
--prefix=#{prefix}
--man=#{man}
--sysconfdir=#{etc}
]
args << "--disable-mac64" unless MacOS.prefer_64_bit?
system "./configure", *args
system "make"
system "make", "install"
end
# configure racket's package tool (raco) to do the Right Thing
# see: https://docs.racket-lang.org/raco/config-file.html
inreplace etc/"racket/config.rktd" do |s|
s.gsub!(
/\(bin-dir\s+\.\s+"#{Regexp.quote(bin)}"\)/,
"(bin-dir . \"#{HOMEBREW_PREFIX}/bin\")"
)
s.gsub!(
/\n\)$/,
"\n (default-scope . \"installation\")\n)"
)
end
end
def caveats; <<-EOS.undent
This is a minimal Racket distribution.
If you want to build the DrRacket IDE, you may run
raco pkg install --auto drracket
The full Racket distribution is available as a cask:
brew cask install racket
EOS
end
test do
output = shell_output("#{bin}/racket -e '(displayln \"Hello Homebrew\")'")
assert_match /Hello Homebrew/, output
# show that the config file isn't malformed
output = shell_output("'#{bin}/raco' pkg config")
assert $?.success?
assert_match Regexp.new(<<-EOS.undent), output
^name:
#{version}
catalogs:
https://download.racket-lang.org/releases/#{version}/catalog/
https://pkgs.racket-lang.org
https://planet-compats.racket-lang.org
default-scope:
installation
EOS
end
end