52 lines
1.7 KiB
Ruby
52 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.2.tar.gz"
|
|
sha256 "9251d5955e00456ce8fd7f4fade0f40158687fd58814cbb961ba3588edc31153"
|
|
revision 1
|
|
head "https://github.com/pgRouting/pgrouting.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "0d58ef547ff437aac5d7df81748e1b81dec33860e4280b7e1d90fda7760208f5" => :high_sierra
|
|
sha256 "ee603ac9416c84d382ad7000ffbd84b54c16cabcdc131e35b97517c2e51a8c02" => :sierra
|
|
sha256 "3f25010adbd94d068e740d6426219ebd2f5331688b8b3656fdd30fbe0912c21c" => :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
|