class Xplanetfx < Formula desc "Configure, run or daemonize xplanet for HQ Earth wallpapers" homepage "http://mein-neues-blog.de/xplanetFX/" url "http://repository.mein-neues-blog.de:9000/archive/xplanetfx-2.6.12_all.tar.gz" version "2.6.12" sha256 "bae39af674fc89b3fbe07ba6271bbf0a1c2ff64bbf63f4b04ff3d6f0bcc4380c" bottle do cellar :any_skip_relocation sha256 "37eb283551634da81516b7c0cd33beef8e1f44277b37305cedac53fd8233e1f8" => :sierra sha256 "a705f96d9dbb1d179a8df93c60fac8a134d8270403a20b730501692d59ca737e" => :el_capitan sha256 "da2d1f07a54aa76a853221024ad64ea599b1b7f57ed46cc0fb88538af44b75b8" => :yosemite sha256 "58d9b7fafb5ea11f87275502ec817784ba3c93e0ee1c9aceb646f7a349ca5ae4" => :mavericks end option "without-gui", "Build to run xplanetFX from the command-line only" option "with-gnu-sed", "Build to use GNU sed instead of macOS sed" depends_on "xplanet" depends_on "imagemagick" depends_on "wget" depends_on "coreutils" depends_on "gnu-sed" => :optional if build.with? "gui" depends_on "librsvg" depends_on "pygtk" => "with-libglade" end skip_clean "share/xplanetFX" def install inreplace "bin/xplanetFX", "WORKDIR=/usr/share/xplanetFX", "WORKDIR=#{HOMEBREW_PREFIX}/share/xplanetFX" prefix.install "bin", "share" path = "#{Formula["coreutils"].opt_libexec}/gnubin" path += ":#{Formula["gnu-sed"].opt_libexec}/gnubin" if build.with?("gnu-sed") if build.with?("gui") ENV.prepend_create_path "PYTHONPATH", "#{HOMEBREW_PREFIX}/lib/python2.7/site-packages/gtk-2.0" ENV.prepend_create_path "GDK_PIXBUF_MODULEDIR", "#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders" end bin.env_script_all_files(libexec+"bin", :PATH => "#{path}:$PATH", :PYTHONPATH => ENV["PYTHONPATH"], :GDK_PIXBUF_MODULEDIR => ENV["GDK_PIXBUF_MODULEDIR"]) end def post_install if build.with?("gui") # Change the version directory below with any future update ENV["GDK_PIXBUF_MODULEDIR"]="#{HOMEBREW_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders" system "#{HOMEBREW_PREFIX}/bin/gdk-pixbuf-query-loaders", "--update-cache" end end test do system "#{bin}/xplanetFX", "--help" end end