Skip to content

[CI][C++][Homebrew] Backport the latest formula changes #45416

@hiroyuki-sato

Description

@hiroyuki-sato

Describe the enhancement requested

@kou commented

BTW, we should resync this and apache-arrow-glib.rb

#45403 (comment)

  • +: arrow: f872372
  • -: homebrew: a1a732638478050c5739c2e87a72fb3941c6c5c9
diff -ru /tmp/arrow dev/tasks/homebrew-formulae/
diff -ru /tmp/arrow/apache-arrow-glib.rb dev/tasks/homebrew-formulae/apache-arrow-glib.rb
--- /tmp/arrow/apache-arrow-glib.rb	2025-02-03 09:30:42
+++ dev/tasks/homebrew-formulae/apache-arrow-glib.rb	2025-01-31 13:28:00
@@ -1,9 +1,36 @@
+# BSD 2-Clause License
+#
+# Copyright (c) 2009-present, Homebrew contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# https://github.com/Homebrew/homebrew-core/blob/-/Formula/a/apache-arrow-glib.rb
+
 class ApacheArrowGlib < Formula
   desc "GLib bindings for Apache Arrow"
   homepage "https://arrow.apache.org/"
-  url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz"
-  mirror "https://archive.apache.org/dist/arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz"
-  sha256 "f89b93f39954740f7184735ff1e1d3b5be2640396febc872c4955274a011f56b"
+  url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-20.0.0-SNAPSHOT/apache-arrow-20.0.0-SNAPSHOT.tar.gz"
+  sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28"
   license "Apache-2.0"
   head "https://github.com/apache/arrow.git", branch: "main"

@@ -11,39 +38,48 @@
     formula "apache-arrow"
   end

-  bottle do
-    sha256 cellar: :any, arm64_sequoia: "e420ce8d7c772054c9040a326f54be83306741c3b13f1f95c1aa660bcc3419bc"
-    sha256 cellar: :any, arm64_sonoma:  "f7f697c4bb8922d0fd7ebea9fdedcb03798bb3ce641525bd5b5def7e30d9dbe4"
-    sha256 cellar: :any, arm64_ventura: "90c37373807d0607465aeb66dfa6a8f4e1073a1c609ac3d3968234f2f63b12ef"
-    sha256 cellar: :any, sonoma:        "2f66ab77233cfaebd4a6cb35ee75a33b6533973ee25608c88a6a4e0f074762c7"
-    sha256 cellar: :any, ventura:       "8339abe968a0697213167673c40071a958f1eb636f02da0ce33e4f61d3a8de2a"
-    sha256               x86_64_linux:  "6776b45d6bafd3bdc32f1d6d0be57e7ed60b8bf0171e87c5931ad76a176a2191"
-  end
-
   depends_on "gobject-introspection" => :build
   depends_on "meson" => :build
   depends_on "ninja" => :build
-  depends_on "pkgconf" => [:build, :test]
+  depends_on "pkg-config" => :build
+  depends_on "vala" => :build
   depends_on "apache-arrow"
   depends_on "glib"

+  fails_with gcc: "5"
+
   def install
-    system "meson", "setup", "build", "c_glib", *std_meson_args
+    system "meson", "setup", "build", "c_glib", *std_meson_args, "-Dvapi=true"
     system "meson", "compile", "-C", "build", "--verbose"
     system "meson", "install", "-C", "build"
   end

   test do
-    (testpath/"test.c").write <<~C
+    (testpath/"test.c").write <<~SOURCE
       #include <arrow-glib/arrow-glib.h>
       int main(void) {
         GArrowNullArray *array = garrow_null_array_new(10);
         g_object_unref(array);
         return 0;
       }
-    C
-
-    flags = shell_output("pkgconf --cflags --libs arrow-glib gobject-2.0").chomp.split
+    SOURCE
+    apache_arrow = Formula["apache-arrow"]
+    glib = Formula["glib"]
+    flags = %W[
+      -I#{include}
+      -I#{apache_arrow.opt_include}
+      -I#{glib.opt_include}/glib-2.0
+      -I#{glib.opt_lib}/glib-2.0/include
+      -L#{lib}
+      -L#{apache_arrow.opt_lib}
+      -L#{glib.opt_lib}
+      -DNDEBUG
+      -larrow-glib
+      -larrow
+      -lgio-2.0
+      -lgobject-2.0
+      -lglib-2.0
+    ]
     system ENV.cc, "test.c", "-o", "test", *flags
     system "./test"
   end
diff -ru /tmp/arrow/apache-arrow.rb dev/tasks/homebrew-formulae/apache-arrow.rb
--- /tmp/arrow/apache-arrow.rb	2025-02-02 11:32:18
+++ dev/tasks/homebrew-formulae/apache-arrow.rb	2025-02-02 00:27:59
@@ -1,60 +1,70 @@
+# BSD 2-Clause License
+#
+# Copyright (c) 2009-present, Homebrew contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# https://github.com/Homebrew/homebrew-core/blob/-/Formula/a/apache-arrow.rb
+
 class ApacheArrow < Formula
   desc "Columnar in-memory analytics layer designed to accelerate big data"
   homepage "https://arrow.apache.org/"
-  url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz"
-  mirror "https://archive.apache.org/dist/arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz"
-  sha256 "f89b93f39954740f7184735ff1e1d3b5be2640396febc872c4955274a011f56b"
+  url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-20.0.0-SNAPSHOT/apache-arrow-20.0.0-SNAPSHOT.tar.gz"
+  sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28"
   license "Apache-2.0"
-  revision 1
   head "https://github.com/apache/arrow.git", branch: "main"

-  bottle do
-    sha256 cellar: :any,                 arm64_sequoia: "a6c9c00a48857deb74c1d00bbf7858466307853629866e9500fe57dc5889eb58"
-    sha256 cellar: :any,                 arm64_sonoma:  "d1b3aa26f91c7c452a60dca1b590c54b0026a5ee05a9c148782946c66d878c6e"
-    sha256 cellar: :any,                 arm64_ventura: "5d71a8bd28fd50e5bf190c3764e5cf1367d2c6ee45fc0b3850da6f178cb0d5eb"
-    sha256 cellar: :any,                 sonoma:        "45a9742c35214fd74301c6261a5f137e43b5e4be2c0b1281567e5699d35f46a9"
-    sha256 cellar: :any,                 ventura:       "bac30f19cf4bb0ed2c444a782152b8458ebcdfd3602e0f7f70457e4b0faf9396"
-    sha256 cellar: :any_skip_relocation, x86_64_linux:  "4699146750ca07631a98168da1b237315363dbaa0dd4fae8f4ad29044e724545"
-  end
-
   depends_on "boost" => :build
   depends_on "cmake" => :build
-  depends_on "gflags" => :build
-  depends_on "rapidjson" => :build
-  depends_on "xsimd" => :build
-  depends_on "abseil"
-  depends_on "aws-crt-cpp"
+  depends_on "llvm@15" => :build
   depends_on "aws-sdk-cpp"
   depends_on "brotli"
+  depends_on "bzip2"
+  depends_on "glog"
   depends_on "grpc"
-  depends_on "llvm"
   depends_on "lz4"
+  depends_on "mimalloc"
   depends_on "openssl@3"
   depends_on "protobuf"
+  depends_on "rapidjson"
   depends_on "re2"
   depends_on "snappy"
   depends_on "thrift"
   depends_on "utf8proc"
   depends_on "zstd"
-
   uses_from_macos "python" => :build
-  uses_from_macos "bzip2"
-  uses_from_macos "zlib"

-  # Issue ref: https://github.com/protocolbuffers/protobuf/issues/19447
-  fails_with :gcc do
-    version "12"
-    cause "Protobuf 29+ generated code with visibility and deprecated attributes needs GCC 13+"
-  end
+  fails_with gcc: "5"

   def install
-    ENV.llvm_clang if OS.linux?
+    # This isn't for https://github.com/Homebrew/homebrew-core/issues/76537 .
+    # This may improve performance.
+    ENV.runtime_cpu_detection if Hardware::CPU.intel?

-    # We set `ARROW_ORC=OFF` because it fails to build with Protobuf 27.0
+    # link against system libc++ instead of llvm provided libc++
+    ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
     args = %W[
       -DCMAKE_INSTALL_RPATH=#{rpath}
-      -DLLVM_ROOT=#{Formula["llvm"].opt_prefix}
-      -DARROW_DEPENDENCY_SOURCE=SYSTEM
       -DARROW_ACERO=ON
       -DARROW_COMPUTE=ON
       -DARROW_CSV=ON
@@ -63,31 +73,29 @@
       -DARROW_FLIGHT=ON
       -DARROW_FLIGHT_SQL=ON
       -DARROW_GANDIVA=ON
+      -DARROW_GCS=ON
       -DARROW_HDFS=ON
+      -DARROW_INSTALL_NAME_RPATH=OFF
       -DARROW_JSON=ON
-      -DARROW_ORC=OFF
+      -DARROW_MIMALLOC=ON
+      -DARROW_ORC=ON
       -DARROW_PARQUET=ON
       -DARROW_PROTOBUF_USE_SHARED=ON
       -DARROW_S3=ON
+      -DARROW_WITH_BROTLI=ON
       -DARROW_WITH_BZ2=ON
-      -DARROW_WITH_ZLIB=ON
-      -DARROW_WITH_ZSTD=ON
       -DARROW_WITH_LZ4=ON
       -DARROW_WITH_SNAPPY=ON
-      -DARROW_WITH_BROTLI=ON
       -DARROW_WITH_UTF8PROC=ON
-      -DARROW_INSTALL_NAME_RPATH=OFF
+      -DARROW_WITH_ZLIB=ON
+      -DARROW_WITH_ZSTD=ON
       -DPARQUET_BUILD_EXECUTABLES=ON
     ]
-    args << "-DARROW_MIMALLOC=ON" unless Hardware::CPU.arm?
-    # Reduce overlinking. Can remove on Linux if GCC 11 issue is fixed
-    args << "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,#{OS.mac? ? "-dead_strip_dylibs" : "--as-needed"}"
-    # ARROW_SIMD_LEVEL sets the minimum required SIMD. Since this defaults to
-    # SSE4.2 on x86_64, we need to reduce level to match oldest supported CPU.
-    # Ref: https://arrow.apache.org/docs/cpp/env_vars.html#envvar-ARROW_USER_SIMD_LEVEL
-    if build.bottle? && Hardware::CPU.intel? && (!OS.mac? || !MacOS.version.requires_sse42?)
-      args << "-DARROW_SIMD_LEVEL=NONE"
-    end
+    # Disable runtime SIMD dispatch. It may cause "illegal opcode"
+    # error on Intel Mac because of one-definition-rule violation.
+    #
+    # https://github.com/apache/arrow/issues/36685
+    args << "-DARROW_RUNTIME_SIMD_LEVEL=NONE" if OS.mac? and Hardware::CPU.intel?

     system "cmake", "-S", "cpp", "-B", "build", *args, *std_cmake_args
     system "cmake", "--build", "build"
@@ -95,15 +103,13 @@
   end

   test do
-    ENV.method(DevelopmentTools.default_compiler).call if OS.linux?
-
-    (testpath/"test.cpp").write <<~CPP
+    (testpath/"test.cpp").write <<~EOS
       #include "arrow/api.h"
       int main(void) {
         arrow::int64();
         return 0;
       }
-    CPP
+    EOS
     system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-L#{lib}", "-larrow", "-o", "test"
     system "./test"
   end
Only in dev/tasks/homebrew-formulae: github.macos.yml

Component(s)

Continuous Integration

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions