49 lines
1.7 KiB
Ruby
49 lines
1.7 KiB
Ruby
class Fpc < Formula
|
|
desc "Free Pascal: multi-architecture Pascal compiler"
|
|
homepage "https://www.freepascal.org/"
|
|
url "https://downloads.sourceforge.net/project/freepascal/Source/3.0.4/fpc-3.0.4.source.tar.gz"
|
|
sha256 "69b3b7667b72b6759cf27226df5eb54112ce3515ff5efb79d95ac14bac742845"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "82a121567c94e70b63f92873a6a269cb612a15b344d77218b88444febb3d4924" => :high_sierra
|
|
sha256 "c7ba05c852bbd1a5737f6b020239353708188f545fe9700159c5b8484fcfc568" => :sierra
|
|
sha256 "cae838ddb6452c345bcd3779c057a152071c12db666fe2d8a934c78c3d210244" => :el_capitan
|
|
end
|
|
|
|
resource "bootstrap" do
|
|
url "https://downloads.sourceforge.net/project/freepascal/Bootstrap/3.0.0/x86_64-macosx-10.7-ppcx64.tar.bz2"
|
|
sha256 "a67ef5def356d122a4692e21b209c328f6d46deef4539f4d4506c3dc1eecb4b0"
|
|
end
|
|
|
|
def install
|
|
fpc_bootstrap = buildpath/"bootstrap"
|
|
resource("bootstrap").stage { fpc_bootstrap.install Dir["*"] }
|
|
|
|
fpc_compiler = fpc_bootstrap/"ppcx64"
|
|
system "make", "build", "PP=#{fpc_compiler}"
|
|
system "make", "install", "PP=#{fpc_compiler}", "PREFIX=#{prefix}"
|
|
|
|
bin.install_symlink lib/"#{name}/#{version}/ppcx64"
|
|
|
|
# Prevent non-executable audit warning
|
|
rm_f Dir[bin/"*.rsj"]
|
|
|
|
# Generate a default fpc.cfg to set up unit search paths
|
|
system "#{bin}/fpcmkcfg", "-p", "-d", "basepath=#{lib}/fpc/#{version}", "-o", "#{prefix}/etc/fpc.cfg"
|
|
end
|
|
|
|
test do
|
|
hello = <<~EOS
|
|
program Hello;
|
|
uses GL;
|
|
begin
|
|
writeln('Hello Homebrew')
|
|
end.
|
|
EOS
|
|
(testpath/"hello.pas").write(hello)
|
|
system "#{bin}/fpc", "hello.pas"
|
|
assert_equal "Hello Homebrew", `./hello`.strip
|
|
end
|
|
end
|