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 <[email protected]>
---
 meta-oe/conf/layer.conf                       |  3 --
 meta-oe/recipes-dbs/mysql/mariadb.inc         |  2 +
 ...CMakeLists.txt-fix-reproducible-buil.patch | 40 +++++++++++++++++++
 .../0001-support-reproducible-builds.patch    | 38 ++++++++++++++++++
 4 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 
meta-oe/recipes-dbs/mysql/mariadb/0001-storage-mroonga-CMakeLists.txt-fix-reproducible-buil.patch
 create mode 100644 
meta-oe/recipes-dbs/mysql/mariadb/0001-support-reproducible-builds.patch

diff --git a/meta-oe/conf/layer.conf b/meta-oe/conf/layer.conf
index 23af8d0183..83b790fa18 100644
--- a/meta-oe/conf/layer.conf
+++ b/meta-oe/conf/layer.conf
@@ -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 \
diff --git a/meta-oe/recipes-dbs/mysql/mariadb.inc 
b/meta-oe/recipes-dbs/mysql/mariadb.inc
index 6e07f1ffa9..a757a10bfe 100644
--- a/meta-oe/recipes-dbs/mysql/mariadb.inc
+++ b/meta-oe/recipes-dbs/mysql/mariadb.inc
@@ -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"
 
diff --git 
a/meta-oe/recipes-dbs/mysql/mariadb/0001-storage-mroonga-CMakeLists.txt-fix-reproducible-buil.patch
 
b/meta-oe/recipes-dbs/mysql/mariadb/0001-storage-mroonga-CMakeLists.txt-fix-reproducible-buil.patch
new file mode 100644
index 0000000000..c34ec92415
--- /dev/null
+++ 
b/meta-oe/recipes-dbs/mysql/mariadb/0001-storage-mroonga-CMakeLists.txt-fix-reproducible-buil.patch
@@ -0,0 +1,40 @@
+From 5e53d0f2ef08b0805136adf580b5e84fee9fcfc9 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <[email protected]>
+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 <[email protected]>
+---
+ 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
+
diff --git 
a/meta-oe/recipes-dbs/mysql/mariadb/0001-support-reproducible-builds.patch 
b/meta-oe/recipes-dbs/mysql/mariadb/0001-support-reproducible-builds.patch
new file mode 100644
index 0000000000..10e6f03df6
--- /dev/null
+++ b/meta-oe/recipes-dbs/mysql/mariadb/0001-support-reproducible-builds.patch
@@ -0,0 +1,38 @@
+From ff394a977e699e1b757c6e83143e1f330e20ca37 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <[email protected]>
+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 <[email protected]>
+---
+ 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
+
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#121690): 
https://lists.openembedded.org/g/openembedded-devel/message/121690
Mute This Topic: https://lists.openembedded.org/mt/116288934/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to