homebrew-core/Formula/xplanet.rb
2017-09-24 02:06:25 +02:00

91 lines
3.3 KiB
Ruby

class Xplanet < Formula
desc "Create HQ wallpapers of planet Earth"
homepage "https://xplanet.sourceforge.io/"
url "https://downloads.sourceforge.net/project/xplanet/xplanet/1.3.1/xplanet-1.3.1.tar.gz"
sha256 "4380d570a8bf27b81fb629c97a636c1673407f4ac4989ce931720078a90aece7"
revision 2
bottle do
sha256 "bd4d0b8ed3bf33f6c6da0b43574fb08d054603d0b36b228a87d1ae070274ac7c" => :high_sierra
sha256 "eedbdc803d69fa1635e763eafa90ffd071b537e994a5fbdbe9eb84e69c0fc645" => :sierra
sha256 "6d37f0965bc1b1f1aa438fec8ea9e57a096681336dba25dc880f25cb752f3910" => :el_capitan
sha256 "4c0e0c1b025079129f808e85d3d5e76280799929fa6e9d119000e94283769a8d" => :yosemite
end
option "with-x11", "Build for X11 instead of Aqua"
option "with-all", "Build with default Xplanet configuration dependencies"
option "with-pango", "Build Xplanet to support Internationalized text library"
option "with-netpbm", "Build Xplanet with PNM graphic support"
option "with-cspice", "Build Xplanet with JPLs SPICE toolkit support"
depends_on "pkg-config" => :build
depends_on "giflib" => :recommended
depends_on "jpeg" => :recommended
depends_on "libpng" => :recommended
depends_on "libtiff" => :recommended
if build.with?("all")
depends_on "netpbm"
depends_on "pango"
depends_on "cspice"
end
depends_on "netpbm" => :optional
depends_on "pango" => :optional
depends_on "cspice" => :optional
depends_on "freetype"
depends_on :x11 => :optional
# patches bug in 1.3.1 with flag -num_times=2 (1.3.2 will contain fix, when released)
# https://sourceforge.net/p/xplanet/code/208/tree/trunk/src/libdisplay/DisplayOutput.cpp?diff=5056482efd48f8457fc7910a:207
patch :p2 do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/f952f1d/xplanet/xplanet-1.3.1-ntimes.patch"
sha256 "3f95ba8d5886703afffdd61ac2a0cd147f8d659650e291979f26130d81b18433"
end
# Fix compilation with giflib 5
# https://xplanet.sourceforge.io/FUDforum2/index.php?t=msg&th=592
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/master/xplanet/xplanet-1.3.1-giflib5.patch"
sha256 "0a88a9c984462659da37db58d003da18a4c21c0f4cd8c5c52f5da2b118576d6e"
end
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--without-cygwin
]
if build.without?("all")
args << "--without-gif" if build.without?("giflib")
args << "--without-jpeg" if build.without?("jpeg")
args << "--without-libpng" if build.without?("libpng")
args << "--without-libtiff" if build.without?("libtiff")
args << "--without-pnm" if build.without?("netpbm")
args << "--without-pango" if build.without?("pango")
args << "--without-cspice" if build.without?("cspice")
end
if build.with?("x11")
args << "--with-x" << "--with-xscreensaver" << "--without-aqua"
else
args << "--with-aqua" << "--without-x" << "--without-xscreensaver"
end
if build.with?("netpbm") || build.with?("all")
netpbm = Formula["netpbm"].opt_prefix
ENV.append "CPPFLAGS", "-I#{netpbm}/include/netpbm"
ENV.append "LDFLAGS", "-L#{netpbm}/lib"
end
system "./configure", *args
system "make", "install"
end
test do
system "#{bin}/xplanet", "-geometry", "4096x2160", "-projection", "mercator", "-gmtlabel", "-num_times", "1", "-output", "#{testpath}/xp-test.png"
end
end