Skip to contentSkip to conversation

icu: remove host references in nativesdk to fix reproducibility

PATCH In review Oleksandr Hnatiuk 2 participants 3 messages Jul 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 icu: remove host references in nativesdk to fix reproducibility

Fix is only done for target. Copy same code for nativesdk.

---
 meta/recipes-support/icu/icu_75-1.bb | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
meta/recipes-support/icu/icu_75-1.bb +19 -0
index 27fe392e4d4e..4b7023fd06e1 100644
@@ -39,6 +39,15 @@ do_compile:prepend:class-target () {
 	    -i ${B}/tools/toolutil/Makefile
 }
 
+do_compile:prepend:class-nativesdk () {
+	# Make sure certain build host references do not end up being compiled
+	# in the image. This only affects libicutu and icu-dbg
+	sed  \
+	    -e 's,DU_BUILD=,DU_BUILD_unused=,g' \
+	    -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \
+	    -i ${B}/tools/toolutil/Makefile
+}
+
 PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}"
 do_install:append:class-native() {
 	mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config
@@ -66,6 +75,16 @@ do_install:append:class-target() {
 	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
 }
 
+do_install:append:class-nativesdk() {
+	# Remove build host references...
+	sed -i  \
+	    -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+	    -e 's|${DEBUG_PREFIX_MAP}||g' \
+	    -e 's:${HOSTTOOLS_DIR}/::g' \
+	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \
+	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
+}
+
 PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
 
 FILES:${PN}-dev += "${libdir}/${BPN}/"
Signature · 1 line
2.35.6
#1 lore raw

You need to put this into a function, and call it from various places, instead of just copy-pasting code.

Alex

Quoted 58 lines · Oleksandr Hnatiuk via lists.openembedded.org

Fix is only done for target. Copy same code for nativesdk.

---
 meta/recipes-support/icu/icu_75-1.bb | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
meta/recipes-support/icu/icu_75-1.bb +19 -1
index 27fe392e4d4e..4b7023fd06e1 100644
@@ -39,6 +39,15 @@ do_compile:prepend:class-target () {
            -i ${B}/tools/toolutil/Makefile
 }
 
+do_compile:prepend:class-nativesdk () {
+       # Make sure certain build host references do not end up being compiled
+       # in the image. This only affects libicutu and icu-dbg
+       sed  \
+           -e 's,DU_BUILD=,DU_BUILD_unused=,g' \
+           -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \
+           -i ${B}/tools/toolutil/Makefile
+}
+
 PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}"
 do_install:append:class-native() {
        mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config
@@ -66,6 +75,16 @@ do_install:append:class-target() {
            ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
 }
 
+do_install:append:class-nativesdk() {
+       # Remove build host references...
+       sed -i  \
+           -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+           -e 's|${DEBUG_PREFIX_MAP}||g' \
+           -e 's:${HOSTTOOLS_DIR}/::g' \
+           ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \
+           ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
+}
+
 PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
 
 FILES:${PN}-dev += "${libdir}/${BPN}/"
--

2.35.6

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

#2 lore raw

PATCH 1/1 icu: remove host references in nativesdk to fix reproducibility

Fix is only done for target. Use same code for nativesdk.

---
 meta/recipes-support/icu/icu_75-1.bb | 33 ++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 9 deletions(-)
meta/recipes-support/icu/icu_75-1.bb +24 -9
index 27fe392e4d4e..57c9fc03612a 100644
@@ -30,7 +30,7 @@ TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', '
 
 ASNEEDED = ""
 
-do_compile:prepend:class-target () {
+remove_build_host_references_from_libicutu () {
 	# Make sure certain build host references do not end up being compiled
 	# in the image. This only affects libicutu and icu-dbg
 	sed  \
@@ -39,6 +39,14 @@ do_compile:prepend:class-target () {
 	    -i ${B}/tools/toolutil/Makefile
 }
 
+do_compile:prepend:class-target () {
+	remove_build_host_references_from_libicutu
+}
+
+do_compile:prepend:class-nativesdk () {
+	remove_build_host_references_from_libicutu
+}
+
 PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}"
 do_install:append:class-native() {
 	mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config
@@ -49,6 +57,15 @@ do_install:append:class-native() {
 	cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE}
 }
 
+remove_build_host_references() {
+	sed -i  \
+	    -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+	    -e 's|${DEBUG_PREFIX_MAP}||g' \
+	    -e 's:${HOSTTOOLS_DIR}/::g' \
+	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \
+	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
+}
+
 do_install:append:class-target() {
     # The native pkgdata can not generate the correct data file.
     # Use icupkg to re-generate it.
@@ -56,14 +73,12 @@ do_install:append:class-target() {
         rm -f ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat
         icupkg -tb ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat
     fi
-	
-	# Remove build host references...
-	sed -i  \
-	    -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
-	    -e 's|${DEBUG_PREFIX_MAP}||g' \
-	    -e 's:${HOSTTOOLS_DIR}/::g' \
-	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \
-	    ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc
+
+	remove_build_host_references
+}
+
+do_install:append:class-nativesdk() {
+	remove_build_host_references
 }
 
 PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio"
Signature · 1 line
2.35.6