diff options
author | Oleh Matiusha <omatiush@cisco.com> | 2024-07-19 06:33:08 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-01-08 23:26:26 -0800 |
commit | f002eb5ab051443e7b5fbc32a9505d63a67db7b6 (patch) | |
tree | ab8677f1454c906a396e4cce6727b0ceefd8b782 | |
parent | 9fbfa9db33131abdf3870a94f00199eb53e276e5 (diff) | |
download | meta-clang-f002eb5ab051443e7b5fbc32a9505d63a67db7b6.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>
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
-rw-r--r-- | recipes-devtools/clang/clang_git.bb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index f10c3af..1e3d30c 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -209,14 +209,23 @@ RRECOMMENDS:${PN} = "binutils" | |||
209 | RRECOMMENDS:${PN}:append:class-target = " libcxx-dev" | 209 | RRECOMMENDS:${PN}:append:class-target = " libcxx-dev" |
210 | 210 | ||
211 | # patch out build host paths for reproducibility | 211 | # patch out build host paths for reproducibility |
212 | do_compile:prepend:class-target() { | 212 | reproducible_build_variables() { |
213 | sed -i -e "s,${STAGING_DIR_NATIVE},,g" \ | 213 | sed -i -e "s,${DEBUG_PREFIX_MAP},,g" \ |
214 | -e "s,${STAGING_DIR_TARGET},,g" \ | 214 | -e "s,--sysroot=${RECIPE_SYSROOT},,g" \ |
215 | -e "s,${S},,g" \ | 215 | -e "s,${STAGING_DIR_HOST},,g" \ |
216 | -e "s,${S}/llvm,,g" \ | ||
216 | -e "s,${B},,g" \ | 217 | -e "s,${B},,g" \ |
217 | ${B}/tools/llvm-config/BuildVariables.inc | 218 | ${B}/tools/llvm-config/BuildVariables.inc |
218 | } | 219 | } |
219 | 220 | ||
221 | do_configure:append:class-target() { | ||
222 | reproducible_build_variables | ||
223 | } | ||
224 | |||
225 | do_configure:append:class-nativesdk() { | ||
226 | reproducible_build_variables | ||
227 | } | ||
228 | |||
220 | do_install:append() { | 229 | do_install:append() { |
221 | rm -rf ${D}${libdir}/python*/site-packages/six.py | 230 | rm -rf ${D}${libdir}/python*/site-packages/six.py |
222 | } | 231 | } |
@@ -282,6 +291,9 @@ do_install:append:class-nativesdk () { | |||
282 | ln -sf llvm-config ${D}${bindir}/llvm-config${PV} | 291 | ln -sf llvm-config ${D}${bindir}/llvm-config${PV} |
283 | rm -rf ${D}${datadir}/llvm/cmake | 292 | rm -rf ${D}${datadir}/llvm/cmake |
284 | rm -rf ${D}${datadir}/llvm | 293 | rm -rf ${D}${datadir}/llvm |
294 | |||
295 | #reproducibility | ||
296 | sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake | ||
285 | } | 297 | } |
286 | 298 | ||
287 | PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \ | 299 | PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \ |