homebrew-core/Formula/freeciv.rb
2018-06-21 21:53:04 -07:00

89 lines
2.4 KiB
Ruby

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.11/freeciv-2.5.11.tar.bz2"
sha256 "4c9c526952fe977cb4b302b8ccf75798fd066c6dde670f72f677fe4964259aad"
revision 3
bottle do
sha256 "24363a5afbf8b9a52997dbcea7da50f67d75a17296782c73da30cb23737c45ae" => :high_sierra
sha256 "ca4f8cf66f98db33ac835e0a4cdc95e024484964dcc5c2066faa1b56c4444660" => :sierra
sha256 "14399d2e22ab37998251a4edc4f9410fdc96df60a1c067843a0e0e01b2cfaa91" => :el_capitan
end
head do
url "https://github.com/freeciv/freeciv.git"
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
ENV["ac_cv_lib_lzma_lzma_code"] = "no"
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"
assert_predicate testpath/"manual6.html", :exist?
server = fork do
system bin/"freeciv-server", "-l", testpath/"test.log"
end
sleep 5
Process.kill("TERM", server)
assert_predicate testpath/"test.log", :exist?
end
end