swi-prolog: migrate from x11

See also Homebrew/homebrew-x11#204.

Closes #761.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
master
Stefano Pacifico 2016-05-01 22:26:36 -04:00 committed by Martin Afanasjew
parent e1bd08c99a
commit a06e55a11a
2 changed files with 81 additions and 1 deletions

81
Formula/swi-prolog.rb Normal file
View File

@ -0,0 +1,81 @@
class SwiProlog < Formula
desc "ISO/Edinburgh-style Prolog interpreter"
homepage "http://www.swi-prolog.org/"
url "http://www.swi-prolog.org/download/stable/src/swipl-7.2.3.tar.gz"
sha256 "43657d51b7c5887bc2d2bced50a9822b86a08a6841399b8e76ee877f51d646b5"
devel do
url "http://www.swi-prolog.org/download/devel/src/swipl-7.3.19.tar.gz"
sha256 "693cfeac8f31d050ddcec27e550586359e98a64dc820398997d0ce6b8f564354"
end
head do
url "https://github.com/SWI-Prolog/swipl-devel.git"
depends_on "autoconf" => :build
end
option "with-lite", "Disable all packages"
option "with-jpl", "Enable JPL (Java Prolog Bridge)"
option "with-xpce", "Enable XPCE (Prolog Native GUI Library)"
deprecated_option "lite" => "with-lite"
depends_on "pkg-config" => :build
depends_on "readline"
depends_on "gmp"
depends_on "openssl"
depends_on "libarchive" => :optional
if build.with? "xpce"
depends_on :x11
depends_on "jpeg"
end
fails_with :llvm do
build 2335
cause "Exported procedure chr_translate:chr_translate_line_info/3 is not defined"
end
def install
# The archive package hard-codes a check for MacPort libarchive
# Replace this with a check for Homebrew's libarchive, or nowhere
if build.with? "libarchive"
inreplace "packages/archive/configure.in", "/opt/local",
Formula["libarchive"].opt_prefix
else
ENV.append "DISABLE_PKGS", "archive"
end
args = ["--prefix=#{libexec}", "--mandir=#{man}"]
ENV.append "DISABLE_PKGS", "jpl" if build.without? "jpl"
ENV.append "DISABLE_PKGS", "xpce" if build.without? "xpce"
# SWI-Prolog's Makefiles don't add CPPFLAGS to the compile command, but do
# include CIFLAGS. Setting it here. Also, they clobber CFLAGS, so including
# the Homebrew-generated CFLAGS into COFLAGS here.
ENV["CIFLAGS"] = ENV.cppflags
ENV["COFLAGS"] = ENV.cflags
# Build the packages unless --with-lite option specified
args << "--with-world" if build.without? "lite"
# './prepare' prompts the user to build documentation
# (which requires other modules). '3' is the option
# to ignore documentation.
system "echo '3' | ./prepare" if build.head?
system "./configure", *args
system "make"
system "make", "install"
bin.write_exec_script Dir["#{libexec}/bin/*"]
end
test do
(testpath/"test.pl").write <<-EOS.undent
test :-
write('Homebrew').
EOS
assert_equal "Homebrew", shell_output("#{bin}/swipl -s #{testpath}/test.pl -g test -t halt")
end
end

View File

@ -209,7 +209,6 @@
"sshfs": "homebrew/fuse",
"stormfs": "homebrew/fuse",
"sundials": "homebrew/science",
"swi-prolog": "homebrew/x11",
"sxiv": "homebrew/x11",
"synfigstudio": "homebrew/boneyard",
"syslog-ng": "homebrew/boneyard",