98 lines
3.4 KiB
Ruby
98 lines
3.4 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/8.4/racket-minimal-8.4-src.tgz"
|
|
sha256 "1599545af8ed8a87b84bc80f7ad8fbbdd9de557ea310582e268e23db026c280c"
|
|
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_monterey: "5741499d6f681a61cd90a15ab03f051d63838d714fb17b1038c07c9065159f8e"
|
|
sha256 arm64_big_sur: "22293e93e5cce501d4e7355b2b07eb268b8e9cf7b3c4fc3ce8fc97af27dd655c"
|
|
sha256 big_sur: "6a34a94e8a2b10d3a054788329206494d71830ef5e5db05721c4da73bd49a5c1"
|
|
sha256 catalina: "7954ec82ba334e28f2733a6b847bb70227efc7542911d66a1ab0d9d40fed913d"
|
|
sha256 x86_64_linux: "c307b4d3b0e5cf5e9d330f65041f9084474861f19b132873453e96b0db3f8ba9"
|
|
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{.*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
|