homebrew-core/Formula/osmium-tool.rb

48 lines
2.0 KiB
Ruby

class OsmiumTool < Formula
desc "Libosmium-based command-line tool for processing OpenStreetMap data"
homepage "https://osmcode.org/osmium-tool/"
url "https://github.com/osmcode/osmium-tool/archive/v1.13.1.tar.gz"
sha256 "d6273e2614d390d8444b767018b7023bdac3538cbe094d2799eee50b6f08cd03"
license "GPL-3.0-or-later"
bottle do
sha256 cellar: :any, big_sur: "09e5b002c6ab672542b2f9ad0c82c37cb988e7d2cc98549f9c66dd6770831c9d"
sha256 cellar: :any, catalina: "9920eb1a2bbb242e0f50efe06959e18a348ca5c8ecbc37fe92e4dfe05052869d"
sha256 cellar: :any, mojave: "d6811e52a681a55880b504d684d6ba8ba19105471fecd574a8000d392689fc6d"
end
depends_on "cmake" => :build
depends_on "libosmium" => :build
depends_on "boost"
uses_from_macos "expat"
def install
protozero = Formula["libosmium"].opt_libexec/"include"
system "cmake", ".", "-DPROTOZERO_INCLUDE_DIR=#{protozero}", *std_cmake_args
system "make", "install"
end
test do
(testpath/"test.osm").write <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="handwritten">
<node id="1" lat="0.001" lon="0.001" user="Dummy User" uid="1" version="1" changeset="1" timestamp="2015-11-01T19:00:00Z"></node>
<node id="2" lat="0.002" lon="0.002" user="Dummy User" uid="1" version="1" changeset="1" timestamp="2015-11-01T19:00:00Z"></node>
<way id="1" user="Dummy User" uid="1" version="1" changeset="1" timestamp="2015-11-01T19:00:00Z">
<nd ref="1"/>
<nd ref="2"/>
<tag k="name" v="line"/>
</way>
<relation id="1" user="Dummy User" uid="1" version="1" changeset="1" timestamp="2015-11-01T19:00:00Z">
<member type="node" ref="1" role=""/>
<member type="way" ref="1" role=""/>
</relation>
</osm>
EOS
output = shell_output("#{bin}/osmium fileinfo test.osm")
assert_match(/Compression.+generator=handwritten/m, output)
system bin/"osmium", "tags-filter", "test.osm", "w/name=line", "-f", "osm"
end
end