mariadb: support reproducible builds

In order to support reproducible builds [1]

1. While using bison to generate source code, add option --file-prefix-map [2]
to remove build path prefix in the generated header file.

2. Remove link directories for Yocto to drop source path
from compile link option

[1] https://reproducible-builds.org/
[2] https://cgit.git.savannah.gnu.org/cgit/bison.git/commit/?id=dd878d18519689c7bbcd72de4c9f9e53085a3cbf

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Hongxu Jia 2025-11-14 16:08:24 +08:00 committed by Khem Raj
parent 5375b936eb
commit fdec68e4b1
No known key found for this signature in database
GPG Key ID: BB053355919D3314
4 changed files with 80 additions and 3 deletions

View File

@ -212,9 +212,6 @@ OEQA_REPRODUCIBLE_EXCLUDED_PACKAGES += " \
lprng-dbg \
lshw \
lshw-locale-fr \
mariadb-dbg \
mariadb-server \
mariadb-src \
mce-test \
mime-support-doc \
minifi-cpp \

View File

@ -25,6 +25,8 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \
file://0001-Ensure-compatibility-with-ARMv9-by-updating-.arch-di.patch \
file://riscv32.patch \
file://0001-Remove-x86-specific-loop-in-my_convert.patch \
file://0001-support-reproducible-builds.patch \
file://0001-storage-mroonga-CMakeLists.txt-fix-reproducible-buil.patch \
"
SRC_URI[sha256sum] = "52fa4dca2c5f80afc1667d523a27c06176d98532298a6b0c31ed73505f49e15c"

View File

@ -0,0 +1,40 @@
From 5e53d0f2ef08b0805136adf580b5e84fee9fcfc9 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 14 Nov 2025 15:35:52 +0800
Subject: [PATCH] storage/mroonga/CMakeLists.txt: fix reproducible builds
Due to the link diretory includes source path and then the compile option
-WR,rpath,xxx caused the generated libarary not to be reproducible
...
|path-to/mariadb/11.4.8/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ ...
-Wl,-rpath,path-to/mariadb/11.4.8/sources/mariadb-11.4.8/storage/mroonga/vendor/groonga/lib:
path-to/mariadb/11.4.8/sources/mariadb-11.4.8/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/normalizers:
path/mariadb/11.4.8/sources/mariadb-11.4.8/libservices: ...
...
Remove it for Yocto without regression
Upstream-Status: Inappropriate [OE specific, the removing code may matter for others]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
storage/mroonga/CMakeLists.txt | 3 ---
1 file changed, 3 deletions(-)
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index 1538b6cc..cdccb2c5 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -298,9 +298,6 @@ else()
set(MYSQL_LIBRARY_DIRS
"${MYSQL_SERVICES_LIB_DIR}")
endif()
-link_directories(
- ${MRN_LIBRARY_DIRS}
- ${MYSQL_LIBRARY_DIRS})
set(MRN_ALL_SOURCES
${MRN_SOURCES}
--
2.34.1

View File

@ -0,0 +1,38 @@
From ff394a977e699e1b757c6e83143e1f330e20ca37 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Fri, 14 Nov 2025 12:38:20 +0800
Subject: [PATCH] support reproducible builds
In order to support reproducible builds [1], while using bison to generate
source code, add option --file-prefix-map [2] to remove build path prefix
in the generated header file.
[1] https://reproducible-builds.org/
[2] https://cgit.git.savannah.gnu.org/cgit/bison.git/commit/?id=dd878d18519689c7bbcd72de4c9f9e53085a3cbf
Upstream-Status: Submitted [https://github.com/MariaDB/server/pull/4440]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
sql/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 3a7c9d36..ac868072 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -400,10 +400,10 @@ ELSE()
CONFIGURE_FILE(myskel.m4.in myskel.m4)
BISON_TARGET(gen_mariadb_cc_hh ${CMAKE_CURRENT_BINARY_DIR}/yy_mariadb.yy
${CMAKE_CURRENT_BINARY_DIR}/yy_mariadb.cc
- COMPILE_FLAGS "-p MYSQL -S ${CMAKE_CURRENT_BINARY_DIR}/myskel.m4")
+ COMPILE_FLAGS "-p MYSQL -S ${CMAKE_CURRENT_BINARY_DIR}/myskel.m4 --file-prefix-map=${CMAKE_BINARY_DIR}=''")
BISON_TARGET(gen_oracle_cc_hh ${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.yy
${CMAKE_CURRENT_BINARY_DIR}/yy_oracle.cc
- COMPILE_FLAGS "-p ORA -S ${CMAKE_CURRENT_BINARY_DIR}/myskel.m4")
+ COMPILE_FLAGS "-p ORA -S ${CMAKE_CURRENT_BINARY_DIR}/myskel.m4 --file-prefix-map=${CMAKE_BINARY_DIR}=''")
ENDIF()
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
--
2.34.1