88 lines
4.0 KiB
Ruby
88 lines
4.0 KiB
Ruby
class OsrmBackend < Formula
|
|
desc "High performance routing engine"
|
|
homepage "http://project-osrm.org/"
|
|
url "https://github.com/Project-OSRM/osrm-backend/archive/v5.27.1.tar.gz"
|
|
sha256 "52391580e0f92663dd7b21cbcc7b9064d6704470e2601bf3ec5c5170b471629a"
|
|
license "BSD-2-Clause"
|
|
head "https://github.com/Project-OSRM/osrm-backend.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_ventura: "2d998ee491cf85784a042b9f7e2670a9992b1e2e3c0d3788adafe9ed7e606c72"
|
|
sha256 cellar: :any, arm64_monterey: "6bac4fd2ddd10c1adf9168a840ce61f72120b2bbb6437e904486c91099586942"
|
|
sha256 cellar: :any, arm64_big_sur: "39be94c81ca0dae090db3d08274a0c2e523ba21f8d2e38daed7b5d017fffdc64"
|
|
sha256 cellar: :any, ventura: "eef2cb68ee9911e541127fa448175e3996b5f46d0a876b57bc7953ece436d539"
|
|
sha256 cellar: :any, monterey: "624391fecd8061b5025729c4b4660630155ea50a85584f060e6e4b835399d77f"
|
|
sha256 cellar: :any, big_sur: "e3f27f007ab6cb98966d2e72508de09bd570848668c54319d7877e2c3f6fbf03"
|
|
sha256 cellar: :any, catalina: "96e63874022b3d48a147707aa067d1f59c655a95261babd15478e4c2e7110960"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "fb266283ec549aeca3a4e948a90f16857356ab414b201ab1269c37ff68858187"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "boost"
|
|
depends_on "libstxxl"
|
|
depends_on "libxml2"
|
|
depends_on "libzip"
|
|
depends_on "lua"
|
|
depends_on "tbb"
|
|
|
|
uses_from_macos "expat"
|
|
|
|
conflicts_with "flatbuffers", because: "both install flatbuffers headers"
|
|
|
|
def install
|
|
# Work around build failure on Linux:
|
|
# /tmp/osrm-backend-20221105-7617-1itecwd/osrm-backend-5.27.1/src/osrm/osrm.cpp:83:1:
|
|
# /usr/include/c++/11/ext/new_allocator.h:145:26: error: 'void operator delete(void*, std::size_t)'
|
|
# called on unallocated object 'result' [-Werror=free-nonheap-object]
|
|
ENV.append_to_cflags "-Wno-free-nonheap-object" if OS.linux?
|
|
|
|
lua = Formula["lua"]
|
|
luaversion = lua.version.major_minor
|
|
system "cmake", "-S", ".", "-B", "build",
|
|
"-DENABLE_CCACHE:BOOL=OFF",
|
|
"-DLUA_INCLUDE_DIR=#{lua.opt_include}/lua#{luaversion}",
|
|
"-DLUA_LIBRARY=#{lua.opt_lib/shared_library("liblua", luaversion)}",
|
|
"-DENABLE_GOLD_LINKER=OFF",
|
|
*std_cmake_args
|
|
system "cmake", "--build", "build"
|
|
system "cmake", "--install", "build"
|
|
pkgshare.install "profiles"
|
|
end
|
|
|
|
test do
|
|
node1 = 'visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"'
|
|
node2 = 'visible="true" version="1" changeset="323878" timestamp="2008-05-03T13:39:23Z"'
|
|
node3 = 'visible="true" version="1" changeset="323878" timestamp="2008-05-03T13:39:23Z"'
|
|
|
|
(testpath/"test.osm").write <<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<osm version="0.6">
|
|
<bounds minlat="54.0889580" minlon="12.2487570" maxlat="54.0913900" maxlon="12.2524800"/>
|
|
<node id="1" lat="54.0901746" lon="12.2482632" user="a" uid="46882" #{node1}/>
|
|
<node id="2" lat="54.0906309" lon="12.2441924" user="a" uid="36744" #{node2}/>
|
|
<node id="3" lat="52.0906309" lon="12.2441924" user="a" uid="36744" #{node3}/>
|
|
<way id="10" user="a" uid="55988" visible="true" version="5" changeset="4142606" timestamp="2010-03-16T11:47:08Z">
|
|
<nd ref="1"/>
|
|
<nd ref="2"/>
|
|
<tag k="highway" v="unclassified"/>
|
|
</way>
|
|
</osm>
|
|
EOS
|
|
|
|
(testpath/"tiny-profile.lua").write <<~EOS
|
|
function way_function (way, result)
|
|
result.forward_mode = mode.driving
|
|
result.forward_speed = 1
|
|
end
|
|
EOS
|
|
safe_system "#{bin}/osrm-extract", "test.osm", "--profile", "tiny-profile.lua"
|
|
safe_system "#{bin}/osrm-contract", "test.osrm"
|
|
assert_predicate testpath/"test.osrm.names", :exist?, "osrm-extract generated no output!"
|
|
end
|
|
end
|