homebrew-core/Formula/geoip.rb

60 lines
2.1 KiB
Ruby
Raw Normal View History

2011-03-10 05:11:03 +00:00
class Geoip < Formula
2014-07-20 18:49:32 +00:00
homepage "https://github.com/maxmind/geoip-api-c"
url "https://github.com/maxmind/geoip-api-c/archive/v1.6.4.tar.gz"
sha1 "f478c60e810be1ba3e4df1e4a3b839b8c604122f"
2014-03-19 17:07:50 +00:00
2014-07-20 18:49:32 +00:00
head "https://github.com/maxmind/geoip-api-c.git"
2014-02-23 12:04:53 +00:00
bottle do
cellar :any
2015-02-07 07:06:53 +00:00
sha1 "2e76cca3bd3d3e5d059a68c3bbbb418be4ec19ce" => :yosemite
sha1 "658aa954c6abe8b7864abb21eaa081edc4e5c408" => :mavericks
sha1 "c856d5a8237eb98627b0803ade799523e3d9be22" => :mountain_lion
2014-02-23 12:04:53 +00:00
end
2014-07-20 18:49:32 +00:00
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "geoipupdate" => :optional
2012-08-10 04:47:59 +00:00
option :universal
def install
2012-08-10 04:47:59 +00:00
ENV.universal_binary if build.universal?
# Fixes a build error on Lion when configure does a variant of autoreconf
# that results in a botched Makefile, causing this error:
# No rule to make target '../libGeoIP/libGeoIP.la', needed by 'geoiplookup'
# This works on Snow Leopard also when it tries but fails to run autoreconf.
# Also fixes the tests by downloading required data file
system "./bootstrap"
2012-08-10 04:47:59 +00:00
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--datadir=#{var}",
2012-08-10 04:47:59 +00:00
"--prefix=#{prefix}"
system "make", "check"
system "make", "install"
end
2013-01-27 22:37:52 +00:00
def post_install
geoip_data = Pathname.new "#{var}/GeoIP"
geoip_data.mkpath
# Since default data directory moved, copy existing DBs
legacy_data = Pathname.new "#{HOMEBREW_PREFIX}/share/GeoIP"
cp Dir["#{legacy_data}/*"], geoip_data if legacy_data.exist?
full = Pathname.new "#{geoip_data}/GeoIP.dat"
ln_s "GeoLiteCountry.dat", full unless full.exist? or full.symlink?
full = Pathname.new "#{geoip_data}/GeoIPCity.dat"
ln_s "GeoLiteCity.dat", full unless full.exist? or full.symlink?
end
2013-01-27 22:37:52 +00:00
test do
system "curl", "-O", "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz"
system "gunzip", "GeoIP.dat.gz"
system "#{bin}/geoiplookup", "-f", "GeoIP.dat", "8.8.8.8"
2013-01-27 22:37:52 +00:00
end
end