This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 534ef71eca GH-48025: [C++][GLib] Replace instances where build path is
being added to built artifacts (#48026)
534ef71eca is described below
commit 534ef71eca582006668f6f4ac83b47dd695d2020
Author: Raúl Cumplido <[email protected]>
AuthorDate: Mon Nov 3 12:23:20 2025 +0100
GH-48025: [C++][GLib] Replace instances where build path is being added to
built artifacts (#48026)
### Rationale for this change
There are several places where we are adding the build path on our built
artifacts. We should avoid that in order to improve reproducibility of our
builds.
### What changes are included in this PR?
General build system hygiene improvement redacting absolute paths from the
compiler flags to improve build reproducibility and caching efficiency.
Update for mkenums from full `@ filename@` to `@ basename@` as seen on
their official documentation:
> The base name of the input file currently being processed (e.g. foo.h).
Typically you want to use `@ basename@` in place of `@ filename@` in your
templates, to improve the reproducibility of the build. (Since: 2.22)
### Are these changes tested?
Validated locally that reprotest doesn't fail on `enums` anymore.
CI and tests have run.
### Are there any user-facing changes?
No
* GitHub Issue: #48025
Lead-authored-by: Raúl Cumplido <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
c_glib/arrow-dataset-glib/enums.c.template | 2 +-
c_glib/arrow-dataset-glib/enums.h.template | 2 +-
c_glib/arrow-glib/enums.c.template | 2 +-
c_glib/arrow-glib/enums.h.template | 2 +-
c_glib/gandiva-glib/enums.c.template | 2 +-
c_glib/gandiva-glib/enums.h.template | 2 +-
cpp/src/arrow/CMakeLists.txt | 4 ++++
cpp/src/arrow/util/config.h.cmake | 1 -
cpp/src/arrow/util/config_internal.h.cmake | 2 ++
9 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/c_glib/arrow-dataset-glib/enums.c.template
b/c_glib/arrow-dataset-glib/enums.c.template
index 8921ab0625..d1f774a767 100644
--- a/c_glib/arrow-dataset-glib/enums.c.template
+++ b/c_glib/arrow-dataset-glib/enums.c.template
@@ -23,7 +23,7 @@
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/c_glib/arrow-dataset-glib/enums.h.template
b/c_glib/arrow-dataset-glib/enums.h.template
index 8b89a8b031..f658f47495 100644
--- a/c_glib/arrow-dataset-glib/enums.h.template
+++ b/c_glib/arrow-dataset-glib/enums.h.template
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/c_glib/arrow-glib/enums.c.template
b/c_glib/arrow-glib/enums.c.template
index 6806ed194e..9a5a9ba09c 100644
--- a/c_glib/arrow-glib/enums.c.template
+++ b/c_glib/arrow-glib/enums.c.template
@@ -23,7 +23,7 @@
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/c_glib/arrow-glib/enums.h.template
b/c_glib/arrow-glib/enums.h.template
index e49b717fb3..ee1fb5f7a0 100644
--- a/c_glib/arrow-glib/enums.h.template
+++ b/c_glib/arrow-glib/enums.h.template
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/c_glib/gandiva-glib/enums.c.template
b/c_glib/gandiva-glib/enums.c.template
index 7ea2ea7b5f..5f8b80a770 100644
--- a/c_glib/gandiva-glib/enums.c.template
+++ b/c_glib/gandiva-glib/enums.c.template
@@ -23,7 +23,7 @@
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/c_glib/gandiva-glib/enums.h.template
b/c_glib/gandiva-glib/enums.h.template
index d362e14c1b..d07ed46801 100644
--- a/c_glib/gandiva-glib/enums.h.template
+++ b/c_glib/gandiva-glib/enums.h.template
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index 25e5749335..2e5c67e07b 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -342,6 +342,10 @@ macro(append_runtime_avx512_src SRCS SRC)
endmacro()
# Write out compile-time configuration constants
+string(REPLACE "${CMAKE_SOURCE_DIR}" "<CMAKE_SOURCE_DIR>" REDACTED_CXX_FLAGS
+ ${CMAKE_CXX_FLAGS})
+string(REPLACE "${CMAKE_BINARY_DIR}" "<CMAKE_BINARY_DIR>" REDACTED_CXX_FLAGS
+ ${REDACTED_CXX_FLAGS})
configure_file("util/config.h.cmake" "util/config.h" ESCAPE_QUOTES)
configure_file("util/config_internal.h.cmake" "util/config_internal.h"
ESCAPE_QUOTES)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/util/config.h"
diff --git a/cpp/src/arrow/util/config.h.cmake
b/cpp/src/arrow/util/config.h.cmake
index ddff1379b1..cf98757c4a 100644
--- a/cpp/src/arrow/util/config.h.cmake
+++ b/cpp/src/arrow/util/config.h.cmake
@@ -27,7 +27,6 @@
#define ARROW_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
#define ARROW_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
-#define ARROW_CXX_COMPILER_FLAGS "@CMAKE_CXX_FLAGS@"
#define ARROW_BUILD_TYPE "@UPPERCASE_BUILD_TYPE@"
diff --git a/cpp/src/arrow/util/config_internal.h.cmake
b/cpp/src/arrow/util/config_internal.h.cmake
index e90f7ee12d..5d96e6fc68 100644
--- a/cpp/src/arrow/util/config_internal.h.cmake
+++ b/cpp/src/arrow/util/config_internal.h.cmake
@@ -18,5 +18,7 @@
// These variables are not exposed as they can make compilation caching
// and increment builds less efficient.
+#define ARROW_CXX_COMPILER_FLAGS "@REDACTED_CXX_FLAGS@"
+
#define ARROW_GIT_ID "@ARROW_GIT_ID@"
#define ARROW_GIT_DESCRIPTION "@ARROW_GIT_DESCRIPTION@"