2011-03-10 05:11:03 +00:00
|
|
|
class Geoip < Formula
|
2016-02-05 13:40:31 +00:00
|
|
|
desc "This library is for the GeoIP Legacy format (dat)"
|
2014-07-20 18:49:32 +00:00
|
|
|
homepage "https://github.com/maxmind/geoip-api-c"
|
2016-01-11 18:19:10 +00:00
|
|
|
url "https://github.com/maxmind/geoip-api-c/releases/download/v1.6.9/GeoIP-1.6.9.tar.gz"
|
|
|
|
sha256 "4b446491843de67c1af9b887da17a3e5939e0aeed4826923a5f4bf09d845096f"
|
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"
|
2009-10-03 02:09:26 +00:00
|
|
|
|
2014-02-23 12:04:53 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2016-01-12 07:41:53 +00:00
|
|
|
sha256 "dc7c79eef8500456198b3ba981c13498c049b2f8c4398fe885534c386dfbf283" => :el_capitan
|
|
|
|
sha256 "0525ae799027334cafb551a349c7837c8b17853660797dff430b035ca0eedc65" => :yosemite
|
|
|
|
sha256 "5ee66187d1b4510fd463ebb8bf360c2d78a4252467a0e10e905a2a3502f9bcaa" => :mavericks
|
2014-02-23 12:04:53 +00:00
|
|
|
end
|
|
|
|
|
2012-08-10 04:47:59 +00:00
|
|
|
option :universal
|
2010-10-17 15:52:14 +00:00
|
|
|
|
2016-02-05 13:40:31 +00:00
|
|
|
depends_on "geoipupdate" => :optional
|
|
|
|
|
2009-10-03 02:09:26 +00:00
|
|
|
def install
|
2012-08-10 04:47:59 +00:00
|
|
|
ENV.universal_binary if build.universal?
|
2012-04-03 01:55:58 +00:00
|
|
|
|
2012-08-10 04:47:59 +00:00
|
|
|
system "./configure", "--disable-dependency-tracking",
|
2013-11-24 00:29:26 +00:00
|
|
|
"--disable-silent-rules",
|
2013-11-25 01:59:44 +00:00
|
|
|
"--datadir=#{var}",
|
2012-08-10 04:47:59 +00:00
|
|
|
"--prefix=#{prefix}"
|
2013-11-24 00:29:26 +00:00
|
|
|
system "make", "check"
|
|
|
|
system "make", "install"
|
2009-10-03 02:09:26 +00:00
|
|
|
end
|
2013-01-27 22:37:52 +00:00
|
|
|
|
2013-11-25 01:59:44 +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"
|
2014-05-30 17:38:30 +00:00
|
|
|
cp Dir["#{legacy_data}/*"], geoip_data if legacy_data.exist?
|
2013-11-25 01:59:44 +00:00
|
|
|
|
2014-08-12 07:48:13 +00:00
|
|
|
full = Pathname.new "#{geoip_data}/GeoIP.dat"
|
2015-08-03 12:55:31 +00:00
|
|
|
ln_s "GeoLiteCountry.dat", full unless full.exist? || full.symlink?
|
2014-08-12 07:48:13 +00:00
|
|
|
full = Pathname.new "#{geoip_data}/GeoIPCity.dat"
|
2015-08-03 12:55:31 +00:00
|
|
|
ln_s "GeoLiteCity.dat", full unless full.exist? || full.symlink?
|
2013-11-25 01:59:44 +00:00
|
|
|
end
|
|
|
|
|
2013-01-27 22:37:52 +00:00
|
|
|
test do
|
2013-11-24 00:29:26 +00:00
|
|
|
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
|
2009-10-03 02:09:26 +00:00
|
|
|
end
|