Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 575344 Details for
Bug 662722
media-libs/mesa does not set LLVM_CONFIG for cross compilation
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch against sys-devel/llvm
llvm-config-sh.patch (text/plain), 8.34 KB, created by
James Le Cuirot
on 2019-05-05 20:11:27 UTC
(
hide
)
Description:
Patch against sys-devel/llvm
Filename:
MIME Type:
Creator:
James Le Cuirot
Created:
2019-05-05 20:11:27 UTC
Size:
8.34 KB
patch
obsolete
>From a3de688e12022f605b3d8538ad157f12d7054e37 Mon Sep 17 00:00:00 2001 >From: James Le Cuirot <chewi@gentoo.org> >Date: Sun, 5 May 2019 20:42:06 +0100 >Subject: [PATCH] sys-devel/llvm: Add Bash version of llvm-config for > cross-compiling > >This is a poor man's rewrite of llvm-config in Bash, which is needed >because llvm-config is normally a native binary and cannot be used >when cross-compiling. > >It supports most of the llvm-config flags and will return largely >accurate answers. The main difference is that it doesn't support >filtering by component so it will always return all of the LLVM >libraries. This would cause overlinking but Gentoo avoids this by >default with -Wl,--as-needed. > >To use this, llvm.eclass should add >${ESYSROOT}/usr/lib/llvm/${SLOT}/bin/cross to the PATH instead of the >parent directory but it should only do so when cross-compiling. > >Tested with LLVM 7 and 8 against Mesa. > >Package-Manager: Portage-2.3.66, Repoman-2.3.12 >Signed-off-by: James Le Cuirot <chewi@gentoo.org> >--- > sys-devel/llvm/files/7.1.0/gen-llvm-config-sh | 93 +++++++++++++++++++ > sys-devel/llvm/llvm-7.1.0.ebuild | 6 ++ > sys-devel/llvm/llvm-8.0.0.ebuild | 6 ++ > sys-devel/llvm/llvm-8.0.9999.ebuild | 6 ++ > sys-devel/llvm/llvm-9999.ebuild | 6 ++ > 5 files changed, 117 insertions(+) > create mode 100755 sys-devel/llvm/files/7.1.0/gen-llvm-config-sh > >diff --git a/sys-devel/llvm/files/7.1.0/gen-llvm-config-sh b/sys-devel/llvm/files/7.1.0/gen-llvm-config-sh >new file mode 100755 >index 000000000000..588ca344a425 >--- /dev/null >+++ b/sys-devel/llvm/files/7.1.0/gen-llvm-config-sh >@@ -0,0 +1,93 @@ >+#!/bin/bash -e >+ >+build_var() { >+ cpp -P -Iinclude -include llvm/Config/config.h -include tools/llvm-config/BuildVariables.inc - <<< "$1" >+} >+ >+build_yes_no() { >+ if [[ $(build_var "$1") = 1 ]]; then >+ echo YES >+ else >+ echo NO >+ fi >+} >+ >+build_on_off() { >+ if [[ $(build_var "$1") = 1 ]]; then >+ echo ON >+ else >+ echo OFF >+ fi >+} >+ >+: ${CBUILD:-${CHOST}} >+ >+if [[ -n ${CBUILD} ]]; then >+ CXX=${CBUILD}-c++ >+else >+ CXX=c++ >+fi >+ >+TEMP_EXE=$(mktemp) >+trap 'rm -f "${TEMP_EXE}"' EXIT >+ >+${CXX} -o "${TEMP_EXE}" -x c++ - <<EOF >+#include <cstdio> >+#include "tools/llvm-config/LibraryDependencies.inc" >+ >+int main(int argc, char** argv) { >+ unsigned int i, total; >+ struct AvailableComponent *component; >+ const char *library; >+ >+ total = sizeof(AvailableComponents) / sizeof(AvailableComponents[0]); >+ >+ for (i = 0; i < total; i++) { >+ component = &AvailableComponents[i]; >+ library = component->Library; >+ if (library == NULL) library = ""; >+ if (component->IsInstalled) printf("\t\"%s %s\"\n", component->Name, library); >+ } >+ >+ return 0; >+} >+EOF >+ >+cat <<EOF >+#!/bin/bash -e >+ >+PREFIX=\${0%/*/*/*} >+ >+COMPONENTS=( >+$("${TEMP_EXE}") >+) >+ >+handle_arg() { >+ case "\${1}" in >+ --version) echo $(build_var PACKAGE_VERSION) ;; >+ --prefix) echo "\${PREFIX}" ;; >+ --bindir) echo "\${PREFIX}"/bin ;; >+ --includedir) echo "\${PREFIX}"/include ;; >+ --libdir) echo "\${PREFIX}"/lib$(build_var LLVM_LIBDIR_SUFFIX) ;; >+ --cppflags) echo "-I\$(handle_arg --includedir) "$(build_var LLVM_CPPFLAGS) ;; >+ --cflags) echo "-I\$(handle_arg --includedir) "$(build_var LLVM_CFLAGS) ;; >+ --cxxflags) echo "-I\$(handle_arg --includedir) "$(build_var LLVM_CXXFLAGS) ;; >+ --ldflags) echo "-L\$(handle_arg --libdir) "$(build_var LLVM_LDFLAGS) ;; >+ --libs) LIBS=(\${COMPONENTS[@]#* }); echo "\${LIBS[@]/#/-l}" ;; >+ --libnames) LIBS=(\${COMPONENTS[@]#* }); LIBS=(\${LIBS[@]/%/$(build_var LTDL_SHLIB_EXT)}); echo "\${LIBS[@]/#/lib}" ;; >+ --libfiles) LIBS=(\${COMPONENTS[@]#* }); LIBS=(\${LIBS[@]/%/$(build_var LTDL_SHLIB_EXT)}); echo "\${LIBS[@]/#/\${PREFIX}/lib$(build_var LLVM_LIBDIR_SUFFIX)/lib}" ;; >+ --components) echo "\${COMPONENTS[@]% *}" ;; >+ --targets-built) echo $(build_var LLVM_TARGETS_BUILT) ;; >+ --host-target) echo $(build_var LLVM_HOST_TRIPLE) ;; >+ --build-mode) echo $(build_var LLVM_BUILDMODE) ;; >+ --build-system) echo $(build_var LLVM_BUILD_SYSTEM) ;; >+ --has-rtti) echo $(build_yes_no LLVM_HAS_RTTI) ;; >+ --has-global-isel) echo $(build_on_off LLVM_HAS_GLOBAL_ISEL) ;; >+ --shared-mode) echo shared ;; >+ esac >+} >+ >+for ARG in "\${@}"; do >+ handle_arg "\${ARG}" >+done >+EOF >diff --git a/sys-devel/llvm/llvm-7.1.0.ebuild b/sys-devel/llvm/llvm-7.1.0.ebuild >index a708957fea03..a8c1b198b282 100644 >--- a/sys-devel/llvm/llvm-7.1.0.ebuild >+++ b/sys-devel/llvm/llvm-7.1.0.ebuild >@@ -201,6 +201,8 @@ multilib_src_compile() { > pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests > pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests > fi >+ >+ bash "${FILESDIR}"/7.1.0/gen-llvm-config-sh > "${CHOST}"-llvm-config.sh || die > } > > multilib_src_test() { >@@ -220,6 +222,7 @@ src_install() { > > local LLVM_LDPATHS=() > multilib-minimal_src_install >+ dosym "${CHOST}"-llvm-config /usr/lib/llvm/${SLOT}/bin/cross/llvm-config > > # move wrapped headers back > mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT%/*}/include || die >@@ -233,6 +236,9 @@ multilib_src_install() { > mv "${ED%/}"/usr/lib/llvm/${SLOT%/*}/include "${ED%/}"/usr/include || die > > LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT%/*}/$(get_libdir)" ) >+ >+ exeinto /usr/lib/llvm/${SLOT}/bin/cross >+ newexe "${CHOST}"-llvm-config{.sh,} > } > > multilib_src_install_all() { >diff --git a/sys-devel/llvm/llvm-8.0.0.ebuild b/sys-devel/llvm/llvm-8.0.0.ebuild >index 212c6de12274..8ba6284f8bd4 100644 >--- a/sys-devel/llvm/llvm-8.0.0.ebuild >+++ b/sys-devel/llvm/llvm-8.0.0.ebuild >@@ -237,6 +237,8 @@ multilib_src_compile() { > pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests > pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests > fi >+ >+ bash "${FILESDIR}"/7.1.0/gen-llvm-config-sh > "${CHOST}"-llvm-config.sh || die > } > > multilib_src_test() { >@@ -256,6 +258,7 @@ src_install() { > > local LLVM_LDPATHS=() > multilib-minimal_src_install >+ dosym "${CHOST}"-llvm-config /usr/lib/llvm/${SLOT}/bin/cross/llvm-config > > # move wrapped headers back > mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die >@@ -269,6 +272,9 @@ multilib_src_install() { > mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die > > LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" ) >+ >+ exeinto /usr/lib/llvm/${SLOT}/bin/cross >+ newexe "${CHOST}"-llvm-config{.sh,} > } > > multilib_src_install_all() { >diff --git a/sys-devel/llvm/llvm-8.0.9999.ebuild b/sys-devel/llvm/llvm-8.0.9999.ebuild >index 762eed9364fe..2f73a02d391b 100644 >--- a/sys-devel/llvm/llvm-8.0.9999.ebuild >+++ b/sys-devel/llvm/llvm-8.0.9999.ebuild >@@ -233,6 +233,8 @@ multilib_src_compile() { > pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests > pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests > fi >+ >+ bash "${FILESDIR}"/7.1.0/gen-llvm-config-sh > "${CHOST}"-llvm-config.sh || die > } > > multilib_src_test() { >@@ -252,6 +254,7 @@ src_install() { > > local LLVM_LDPATHS=() > multilib-minimal_src_install >+ dosym "${CHOST}"-llvm-config /usr/lib/llvm/${SLOT}/bin/cross/llvm-config > > # move wrapped headers back > mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die >@@ -265,6 +268,9 @@ multilib_src_install() { > mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die > > LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" ) >+ >+ exeinto /usr/lib/llvm/${SLOT}/bin/cross >+ newexe "${CHOST}"-llvm-config{.sh,} > } > > multilib_src_install_all() { >diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild >index fe059751a9f6..6e79271b0c53 100644 >--- a/sys-devel/llvm/llvm-9999.ebuild >+++ b/sys-devel/llvm/llvm-9999.ebuild >@@ -238,6 +238,8 @@ multilib_src_compile() { > pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests > pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests > fi >+ >+ bash "${FILESDIR}"/7.1.0/gen-llvm-config-sh > "${CHOST}"-llvm-config.sh || die > } > > multilib_src_test() { >@@ -257,6 +259,7 @@ src_install() { > > local LLVM_LDPATHS=() > multilib-minimal_src_install >+ dosym "${CHOST}"-llvm-config /usr/lib/llvm/${SLOT}/bin/cross/llvm-config > > # move wrapped headers back > mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die >@@ -270,6 +273,9 @@ multilib_src_install() { > mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die > > LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" ) >+ >+ exeinto /usr/lib/llvm/${SLOT}/bin/cross >+ newexe "${CHOST}"-llvm-config{.sh,} > } > > multilib_src_install_all() { >-- >2.20.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 662722
: 575344