class Freeciv < Formula desc "Free and Open Source empire-building strategy game" homepage "https://freeciv.wikia.com/" url "https://downloads.sourceforge.net/project/freeciv/Freeciv%202.5/2.5.6/freeciv-2.5.6.tar.bz2" mirror "http://download.gna.org/freeciv/stable/freeciv-2.5.6.tar.bz2" sha256 "cfadc23eec11a5a8ae74a7d3719eb126026137f0700da065367fd55cbab6999b" bottle do sha256 "6d909e5737f001570a73aa2169b0e768e51f9c13bdaa14e684d08708bc67f00a" => :sierra sha256 "9849bddd68dd60b9f63de188a0ffcf8f15f3da4031a0a0b7b64cebbed06a50ce" => :el_capitan sha256 "dcdb4844dee4d4240f4785debdfdd6ad6cd3d0320b60bf56a9f01be11095cf05" => :yosemite end head do url "svn://svn.gna.org/svn/freeciv/trunk" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "gettext" => :build depends_on "libtool" => :build end option "without-nls", "Disable NLS support" option "without-sdl", "Disable the SDL Freeciv client" depends_on "gettext" if build.with? "nls" depends_on "icu4c" depends_on "pkg-config" => :build depends_on "readline" depends_on "sdl" => :recommended if build.with? "sdl" depends_on "freetype" depends_on "sdl_image" depends_on "sdl_gfx" depends_on "sdl_mixer" depends_on "sdl_ttf" end depends_on "gtk+" => :recommended depends_on "gtk+3" => :optional if build.with?("gtk+") || build.with?("gtk+3") depends_on "atk" depends_on "glib" depends_on "pango" end depends_on "gdk-pixbuf" if build.with? "gtk+3" def install args = %W[ --disable-debug --disable-dependency-tracking --disable-gtktest --prefix=#{prefix} --with-readline=#{Formula["readline"].opt_prefix} ] if build.without? "nls" args << "--disable-nls" else gettext = Formula["gettext"] args << "CFLAGS=-I#{gettext.include}" args << "LDFLAGS=-L#{gettext.lib}" end if build.head? inreplace "./autogen.sh", "libtoolize", "glibtoolize" system "./autogen.sh", *args else system "./configure", *args end system "make", "install" end test do system bin/"freeciv-manual" File.exist? testpath/"manual6.html" server = fork do system bin/"freeciv-server", "-l", testpath/"test.log" end sleep 5 Process.kill("TERM", server) File.exist? testpath/"test.log" end end