diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-04-07 19:00:15 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-19 14:14:11 +0100 |
commit | 9481976d8020f593220a79531bc2dd56a17539f3 (patch) | |
tree | 59bfd60d05af5f2624889dc802ef7569b627f01d /meta | |
parent | cbb01bd465ceca64cd48c315f86b9239b742999e (diff) | |
download | poky-9481976d8020f593220a79531bc2dd56a17539f3.tar.gz |
llvm: use default install paths
There was a very brittle sed hack against cpp source code
that allowed installing multiple llvm versions into the same
target/sysroot. Patching with sed is prone to silent
regressions as it can change both too little and too much,
and it indeed it broke with llvm 14. It's also difficult to tell
what the 'right' change should look like.
If this feature is actually needed somewhere, please do it properly:
proper patch and upstream first.
(From OE-Core rev: 974f67b18a2f1a15c76785d69e7234594af97a88)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/llvm/llvm_git.bb | 58 | ||||
-rw-r--r-- | meta/recipes-graphics/mesa/mesa.inc | 2 |
2 files changed, 17 insertions, 43 deletions
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb index 13f7fb763e..e10348a7f2 100644 --- a/meta/recipes-devtools/llvm/llvm_git.bb +++ b/meta/recipes-devtools/llvm/llvm_git.bb | |||
@@ -24,7 +24,6 @@ PV = "14.0.0" | |||
24 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" | 24 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" |
25 | 25 | ||
26 | LLVM_RELEASE = "${PV}" | 26 | LLVM_RELEASE = "${PV}" |
27 | LLVM_DIR = "llvm${LLVM_RELEASE}" | ||
28 | 27 | ||
29 | BRANCH = "release/${MAJOR_VERSION}.x" | 28 | BRANCH = "release/${MAJOR_VERSION}.x" |
30 | SRCREV = "329fda39c507e8740978d10458451dcdb21563be" | 29 | SRCREV = "329fda39c507e8740978d10458451dcdb21563be" |
@@ -91,13 +90,6 @@ EXTRA_OECMAKE:append:class-nativesdk = "\ | |||
91 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ | 90 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ |
92 | " | 91 | " |
93 | 92 | ||
94 | do_configure:prepend() { | ||
95 | # Fix paths in llvm-config | ||
96 | sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp | ||
97 | sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp | ||
98 | sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp | ||
99 | } | ||
100 | |||
101 | # patch out build host paths for reproducibility | 93 | # patch out build host paths for reproducibility |
102 | do_compile:prepend:class-target() { | 94 | do_compile:prepend:class-target() { |
103 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | 95 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc |
@@ -112,34 +104,17 @@ do_compile:class-native() { | |||
112 | } | 104 | } |
113 | 105 | ||
114 | do_install() { | 106 | do_install() { |
115 | DESTDIR=${LLVM_INSTALL_DIR} ninja -v install | 107 | DESTDIR=${D} ninja -v install |
116 | install -D -m 0755 ${B}/bin/llvm-config ${D}${libdir}/${LLVM_DIR}/llvm-config | ||
117 | |||
118 | install -d ${D}${bindir}/${LLVM_DIR} | ||
119 | cp -r ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/ | ||
120 | |||
121 | install -d ${D}${includedir}/${LLVM_DIR} | ||
122 | cp -r ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/ | ||
123 | |||
124 | install -d ${D}${libdir}/${LLVM_DIR} | ||
125 | |||
126 | # The LLVM sources have "/lib" embedded and so we cannot completely rely on the ${libdir} variable | ||
127 | if [ -d ${LLVM_INSTALL_DIR}${libdir}/ ]; then | ||
128 | cp -r ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/ | ||
129 | elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib ]; then | ||
130 | cp -r ${LLVM_INSTALL_DIR}${prefix}/lib/* ${D}${libdir}/${LLVM_DIR}/ | ||
131 | elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib64 ]; then | ||
132 | cp -r ${LLVM_INSTALL_DIR}${prefix}/lib64/* ${D}${libdir}/${LLVM_DIR}/ | ||
133 | fi | ||
134 | 108 | ||
135 | # Remove unnecessary cmake files | 109 | # llvm harcodes usr/lib as install path, so this corrects it to actual libdir |
136 | rm -rf ${D}${libdir}/${LLVM_DIR}/cmake | 110 | mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true |
137 | 111 | ||
138 | ln -s ${LLVM_DIR}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV} ${D}${libdir}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV} | 112 | # Remove opt-viewer: https://llvm.org/docs/Remarks.html |
113 | rm -rf ${D}${datadir}/opt-viewer | ||
114 | rmdir ${D}${datadir} | ||
139 | 115 | ||
140 | # We'll have to delete the libLLVM.so due to multiple reasons... | 116 | # reproducibility |
141 | rm -rf ${D}${libdir}/${LLVM_DIR}/libLLVM.so | 117 | sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake |
142 | rm -rf ${D}${libdir}/${LLVM_DIR}/libLTO.so | ||
143 | } | 118 | } |
144 | 119 | ||
145 | do_install:class-native() { | 120 | do_install:class-native() { |
@@ -152,34 +127,33 @@ PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptrema | |||
152 | RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" | 127 | RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" |
153 | 128 | ||
154 | FILES:${PN}-bugpointpasses = "\ | 129 | FILES:${PN}-bugpointpasses = "\ |
155 | ${libdir}/${LLVM_DIR}/BugpointPasses.so \ | 130 | ${libdir}/BugpointPasses.so \ |
156 | " | 131 | " |
157 | 132 | ||
158 | FILES:${PN}-libllvm = "\ | 133 | FILES:${PN}-libllvm = "\ |
159 | ${libdir}/${LLVM_DIR}/libLLVM-${MAJOR_VERSION}.so \ | ||
160 | ${libdir}/libLLVM-${MAJOR_VERSION}.so \ | 134 | ${libdir}/libLLVM-${MAJOR_VERSION}.so \ |
161 | " | 135 | " |
162 | 136 | ||
163 | FILES:${PN}-liblto += "\ | 137 | FILES:${PN}-liblto += "\ |
164 | ${libdir}/${LLVM_DIR}/libLTO.so.* \ | 138 | ${libdir}/libLTO.so.* \ |
165 | " | 139 | " |
166 | 140 | ||
167 | FILES:${PN}-liboptremarks += "\ | 141 | FILES:${PN}-liboptremarks += "\ |
168 | ${libdir}/${LLVM_DIR}/libRemarks.so.* \ | 142 | ${libdir}/libRemarks.so.* \ |
169 | " | 143 | " |
170 | 144 | ||
171 | FILES:${PN}-llvmhello = "\ | 145 | FILES:${PN}-llvmhello = "\ |
172 | ${libdir}/${LLVM_DIR}/LLVMHello.so \ | 146 | ${libdir}/LLVMHello.so \ |
173 | " | 147 | " |
174 | 148 | ||
175 | FILES:${PN}-dev += " \ | 149 | FILES:${PN}-dev += " \ |
176 | ${libdir}/${LLVM_DIR}/llvm-config \ | 150 | ${libdir}/llvm-config \ |
177 | ${libdir}/${LLVM_DIR}/libRemarks.so \ | 151 | ${libdir}/libRemarks.so \ |
178 | ${libdir}/${LLVM_DIR}/libLLVM-${PV}.so \ | 152 | ${libdir}/libLLVM-${PV}.so \ |
179 | " | 153 | " |
180 | 154 | ||
181 | FILES:${PN}-staticdev += "\ | 155 | FILES:${PN}-staticdev += "\ |
182 | ${libdir}/${LLVM_DIR}/*.a \ | 156 | ${libdir}/*.a \ |
183 | " | 157 | " |
184 | 158 | ||
185 | INSANE_SKIP:${PN}-libllvm += "dev-so" | 159 | INSANE_SKIP:${PN}-libllvm += "dev-so" |
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index e8c07a4563..21fa1a6a9e 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc | |||
@@ -52,7 +52,7 @@ ANY_OF_DISTRO_FEATURES:class-target = "opengl vulkan" | |||
52 | 52 | ||
53 | PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}" | 53 | PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}" |
54 | 54 | ||
55 | export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config" | 55 | export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config" |
56 | export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}" | 56 | export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}" |
57 | export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}" | 57 | export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}" |
58 | export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" | 58 | export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" |