diff --git a/Aliases/gz-plugin5 b/Aliases/gz-plugin5 new file mode 120000 index 000000000..d8cbc6402 --- /dev/null +++ b/Aliases/gz-plugin5 @@ -0,0 +1 @@ +../Formula/gz-rotary-plugin.rb \ No newline at end of file diff --git a/Aliases/gz-tools3 b/Aliases/gz-tools3 new file mode 120000 index 000000000..08549ccd0 --- /dev/null +++ b/Aliases/gz-tools3 @@ -0,0 +1 @@ +../Formula/gz-rotary-tools.rb \ No newline at end of file diff --git a/Formula/gz-plugin4.rb b/Formula/gz-plugin4.rb index 59066ab35..be268d0aa 100644 --- a/Formula/gz-plugin4.rb +++ b/Formula/gz-plugin4.rb @@ -21,6 +21,8 @@ class GzPlugin4 < Formula depends_on "gz-utils4" depends_on "pkgconf" + conflicts_with "gz-rotary-plugin", because: "both install gz-plugin" + def install rpaths = [ rpath, diff --git a/Formula/gz-rotary-plugin.rb b/Formula/gz-rotary-plugin.rb new file mode 100644 index 000000000..5f826ef9b --- /dev/null +++ b/Formula/gz-rotary-plugin.rb @@ -0,0 +1,74 @@ +class GzRotaryPlugin < Formula + desc "Plugin libraries for robotics applications" + homepage "https://github.com/gazebosim/gz-plugin" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-plugin.git", branch: "main" + + depends_on "cmake" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-tools" + depends_on "gz-rotary-utils" + depends_on "pkgconf" + + conflicts_with "gz-jetty-plugin", because: "both install gz-plugin" + + def install + rpaths = [ + rpath, + rpath(source: libexec/"gz/plugin", target: lib), + ] + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=OFF" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}" + + # Use a build folder + mkdir "build" do + system "cmake", "..", *cmake_args + system "make", "install" + end + end + + def caveats + <<~EOS + This is an unstable, development version of Gazebo built from source. + EOS + end + + test do + # test CLI executable + system libexec/"gz/plugin/gz-plugin" + # build against API + (testpath/"test.cpp").write <<-EOS + #include + int main() { + gz::plugin::Loader loader; + return loader.InterfacesImplemented().size(); + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-plugin QUIET REQUIRED COMPONENTS loader) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-plugin::loader) + EOS + system "pkg-config", "gz-plugin-loader" + cflags = `pkg-config --cflags gz-plugin-loader`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lgz-plugin-loader", + "-lc++", + "-o", "test" + system "./test" + # test building with cmake + mkdir "build" do + system "cmake", ".." + system "make" + system "./test_cmake" + end + # check for Xcode frameworks in bottle + cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}" + system cmd_not_grep_xcode + end +end diff --git a/Formula/gz-tools3.rb b/Formula/gz-rotary-tools.rb similarity index 73% rename from Formula/gz-tools3.rb rename to Formula/gz-rotary-tools.rb index 9af0c2376..3b8594649 100644 --- a/Formula/gz-tools3.rb +++ b/Formula/gz-rotary-tools.rb @@ -1,32 +1,35 @@ -class GzTools3 < Formula +class GzRotaryTools < Formula desc "Entry point for Gazebo command-line tools" homepage "https://gazebosim.org" - url "https://github.com/gazebosim/gz-tools.git", branch: "main" - version "2.999.999-0-20250530" license "Apache-2.0" - head "https://github.com/gazebosim/gz-tools.git", branch: "gz-tools3" + head "https://github.com/gazebosim/gz-tools.git", branch: "main" depends_on "cmake" => :build depends_on "libyaml" => :test depends_on "ruby" => :test - depends_on "gz-cmake5" + depends_on "gz-rotary-cmake" conflicts_with "gazebo11", because: "both install bin/gz" - conflicts_with "gz-tools2", because: "both install bin/gz" + conflicts_with "gz-jetty-tools", because: "both install bin/gz" def install inreplace "src/gz.in" do |s| s.gsub! "@CMAKE_INSTALL_PREFIX@", HOMEBREW_PREFIX end - # Use a build folder mkdir "build" do system "cmake", "..", *std_cmake_args system "make", "install" end end + def caveats + <<~EOS + This is an unstable, development version of Gazebo built from source. + EOS + end + test do mkdir testpath/"config" (testpath/"config/test.yaml").write <<~EOS diff --git a/Formula/gz-tools2.rb b/Formula/gz-tools2.rb index a81534acd..ad0e64130 100644 --- a/Formula/gz-tools2.rb +++ b/Formula/gz-tools2.rb @@ -21,7 +21,7 @@ class GzTools2 < Formula depends_on "gz-cmake3" conflicts_with "gazebo11", because: "both install bin/gz" - conflicts_with "gz-tools3", because: "both install bin/gz" + conflicts_with "gz-rotary-tools", because: "both install bin/gz" def install inreplace "src/gz.in" do |s|