homebrew-core/Formula/pgrouting.rb
2019-10-15 20:03:50 -04:00

51 lines
1.7 KiB
Ruby

class Pgrouting < Formula
desc "Provides geospatial routing for PostGIS/PostgreSQL database"
homepage "https://pgrouting.org/"
url "https://github.com/pgRouting/pgrouting/archive/v2.6.3.tar.gz"
sha256 "7ebef19dc698d4e85b85274f6949e77b26fe5a2b79335589bc3fbdfca977eb0f"
head "https://github.com/pgRouting/pgrouting.git"
bottle do
cellar :any
sha256 "48dd77946a0d3b76109ecb2f9658ab3219d3461a08874953252d943a9e861bf5" => :catalina
sha256 "ca645cb009a3123f36f39fb74756ecef8c7af38a951eb7a5d66e079516f5018f" => :mojave
sha256 "49a30bbe0caab34403b0b5c45779b69cd3ec26d73a2e2c48ce71b4353b5ec8c6" => :high_sierra
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