homebrew-core/Formula/pgrouting.rb
2016-10-17 02:56:56 -07:00

51 lines
1.7 KiB
Ruby

class Pgrouting < Formula
desc "Provides geospatial routing for PostGIS/PostgreSQL database"
homepage "http://www.pgrouting.org"
url "https://github.com/pgRouting/pgrouting/archive/pgrouting-2.3.0.tar.gz"
sha256 "cadeed30bfc57f6e77bc48a10301b26e5d71d8e86f366ed60ab5b0eaa0c45662"
head "https://github.com/pgRouting/pgrouting.git"
bottle do
cellar :any
sha256 "f588645d13eb72c605d736e271b89552a44da91d49820fbbd7eed42a856b9c04" => :sierra
sha256 "8a4e72d1ebc5cebb411837e0fe23e1a38ab7c7997f1f642134cd044db4669242" => :el_capitan
sha256 "28fbbaf8a23cdd85fa195054e9bde133d9cca7733f2d670335f45ac97420e6a6" => :yosemite
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "cgal"
depends_on "gmp"
depends_on "postgis"
depends_on "postgresql"
def install
mkdir "stage"
mkdir "build" do
system "cmake", "-DWITH_DD=ON", "..", *std_cmake_args
system "make"
system "make", "install", "DESTDIR=#{buildpath}/stage"
end
lib.install Dir["stage/**/lib/*"]
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
end
test do
pg_bin = Formula["postgresql"].opt_bin
pg_port = "55561"
system "#{pg_bin}/initdb", testpath/"test"
pid = fork { exec "#{pg_bin}/postgres", "-D", testpath/"test", "-p", pg_port }
begin
sleep 2
system "#{pg_bin}/createdb", "-p", pg_port
system "#{pg_bin}/psql", "-p", pg_port, "--command", "CREATE DATABASE test;"
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION postgis;"
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION pgrouting;"
ensure
Process.kill 9, pid
Process.wait pid
end
end
end