Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
class MinimalRacket < Formula
desc "Modern programming language in the Lisp/Scheme family"
homepage "https://racket-lang.org/"
url "https://mirror.racket-lang.org/installers/8.2/racket-minimal-8.2-src.tgz"
sha256 "6f4dcbb17493898c954973ddde3daee1f18aa3197e6ece0d3e48dc2d4cfa84c7"
license any_of: ["MIT", "Apache-2.0"]
# File links on the download page are created using JavaScript, so we parse
# the filename from a string in an object. We match the version from the
# "Unix Source + built packages" option, as the `racket-minimal` archive is
# only found on the release page for a given version (e.g., `/releases/8.0/`).
livecheck do
url "https://download.racket-lang.org/"
regex(/["'][^"']*?racket(?:-minimal)?[._-]v?(\d+(?:\.\d+)+)-src\.t/i)
end
bottle do
sha256 arm64_big_sur: "2fcbd22adcdf16e1a8a1618f3c06022cc4081752b0802767b4e48469b22f4f36"
sha256 big_sur: "2549795768caa35126b4464af7dd15bd4d3f11755f9853ffc3f248d061e7b457"
sha256 catalina: "a79ff7f036256aae9159f89897e32629641d889b4bd37c98e91b216a7f3085f5"
sha256 mojave: "56d2c05a1f17765404dad099fa7565883447be394f2ecbe2b74a19c13d6b7ded"
sha256 x86_64_linux: "5649130e99166343b0147b8fc992d1004f1dfd8529e8de0f284c0912217aa0c8"
end
depends_on "openssl@1.1"
uses_from_macos "libffi"
# these two files are amended when (un)installing packages
skip_clean "lib/racket/launchers.rktd", "lib/racket/mans.rktd"
def install
# configure racket's package tool (raco) to do the Right Thing
# see: https://docs.racket-lang.org/raco/config-file.html
inreplace "etc/config.rktd", /\)\)\n$/, ") (default-scope . \"installation\"))\n"
cd "src" do
args = %W[
--disable-debug
--disable-dependency-tracking
--enable-origtree=no
--enable-macprefix
--prefix=#{prefix}
--mandir=#{man}
--sysconfdir=#{etc}
--enable-useprefix
]
ENV["LDFLAGS"] = "-rpath #{Formula["openssl@1.1"].opt_lib}"
ENV["LDFLAGS"] = "-Wl,-rpath=#{Formula["openssl@1.1"].opt_lib}" if OS.linux?
system "./configure", *args
system "make"
system "make", "install"
end
end
def caveats
<<~EOS
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 install --cask 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 $CHILD_STATUS.success?
assert_match Regexp.new(<<~EOS), 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
# ensure Homebrew openssl is used
on_macos do
output = shell_output("DYLD_PRINT_LIBRARIES=1 #{bin}/racket -e '(require openssl)' 2>&1")
assert_match(%r{loaded: .*openssl@1\.1/.*/libssl.*\.dylib}, output)
end
on_linux do
output = shell_output("LD_DEBUG=libs #{bin}/racket -e '(require openssl)' 2>&1")
assert_match "init: #{Formula["openssl@1.1"].opt_lib}/#{shared_library("libssl")}", output
end
end
end