summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleh Matiusha <omatiush@cisco.com>2024-07-19 06:33:08 +0000
committerKhem Raj <raj.khem@gmail.com>2024-07-30 15:55:55 -0700
commit0b2616e8a3508d9f1b5ec8ede66268bd4f269f53 (patch)
tree2ea97e9ef7c41203fad115d38f07ad252fe090e0
parent79d26d1f33fe3a70cf8a24a74a93771edd18b4f0 (diff)
downloadmeta-clang-0b2616e8a3508d9f1b5ec8ede66268bd4f269f53.tar.gz
clang: improve reproducibility
Currently, class-target is reproducible, but class-nativesdk is not. What I did: - noticed that BuildVariables.inc contains meaningless path fragments after running sed, so I adjusted sed commands to remove the rest of paths as well; - moved common code into a function, which is then called twice; - changed do_compile:prepend into do_configure:append, this is more conventional and intuitive; - verified that the resulting code works for both target and nativesdk after these changes. Signed-off-by: Oleh Matiusha <omatiush@cisco.com>
-rw-r--r--recipes-devtools/clang/clang_git.bb20
1 files changed, 16 insertions, 4 deletions
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
index ad68c3e..88ae329 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -203,14 +203,23 @@ RRECOMMENDS:${PN} = "binutils"
203RRECOMMENDS:${PN}:append:class-target = " libcxx-dev" 203RRECOMMENDS:${PN}:append:class-target = " libcxx-dev"
204 204
205# patch out build host paths for reproducibility 205# patch out build host paths for reproducibility
206do_compile:prepend:class-target() { 206reproducible_build_variables() {
207 sed -i -e "s,${STAGING_DIR_NATIVE},,g" \ 207 sed -i -e "s,${DEBUG_PREFIX_MAP},,g" \
208 -e "s,${STAGING_DIR_TARGET},,g" \ 208 -e "s,--sysroot=${RECIPE_SYSROOT},,g" \
209 -e "s,${S},,g" \ 209 -e "s,${STAGING_DIR_HOST},,g" \
210 -e "s,${S}/llvm,,g" \
210 -e "s,${B},,g" \ 211 -e "s,${B},,g" \
211 ${B}/tools/llvm-config/BuildVariables.inc 212 ${B}/tools/llvm-config/BuildVariables.inc
212} 213}
213 214
215do_configure:append:class-target() {
216 reproducible_build_variables
217}
218
219do_configure:append:class-nativesdk() {
220 reproducible_build_variables
221}
222
214do_install:append() { 223do_install:append() {
215 rm -rf ${D}${libdir}/python*/site-packages/six.py 224 rm -rf ${D}${libdir}/python*/site-packages/six.py
216} 225}
@@ -276,6 +285,9 @@ do_install:append:class-nativesdk () {
276 ln -sf llvm-config ${D}${bindir}/llvm-config${PV} 285 ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
277 rm -rf ${D}${datadir}/llvm/cmake 286 rm -rf ${D}${datadir}/llvm/cmake
278 rm -rf ${D}${datadir}/llvm 287 rm -rf ${D}${datadir}/llvm
288
289 #reproducibility
290 sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
279} 291}
280 292
281PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \ 293PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \