118 lines
3.9 KiB
Ruby
118 lines
3.9 KiB
Ruby
class Gnuplot < Formula
|
|
desc "Command-driven, interactive function plotting"
|
|
homepage "http://www.gnuplot.info/"
|
|
url "https://downloads.sourceforge.net/project/gnuplot/gnuplot/5.2.3/gnuplot-5.2.3.tar.gz"
|
|
sha256 "feb58c9358d9d129e00507f3b34d4b13c4caea3f004325c587f8caafe5dbe724"
|
|
|
|
bottle do
|
|
sha256 "9b72f49cead49807ab76c7b9792f4f699368ab11e3d97c8adbd404762fd1abdd" => :high_sierra
|
|
sha256 "474abc69cfff327e7d7f0fa71e6e6907bcd4b39d05cf580b3a1b10b66a81ba0b" => :sierra
|
|
sha256 "37e710c47efc97629ae5d3b83c3f1c2199aea5e78b9a420b141aaac487ab7fdc" => :el_capitan
|
|
end
|
|
|
|
head do
|
|
url "https://git.code.sf.net/p/gnuplot/gnuplot-main.git"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
option "with-cairo", "Build the Cairo based terminals"
|
|
option "without-lua", "Build without the lua/TikZ terminal"
|
|
option "with-wxmac", "Build wxmac support. Need with-cairo to build wxt terminal"
|
|
option "with-aquaterm", "Build with AquaTerm support"
|
|
|
|
deprecated_option "with-x" => "with-x11"
|
|
deprecated_option "wx" => "with-wxmac"
|
|
deprecated_option "qt" => "with-qt"
|
|
deprecated_option "with-qt5" => "with-qt"
|
|
deprecated_option "cairo" => "with-cairo"
|
|
deprecated_option "nolua" => "without-lua"
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "gd"
|
|
depends_on "readline"
|
|
depends_on "lua" => :recommended
|
|
depends_on "pango" if build.with?("cairo") || build.with?("wxmac")
|
|
depends_on "qt" => :optional
|
|
depends_on "wxmac" => :optional
|
|
depends_on :x11 => :optional
|
|
|
|
needs :cxx11 if build.with? "qt"
|
|
|
|
resource "libcerf" do
|
|
url "http://apps.jcns.fz-juelich.de/src/libcerf/libcerf-1.5.tgz"
|
|
mirror "https://www.mirrorservice.org/sites/distfiles.macports.org/libcerf/libcerf-1.5.tgz"
|
|
sha256 "e36dc147e7fff81143074a21550c259b5aac1b99fc314fc0ae33294231ca5c86"
|
|
end
|
|
|
|
def install
|
|
# Qt5 requires c++11 (and the other backends do not care)
|
|
ENV.cxx11 if build.with? "qt"
|
|
|
|
if build.with? "aquaterm"
|
|
# Add "/Library/Frameworks" to the default framework search path, so that an
|
|
# installed AquaTerm framework can be found. Brew does not add this path
|
|
# when building against an SDK (Nov 2013).
|
|
ENV.prepend "CPPFLAGS", "-F/Library/Frameworks"
|
|
ENV.prepend "LDFLAGS", "-F/Library/Frameworks"
|
|
end
|
|
|
|
# Build libcerf
|
|
resource("libcerf").stage do
|
|
system "./configure", "--prefix=#{buildpath}/libcerf", "--enable-static", "--disable-shared"
|
|
system "make", "install"
|
|
end
|
|
ENV.prepend_path "PKG_CONFIG_PATH", buildpath/"libcerf/lib/pkgconfig"
|
|
|
|
args = %W[
|
|
--disable-dependency-tracking
|
|
--disable-silent-rules
|
|
--prefix=#{prefix}
|
|
--with-readline=#{Formula["readline"].opt_prefix}
|
|
--without-tutorial
|
|
]
|
|
|
|
if build.without? "wxmac"
|
|
args << "--disable-wxwidgets"
|
|
args << "--without-cairo" if build.without? "cairo"
|
|
end
|
|
|
|
if build.with? "qt"
|
|
args << "--with-qt"
|
|
else
|
|
args << "--with-qt=no"
|
|
end
|
|
|
|
args << "--without-lua" if build.without? "lua"
|
|
args << (build.with?("aquaterm") ? "--with-aquaterm" : "--without-aquaterm")
|
|
args << (build.with?("x11") ? "--with-x" : "--without-x")
|
|
|
|
system "./prepare" if build.head?
|
|
system "./configure", *args
|
|
ENV.deparallelize # or else emacs tries to edit the same file with two threads
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
def caveats
|
|
if build.with? "aquaterm"
|
|
<<~EOS
|
|
AquaTerm support will only be built into Gnuplot if the standard AquaTerm
|
|
package from SourceForge has already been installed onto your system.
|
|
If you subsequently remove AquaTerm, you will need to uninstall and then
|
|
reinstall Gnuplot.
|
|
EOS
|
|
end
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/gnuplot", "-e", <<~EOS
|
|
set terminal dumb;
|
|
set output "#{testpath}/graph.txt";
|
|
plot sin(x);
|
|
EOS
|
|
assert_predicate testpath/"graph.txt", :exist?
|
|
end
|
|
end
|