From 86693f4a53809bdfe7dbd80d9912208c7085673b Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 28 Feb 2026 22:56:53 -0800 Subject: [PATCH 1/3] Add script for creating formulae from existing Currently creates rotary formulae from Jetty, excluding gz-launch. Signed-off-by: Steve Peters --- .github/ci/create_rotary_formulae.sh | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/ci/create_rotary_formulae.sh diff --git a/.github/ci/create_rotary_formulae.sh b/.github/ci/create_rotary_formulae.sh new file mode 100644 index 000000000..baa26d03a --- /dev/null +++ b/.github/ci/create_rotary_formulae.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +for j in $(ls Aliases/gz-jetty-* | grep -v launch) +do + p=$(basename $j | sed -e 's@.*gz-jetty-@@') + # set `r` to rotary formula path, like Formula/gz-rotary-math.rb + r=Formula/$(basename $j | sed -e 's@gz-jetty-@gz-rotary-@' -e 's@[0-9]*@@').rb + # copy jetty formula to rotary and fix class name, dependencies, and head branch + brew cat $(basename $j) > ${r} + sed -e 's@class Gz\([A-Za-z]*\)[0-9]*@class GzRotary\1@' \ + -e 's@class Sdformat[0-9]*@class GzRotarySdformat@' \ + -e 's@\(depends_on "gz-\)\([a-z_-]*\)[0-9]*"@\1rotary-\2"@' \ + -e 's@\(depends_on "sdformat\)[0-9]*"@depends_on "gz-rotary-sdformat"@' \ + -e 's@gz-gui-10@gz-gui@' \ + -e 's@gz-physics-9@gz-physics@' \ + -e 's@gz-rendering-10@gz-rendering@' \ + -e 's@gz-sim-10@gz-sim@' \ + -e 's@gz/plugin4@gz/plugin@' \ + -e 's@gz/sim10@gz/sim@' \ + -e 's@gz/transport15@gz/transport@' \ + -e 's@\(Formula\["gz-\)\([a-z_-]*\)[0-9]*"@\1rotary-\2"@' \ + -e 's@^.*head\( .* branch: "\).*$@ head\1main"@' \ + -i -- ${r} + # remove bottle block + brew bump-revision ${r} --remove-bottle-block --write-only + # remove unneeded lines + sed -e '/^ url /d' \ + -e '/^ sha256 /d' \ + -e '/^ revision /d' \ + -e '/^ conflicts_with "gz-rotary-/d' \ + -e '/^ depends_on "freeimage"/d' \ + -e '/qt@5/d' \ + -i -- ${r} + # add conflicts_with + sed -e '/^ def install/i \ + conflicts_with "", because: "both install gz-"\ + +' -i -- ${r} + sed -e "s@conflicts_with \"\",.*@conflicts_with \"$(basename $j)\", because: \"both install gz-${p}\"@" \ + -i -- ${r} + # add caveats + sed -e '/^ test do/i \ + def caveats\ + <<~EOS\ + This is an unstable, development version of Gazebo built from source.\ + EOS\ + end\ + +' -i -- ${r} + + # add matching conflicts_with to jetty if not already present + if ! grep 'conflicts_with "gz-rotary-' ${j} > /dev/null ; then + sed -e '/^ def install/i \ + conflicts_with "", because: "both install gz-"\ + +' -i -- Aliases/$(readlink ${j}) + sed -e "s@conflicts_with \"\".*@conflicts_with \"gz-rotary-${p}\", because: \"both install gz-${p}\"@" \ + -i -- Aliases/$(readlink ${j}) + fi + + # create symlink for next numbered version to rotary formula + f=$(basename $(readlink $j) | sed -e 's@\.rb@@') + n=$(echo $f | sed -e 's@[^0-9]*@@') + next=$(python3 -c "print($n + 1)") + f_next=$(echo $f | sed -e "s@$n@$next@") + ln -s ../${r} Aliases/${f_next} +done + +brew style --fix Formula/gz-rotary-* From f08b521240ce9439549aad6a1fe0d5b66da2b095 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 28 Feb 2026 22:57:42 -0800 Subject: [PATCH 2/3] Add gz-rotary-* formulae Also add conflicts_with existing formulae Signed-off-by: Steve Peters --- Formula/gz-fuel-tools11.rb | 2 + Formula/gz-gui10.rb | 2 + Formula/gz-msgs12.rb | 2 + Formula/gz-physics9.rb | 2 + Formula/gz-rendering10.rb | 2 + Formula/gz-rotary-fuel-tools.rb | 77 ++++++++++++++ Formula/gz-rotary-gui.rb | 137 ++++++++++++++++++++++++ Formula/gz-rotary-msgs.rb | 107 +++++++++++++++++++ Formula/gz-rotary-physics.rb | 122 ++++++++++++++++++++++ Formula/gz-rotary-rendering.rb | 100 ++++++++++++++++++ Formula/gz-rotary-sensors.rb | 81 +++++++++++++++ Formula/gz-rotary-sim.rb | 179 ++++++++++++++++++++++++++++++++ Formula/gz-rotary-transport.rb | 118 +++++++++++++++++++++ Formula/gz-sensors10.rb | 2 + Formula/gz-sim10.rb | 2 + Formula/gz-transport15.rb | 2 + 16 files changed, 937 insertions(+) create mode 100644 Formula/gz-rotary-fuel-tools.rb create mode 100644 Formula/gz-rotary-gui.rb create mode 100644 Formula/gz-rotary-msgs.rb create mode 100644 Formula/gz-rotary-physics.rb create mode 100644 Formula/gz-rotary-rendering.rb create mode 100644 Formula/gz-rotary-sensors.rb create mode 100644 Formula/gz-rotary-sim.rb create mode 100644 Formula/gz-rotary-transport.rb diff --git a/Formula/gz-fuel-tools11.rb b/Formula/gz-fuel-tools11.rb index 0e89bb589..6abbdc8ea 100644 --- a/Formula/gz-fuel-tools11.rb +++ b/Formula/gz-fuel-tools11.rb @@ -24,6 +24,8 @@ class GzFuelTools11 < Formula depends_on "spdlog" depends_on "tinyxml2" + conflicts_with "gz-rotary-fuel-tools", because: "both install gz-fuel-tools" + def install cmake_args = std_cmake_args cmake_args << "-DBUILD_TESTING=Off" diff --git a/Formula/gz-gui10.rb b/Formula/gz-gui10.rb index 76721b38d..3d65b5419 100644 --- a/Formula/gz-gui10.rb +++ b/Formula/gz-gui10.rb @@ -31,6 +31,8 @@ class GzGui10 < Formula depends_on "spdlog" depends_on "tinyxml2" + conflicts_with "gz-rotary-gui", because: "both install gz-gui" + def install rpaths = [ rpath, diff --git a/Formula/gz-msgs12.rb b/Formula/gz-msgs12.rb index 9ce50464d..58e2c158d 100644 --- a/Formula/gz-msgs12.rb +++ b/Formula/gz-msgs12.rb @@ -30,6 +30,8 @@ def python_cmake_arg(python = Formula["python@3.13"]) "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" end + conflicts_with "gz-rotary-msgs", because: "both install gz-msgs" + def install rpaths = [ rpath, diff --git a/Formula/gz-physics9.rb b/Formula/gz-physics9.rb index 17a15014a..a94318b9e 100644 --- a/Formula/gz-physics9.rb +++ b/Formula/gz-physics9.rb @@ -37,6 +37,8 @@ class GzPhysics9 < Formula depends_on "tinyxml2" depends_on "urdfdom" + conflicts_with "gz-rotary-physics", because: "both install gz-physics" + def install rpaths = [ rpath, diff --git a/Formula/gz-rendering10.rb b/Formula/gz-rendering10.rb index 3582e1e17..babe38db0 100644 --- a/Formula/gz-rendering10.rb +++ b/Formula/gz-rendering10.rb @@ -28,6 +28,8 @@ class GzRendering10 < Formula depends_on "ogre2.3" depends_on "spdlog" + conflicts_with "gz-rotary-rendering", because: "both install gz-rendering" + def install rpaths = [ rpath, diff --git a/Formula/gz-rotary-fuel-tools.rb b/Formula/gz-rotary-fuel-tools.rb new file mode 100644 index 000000000..b6e498b89 --- /dev/null +++ b/Formula/gz-rotary-fuel-tools.rb @@ -0,0 +1,77 @@ +class GzRotaryFuelTools < Formula + desc "Tools for using Fuel API to download robot models" + homepage "https://gazebosim.org" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-fuel-tools.git", branch: "main" + + depends_on "abseil" + depends_on "cmake" + depends_on "fmt" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-math" + depends_on "gz-rotary-msgs" + depends_on "gz-rotary-utils" + depends_on "jsoncpp" + depends_on "libyaml" + depends_on "libzip" + depends_on "pkgconf" + depends_on "protobuf" + depends_on "spdlog" + depends_on "tinyxml2" + + conflicts_with "gz-jetty-fuel-tools", because: "both install gz-fuel-tools" + + def install + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=Off" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}" + + 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 + (testpath/"test.cpp").write <<-EOS + #include + int main() { + gz::fuel_tools::ServerConfig srv; + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-fuel_tools QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-fuel_tools::gz-fuel_tools) + EOS + # test building with pkg-config + system "pkg-config", "gz-fuel_tools" + cflags = `pkg-config --cflags gz-fuel_tools`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lgz-fuel_tools", + "-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-rotary-gui.rb b/Formula/gz-rotary-gui.rb new file mode 100644 index 000000000..bcfaa5d8e --- /dev/null +++ b/Formula/gz-rotary-gui.rb @@ -0,0 +1,137 @@ +class GzRotaryGui < Formula + desc "Common libraries for robotics applications. GUI Library" + homepage "https://github.com/gazebosim/gz-gui" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-gui.git", branch: "main" + + depends_on "cmake" => [:build, :test] + depends_on "pkgconf" => [:build, :test] + depends_on "abseil" + depends_on "fmt" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-math" + depends_on "gz-rotary-msgs" + depends_on "gz-rotary-plugin" + depends_on "gz-rotary-rendering" + depends_on "gz-rotary-transport" + depends_on "gz-rotary-utils" + depends_on "protobuf" + depends_on "qt5compat" + depends_on "qtbase" + depends_on "qtcharts" + depends_on "qtdeclarative" + depends_on "qtlocation" + depends_on "qtpositioning" + depends_on "qtsvg" + depends_on "spdlog" + depends_on "tinyxml2" + + conflicts_with "gz-jetty-gui", because: "both install gz-gui" + + def install + rpaths = [ + rpath, + rpath(source: lib/"gz-gui/plugins", target: lib), + ] + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=Off" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}" + + 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 + require "system_command" + extend SystemCommand::Mixin + + # test some plugins in subfolders + %w[CameraFps Publisher TopicViewer WorldStats].each do |plugin| + p = lib/"gz-gui/plugins/lib#{plugin}.dylib" + # Use gz-plugin --info command to check plugin linking + cmd = Formula["gz-rotary-plugin"].opt_libexec/"gz/plugin/gz-plugin" + args = ["--info", "--plugin"] << p + # print command and check return code + system cmd, *args + # check that library was loaded properly + _, stderr = system_command(cmd, args:) + error_string = "Error while loading the library" + assert stderr.exclude?(error_string), error_string + end + # build against API + (testpath/"test.cpp").write <<-EOS + #include + + #ifndef Q_MOC_RUN + #include + #include + #include + #endif + + ////////////////////////////////////////////////// + int main(int _argc, char **_argv) + { + std::cout << "Hello, GUI!" << std::endl; + + // Increase verboosity so we see all messages + gz::common::Console::SetVerbosity(4); + + // Create app + gz::gui::Application app(_argc, _argv); + + // Load plugins / config + if (!app.LoadPlugin("Publisher")) + { + return 1; + } + + // Customize main window + auto win = app.findChild()->QuickWindow(); + win->setProperty("title", "Hello Window!"); + + // Run window + // app.exec(); + + std::cout << "After run" << std::endl; + + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-gui QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-gui::gz-gui) + EOS + # system "pkg-config", "gz-gui", "--cflags" + # system "pkg-config", "gz-gui", "--libs" + # cflags = `pkg-config --cflags gz-gui`.split + # ldflags = `pkg-config --libs gz-gui`.split + # system ENV.cc, "test.cpp", + # *cflags, + # *ldflags, + # "-lc++", + # "-o", "test" + ENV["GZ_PARTITION"] = rand((1 << 32) - 1).to_s + # 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-rotary-msgs.rb b/Formula/gz-rotary-msgs.rb new file mode 100644 index 000000000..a5703df6d --- /dev/null +++ b/Formula/gz-rotary-msgs.rb @@ -0,0 +1,107 @@ +class GzRotaryMsgs < Formula + desc "Middleware protobuf messages for robotics" + homepage "https://gazebosim.org" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-msgs.git", branch: "main" + + depends_on "python@3.12" => [:build, :test] + depends_on "python@3.13" => [:build, :test] + depends_on "python@3.14" => [:build, :test] + depends_on "abseil" + depends_on "cmake" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-math" + depends_on "gz-rotary-tools" + depends_on "gz-rotary-utils" + depends_on "pkgconf" + depends_on "protobuf" + depends_on "tinyxml2" + + def pythons + deps.map(&:to_formula) + .select { |f| f.name.match?(/^python@3\.\d+$/) } + end + + def python_cmake_arg(python = Formula["python@3.13"]) + "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" + end + + conflicts_with "gz-jetty-msgs", because: "both install gz-msgs" + + def install + rpaths = [ + rpath, + rpath(source: libexec/"gz/msgs", target: lib), + ] + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=Off" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}" + cmake_args << python_cmake_arg + + mkdir "build" do + system "cmake", "..", *cmake_args + system "make", "install" + end + + # this installs python files for each message that can be used by multiple + # versions of python, so symlink the files to versioned python folders + pythons.each do |python| + # remove @ from formula name + python_name = python.name.tr("@", "") + # symlink the python files directly instead of the parent folder to avoid + # brew link errors if there is a pre-existing __pycache__ folder + (lib/"#{python_name}/site-packages/gz/msgs").install_symlink Dir[lib/"python/gz/msgs/*"] + end + end + + def caveats + <<~EOS + This is an unstable, development version of Gazebo built from source. + EOS + end + + test do + system libexec/"gz/msgs/gz-msgs" + (testpath/"test.cpp").write <<-EOS + #include + int main() { + gz::msgs::UInt32; + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-msgs QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-msgs::gz-msgs) + EOS + # test building with pkg-config + system "pkg-config", "gz-msgs" + cflags = `pkg-config --cflags gz-msgs`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lgz-msgs", + "-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 + # check python import + pythons.each do |python| + system python.opt_libexec/"bin/python", "-c", "import gz.msgs" + end + system Formula["python3"].opt_libexec/"bin/python", "-c", "import gz.msgs" + # check gz msg command + ENV["GZ_CONFIG_PATH"] = "#{opt_share}/gz" + system Formula["gz-rotary-tools"].opt_bin/"gz", "msg" + end +end diff --git a/Formula/gz-rotary-physics.rb b/Formula/gz-rotary-physics.rb new file mode 100644 index 000000000..9a1cccb1d --- /dev/null +++ b/Formula/gz-rotary-physics.rb @@ -0,0 +1,122 @@ +class GzRotaryPhysics < Formula + desc "Physics library for robotics applications" + homepage "https://github.com/gazebosim/gz-physics" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-physics.git", branch: "main" + + depends_on "cmake" => [:build, :test] + + depends_on "assimp" + depends_on "bullet" + depends_on "dartsim" + depends_on "fcl" + depends_on "fmt" + depends_on "google-benchmark" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-math" + depends_on "gz-rotary-plugin" + depends_on "gz-rotary-sdformat" + depends_on "gz-rotary-utils" + depends_on "libccd" + depends_on "octomap" + depends_on "ode" + depends_on "pkgconf" + depends_on "spdlog" + depends_on "tinyxml2" + depends_on "urdfdom" + + conflicts_with "gz-jetty-physics", because: "both install gz-physics" + + def install + rpaths = [ + rpath, + rpath(source: lib/"gz-physics/engine-plugins", 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 + require "system_command" + extend SystemCommand::Mixin + + # test plugins in subfolders + %w[bullet-featherstone bullet dartsim tpe].each do |engine| + p = lib/"gz-physics/engine-plugins/libgz-physics-#{engine}-plugin.dylib" + # Use gz-plugin --info command to check plugin linking + cmd = Formula["gz-rotary-plugin"].opt_libexec/"gz/plugin/gz-plugin" + args = ["--info", "--plugin"] << p + # print command and check return code + system cmd, *args + # check that library was loaded properly + _, stderr = system_command(cmd, args:) + error_string = "Error while loading the library" + assert stderr.exclude?(error_string), error_string + end + # build against API + (testpath/"test.cpp").write <<-EOS + #include "gz/plugin/Loader.hh" + #include "gz/physics/ConstructEmpty.hh" + #include "gz/physics/RequestEngine.hh" + int main() + { + gz::plugin::Loader loader; + loader.LoadLib("#{opt_lib}/libgz-physics-dartsim-plugin.dylib"); + gz::plugin::PluginPtr dartsim = + loader.Instantiate("gz::physics::dartsim::Plugin"); + using featureList = gz::physics::FeatureList< + gz::physics::ConstructEmptyWorldFeature>; + auto engine = + gz::physics::RequestEngine3d::From(dartsim); + return engine == nullptr; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-physics REQUIRED) + find_package(gz-plugin REQUIRED COMPONENTS all) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake + gz-physics::gz-physics + gz-plugin::loader) + EOS + system "pkg-config", "gz-physics" + cflags = `pkg-config --cflags gz-physics`.split + ldflags = `pkg-config --libs gz-physics`.split + system "pkg-config", "gz-plugin-loader" + loader_cflags = `pkg-config --cflags gz-plugin-loader`.split + loader_ldflags = `pkg-config --libs gz-plugin-loader`.split + system ENV.cc, "test.cpp", + *cflags, + *ldflags, + *loader_cflags, + *loader_ldflags, + "-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-rotary-rendering.rb b/Formula/gz-rotary-rendering.rb new file mode 100644 index 000000000..b6239c5fa --- /dev/null +++ b/Formula/gz-rotary-rendering.rb @@ -0,0 +1,100 @@ +class GzRotaryRendering < Formula + desc "Rendering library for robotics applications" + homepage "https://gazebosim.org" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-rendering.git", branch: "main" + + depends_on "cmake" => [:build, :test] + depends_on "pkgconf" => [:build, :test] + + depends_on "fmt" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-math" + depends_on "gz-rotary-plugin" + depends_on "gz-rotary-utils" + depends_on "ogre1.9" + depends_on "ogre2.3" + depends_on "spdlog" + + conflicts_with "gz-jetty-rendering", because: "both install gz-rendering" + + def install + rpaths = [ + rpath, + rpath(source: lib/"gz-rendering/engine-plugins", 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 + require "system_command" + extend SystemCommand::Mixin + + # test plugins in subfolders + ["ogre", "ogre2"].each do |engine| + p = lib/"gz-rendering/engine-plugins/libgz-rendering-#{engine}.dylib" + # Use gz-plugin --info command to check plugin linking + cmd = Formula["gz-rotary-plugin"].opt_libexec/"gz/plugin/gz-plugin" + args = ["--info", "--plugin"] << p + # print command and check return code + system cmd, *args + # check that library was loaded properly + _, stderr = system_command(cmd, args:) + error_string = "Error while loading the library" + assert stderr.exclude?(error_string), error_string + end + # build against API + github_actions = ENV["HOMEBREW_GITHUB_ACTIONS"].present? + (testpath/"test.cpp").write <<-EOS + #include + #include + int main(int _argc, char** _argv) + { + gz::rendering::RenderEngine *engine = + gz::rendering::engine("ogre"); + return engine == nullptr; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-rendering REQUIRED COMPONENTS ogre ogre2) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-rendering::gz-rendering) + EOS + # test building with pkg-config + system "pkg-config", "gz-rendering" + cflags = `pkg-config --cflags gz-rendering`.split + ldflags = `pkg-config --libs gz-rendering`.split + system ENV.cc, "test.cpp", + *cflags, + *ldflags, + "-lc++", + "-o", "test" + system "./test" unless github_actions + # test building with cmake + mkdir "build" do + system "cmake", ".." + system "make" + system "./test_cmake" unless github_actions + 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-rotary-sensors.rb b/Formula/gz-rotary-sensors.rb new file mode 100644 index 000000000..ef50e31c2 --- /dev/null +++ b/Formula/gz-rotary-sensors.rb @@ -0,0 +1,81 @@ +class GzRotarySensors < Formula + desc "Sensors library for robotics applications" + homepage "https://github.com/gazebosim/gz-sensors" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-sensors.git", branch: "main" + + depends_on "cmake" => [:build, :test] + depends_on "pkgconf" => [:build, :test] + + depends_on "abseil" + depends_on "fmt" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-math" + depends_on "gz-rotary-msgs" + depends_on "gz-rotary-rendering" + depends_on "gz-rotary-sdformat" + depends_on "gz-rotary-transport" + depends_on "gz-rotary-utils" + depends_on "protobuf" + depends_on "spdlog" + depends_on "tinyxml2" + + conflicts_with "gz-jetty-sensors", because: "both install gz-sensors" + + def install + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=OFF" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}" + + 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 + (testpath/"test.cpp").write <<-EOS + #include + + int main() + { + gz::sensors::Noise noise(gz::sensors::NoiseType::NONE); + + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-sensors QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-sensors::gz-sensors) + EOS + # test building with pkg-config + system "pkg-config", "gz-sensors" + cflags = `pkg-config --cflags gz-sensors`.split + ldflags = `pkg-config --libs gz-sensors`.split + system ENV.cc, "test.cpp", + *cflags, + *ldflags, + "-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-rotary-sim.rb b/Formula/gz-rotary-sim.rb new file mode 100644 index 000000000..db77ccf1b --- /dev/null +++ b/Formula/gz-rotary-sim.rb @@ -0,0 +1,179 @@ +class GzRotarySim < Formula + desc "Gazebo Sim robot simulator" + homepage "https://github.com/gazebosim/gz-sim" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-sim.git", branch: "main" + + depends_on "cmake" => :build + depends_on "pybind11" => :build + depends_on "abseil" + depends_on "ffmpeg" + depends_on "fmt" + depends_on "gflags" + depends_on "google-benchmark" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-common" + depends_on "gz-rotary-fuel-tools" + depends_on "gz-rotary-gui" + depends_on "gz-rotary-math" + depends_on "gz-rotary-msgs" + depends_on "gz-rotary-physics" + depends_on "gz-rotary-plugin" + depends_on "gz-rotary-rendering" + depends_on "gz-rotary-sdformat" + depends_on "gz-rotary-sensors" + depends_on "gz-rotary-tools" + depends_on "gz-rotary-transport" + depends_on "gz-rotary-utils" + depends_on "libwebsockets" + depends_on "openssl@3" + depends_on "pkgconf" + depends_on "protobuf" + depends_on "python@3.14" + depends_on "qt5compat" + depends_on "qtbase" + depends_on "qtcharts" + depends_on "qtdeclarative" + depends_on "qtsvg" + depends_on "ruby" + depends_on "spdlog" + depends_on "tinyxml2" + + def pythons + deps.map(&:to_formula) + .select { |f| f.name.match?(/^python@3\.\d+$/) } + end + + def python_cmake_arg(python = Formula["python@3.14"]) + "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" + end + + conflicts_with "gz-jetty-sim", because: "both install gz-sim" + + def install + rpaths = [ + rpath, + rpath(source: lib/"gz-sim/plugins", target: lib), + rpath(source: lib/"gz-sim/plugins/gui", target: lib), + rpath(source: lib/"gz-sim/plugins/gui/GzSim", target: lib), + rpath(source: libexec/"gz/sim", target: lib), + ] + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=OFF" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}" + cmake_args << python_cmake_arg + + mkdir "build" do + system "cmake", "..", *cmake_args + system "make", "install" + end + + python = pythons.first + # remove @ from formula name + python_name = python.name.tr("@", "") + (lib/"#{python_name}/site-packages").install Dir[lib/"python/*"] + rmdir prefix/"lib/python" + end + + def caveats + <<~EOS + This is an unstable, development version of Gazebo built from source. + EOS + end + + test do + require "system_command" + extend SystemCommand::Mixin + + # test some plugins in subfolders + plugin_info = lambda { |p| + # Use gz-plugin --info command to check plugin linking + cmd = Formula["gz-rotary-plugin"].opt_libexec/"gz/plugin/gz-plugin" + args = ["--info", "--plugin"] << p + # print command and check return code + system cmd, *args + # check that library was loaded properly + _, stderr = system_command(cmd, args:) + error_string = "Error while loading the library" + assert stderr.exclude?(error_string), error_string + } + %w[altimeter log physics sensors].each do |system| + plugin_info.call lib/"gz-sim/plugins/libgz-sim-#{system}-system.dylib" + end + ["libAlignTool", "libEntityContextMenuPlugin", "libGzSceneManager", "GzSim/libEntityContextMenu"].each do |p| + plugin_info.call lib/"gz-sim/plugins/gui/#{p}.dylib" + end + # test gz-sim-main CLI tool + system libexec/"gz/sim/gz-sim-main", + "-s", "--iterations", "5", "-r", "-v", "4" + # test gz sim CLI tool + ENV["GZ_CONFIG_PATH"] = "#{opt_share}/gz" + system Formula["gz-rotary-tools"].opt_bin/"gz", + "sim", "-s", "--iterations", "5", "-r", "-v", "4" + # build against API + (testpath/"test.cpp").write <<-EOS + #include + #include + #include + #include + #include + + using namespace gz; + using namespace sim; + + ////////////////////////////////////////////////// + int main(int argc, char **argv) + { + // Warm start. Initial allocation of resources can throw off calculations. + { + // Create the entity component manager + EntityComponentManager mgr; + + // Create the matching entities + for (int i = 0; i < 100; ++i) + { + Entity entity = mgr.CreateEntity(); + mgr.CreateComponent(entity, components::World()); + mgr.CreateComponent(entity, components::Name("world_name")); + } + + mgr.Each( + [&](const Entity &, const components::World *, + const components::Name *)->bool {return true;}); + } + + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-sim QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-sim::core) + EOS + # system "pkg-config", "--cflags", "gz-sim" + # cflags = `pkg-config --cflags gz-sim`.split + # ldflags = `pkg-config --libs gz-sim`.split + # system ENV.cc, "test.cpp", + # *cflags, + # *ldflags, + # "-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 + # check python import for first python in dependency list + [pythons.first].each do |python| + system python.opt_libexec/"bin/python", "-c", "import gz.sim" + end + system Formula["python3"].opt_libexec/"bin/python", "-c", "import gz.sim" + end +end diff --git a/Formula/gz-rotary-transport.rb b/Formula/gz-rotary-transport.rb new file mode 100644 index 000000000..b42457830 --- /dev/null +++ b/Formula/gz-rotary-transport.rb @@ -0,0 +1,118 @@ +class GzRotaryTransport < Formula + desc "Transport middleware for robotics" + homepage "https://gazebosim.org" + license "Apache-2.0" + + head "https://github.com/gazebosim/gz-transport.git", branch: "main" + + depends_on "doxygen" => [:build, :optional] + depends_on "pybind11" => :build + depends_on "python@3.12" => [:build, :test] + depends_on "python@3.13" => [:build, :test] + depends_on "python@3.14" => [:build, :test] + + depends_on "abseil" + depends_on "cmake" + depends_on "cppzmq" + depends_on "gz-rotary-cmake" + depends_on "gz-rotary-math" + depends_on "gz-rotary-msgs" + depends_on "gz-rotary-tools" + depends_on "gz-rotary-utils" + depends_on "ossp-uuid" + depends_on "pkgconf" + depends_on "protobuf" + depends_on "sqlite" + depends_on "tinyxml2" + depends_on "zeromq" + + def pythons + deps.map(&:to_formula) + .select { |f| f.name.match?(/^python@3\.\d+$/) } + end + + def python_cmake_arg(python = Formula["python@3.13"]) + "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" + end + + conflicts_with "gz-jetty-transport", because: "both install gz-transport" + + def install + rpaths = [ + rpath, + rpath(source: libexec/"gz/transport", target: lib), + ] + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=OFF" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}" + + # first build without python bindings + mkdir "build" do + system "cmake", "..", *cmake_args, "-DSKIP_PYBIND11=ON" + system "make", "install" + end + + # now build only the python bindings + pythons.each do |python| + # remove @ from formula name + python_name = python.name.tr("@", "") + mkdir "build_#{python_name}" do + system "cmake", "../python", *cmake_args, python_cmake_arg(python) + system "make", "install" + (lib/"#{python_name}/site-packages").install Dir[lib/"python/*"] + rmdir prefix/"lib/python" + end + end + end + + def caveats + <<~EOS + This is an unstable, development version of Gazebo built from source. + EOS + end + + test do + # test CLI executables + system libexec/"gz/transport/gz-transport-service" + system libexec/"gz/transport/gz-transport-topic" + # build against API + (testpath/"test.cpp").write <<-EOS + #include + #include + int main() { + gz::transport::NodeOptions options; + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) + find_package(gz-transport QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake gz-transport::gz-transport) + EOS + system "pkg-config", "gz-transport" + cflags = `pkg-config --cflags gz-transport`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lgz-transport", + "-lc++", + "-o", "test" + ENV["GZ_PARTITION"] = rand((1 << 32) - 1).to_s + 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 + # check python import + pythons.each do |python| + system python.opt_libexec/"bin/python", "-c", "import gz.transport" + end + system Formula["python3"].opt_libexec/"bin/python", "-c", "import gz.transport" + end +end diff --git a/Formula/gz-sensors10.rb b/Formula/gz-sensors10.rb index ae987f214..fe15de234 100644 --- a/Formula/gz-sensors10.rb +++ b/Formula/gz-sensors10.rb @@ -25,6 +25,8 @@ class GzSensors10 < Formula depends_on "spdlog" depends_on "tinyxml2" + conflicts_with "gz-rotary-sensors", because: "both install gz-sensors" + def install cmake_args = std_cmake_args cmake_args << "-DBUILD_TESTING=OFF" diff --git a/Formula/gz-sim10.rb b/Formula/gz-sim10.rb index c90274949..84298d524 100644 --- a/Formula/gz-sim10.rb +++ b/Formula/gz-sim10.rb @@ -52,6 +52,8 @@ def python_cmake_arg(python = Formula["python@3.14"]) "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" end + conflicts_with "gz-rotary-sim", because: "both install gz-sim" + def install rpaths = [ rpath, diff --git a/Formula/gz-transport15.rb b/Formula/gz-transport15.rb index c2a497c7a..3409a3515 100644 --- a/Formula/gz-transport15.rb +++ b/Formula/gz-transport15.rb @@ -38,6 +38,8 @@ def python_cmake_arg(python = Formula["python@3.13"]) "-DPython3_EXECUTABLE=#{python.opt_libexec}/bin/python" end + conflicts_with "gz-rotary-transport", because: "both install gz-transport" + def install rpaths = [ rpath, From 5d6fa4c00a08ac0c546d6e9d72d7c4a69ddd8e56 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 28 Feb 2026 23:50:13 -0800 Subject: [PATCH 3/3] Add aliases to new numbered formulae Signed-off-by: Steve Peters --- Aliases/gz-fuel-tools12 | 1 + Aliases/gz-gui11 | 1 + Aliases/gz-msgs13 | 1 + Aliases/gz-physics10 | 1 + Aliases/gz-rendering11 | 1 + Aliases/gz-sensors11 | 1 + Aliases/gz-sim11 | 1 + Aliases/gz-transport16 | 1 + 8 files changed, 8 insertions(+) create mode 120000 Aliases/gz-fuel-tools12 create mode 120000 Aliases/gz-gui11 create mode 120000 Aliases/gz-msgs13 create mode 120000 Aliases/gz-physics10 create mode 120000 Aliases/gz-rendering11 create mode 120000 Aliases/gz-sensors11 create mode 120000 Aliases/gz-sim11 create mode 120000 Aliases/gz-transport16 diff --git a/Aliases/gz-fuel-tools12 b/Aliases/gz-fuel-tools12 new file mode 120000 index 000000000..dd4312c61 --- /dev/null +++ b/Aliases/gz-fuel-tools12 @@ -0,0 +1 @@ +../Formula/gz-rotary-fuel-tools.rb \ No newline at end of file diff --git a/Aliases/gz-gui11 b/Aliases/gz-gui11 new file mode 120000 index 000000000..04d3ca53d --- /dev/null +++ b/Aliases/gz-gui11 @@ -0,0 +1 @@ +../Formula/gz-rotary-gui.rb \ No newline at end of file diff --git a/Aliases/gz-msgs13 b/Aliases/gz-msgs13 new file mode 120000 index 000000000..c7d1cacd4 --- /dev/null +++ b/Aliases/gz-msgs13 @@ -0,0 +1 @@ +../Formula/gz-rotary-msgs.rb \ No newline at end of file diff --git a/Aliases/gz-physics10 b/Aliases/gz-physics10 new file mode 120000 index 000000000..66d16ebf5 --- /dev/null +++ b/Aliases/gz-physics10 @@ -0,0 +1 @@ +../Formula/gz-rotary-physics.rb \ No newline at end of file diff --git a/Aliases/gz-rendering11 b/Aliases/gz-rendering11 new file mode 120000 index 000000000..c0ba264ce --- /dev/null +++ b/Aliases/gz-rendering11 @@ -0,0 +1 @@ +../Formula/gz-rotary-rendering.rb \ No newline at end of file diff --git a/Aliases/gz-sensors11 b/Aliases/gz-sensors11 new file mode 120000 index 000000000..d1debf464 --- /dev/null +++ b/Aliases/gz-sensors11 @@ -0,0 +1 @@ +../Formula/gz-rotary-sensors.rb \ No newline at end of file diff --git a/Aliases/gz-sim11 b/Aliases/gz-sim11 new file mode 120000 index 000000000..4e81ca92e --- /dev/null +++ b/Aliases/gz-sim11 @@ -0,0 +1 @@ +../Formula/gz-rotary-sim.rb \ No newline at end of file diff --git a/Aliases/gz-transport16 b/Aliases/gz-transport16 new file mode 120000 index 000000000..02671b0e7 --- /dev/null +++ b/Aliases/gz-transport16 @@ -0,0 +1 @@ +../Formula/gz-rotary-transport.rb \ No newline at end of file