homebrew-core/Formula/pgrouting.rb
2017-10-28 03:08:08 -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/v2.5.1.tar.gz"
sha256 "d7d4bcdb8fa94471accea486a24a906f1a6d7739e6cf67e037298b7a89c084ad"
head "https://github.com/pgRouting/pgrouting.git"
bottle do
cellar :any
sha256 "8a56b709bc71080ae6da55441e652935e123762d40de7e9722a9b7b62f47f6bb" => :high_sierra
sha256 "b5ef8d0a878c24e7923a2999fd76c3001607a1124bbdce3f07f4ab1918f30ba1" => :sierra
sha256 "ced680a288c809ce186b6ece75a8a60f80ad1f22c899d79cc62eaf51395294c4" => :el_capitan
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