diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-05-14 16:15:13 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2024-05-21 08:36:37 -0700 |
| commit | 4ffbe8de13d17ee5755f9735b0ad178fdd79b9a4 (patch) | |
| tree | dd98748a64fb0b42c09c0768a04a35219d3785f9 /recipes-devtools | |
| parent | e7dceb1c92caf7f21ef1d7b49c85328c30cffd90 (diff) | |
| download | meta-clang-4ffbe8de13d17ee5755f9735b0ad178fdd79b9a4.tar.gz | |
clang: Apply libunwind.pc.in and llvm-config via a patch
this will simplify things with UNPACKDIR and shared sources for all llvm
derived recipes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools')
| -rw-r--r-- | recipes-devtools/clang/clang/0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch | 90 | ||||
| -rw-r--r-- | recipes-devtools/clang/clang/libunwind.pc.in | 9 | ||||
| -rw-r--r-- | recipes-devtools/clang/clang/llvm-config | 52 | ||||
| -rw-r--r-- | recipes-devtools/clang/clang_git.bb | 2 | ||||
| -rw-r--r-- | recipes-devtools/clang/common.inc | 3 | ||||
| -rw-r--r-- | recipes-devtools/clang/libcxx_git.bb | 2 |
6 files changed, 93 insertions, 65 deletions
diff --git a/recipes-devtools/clang/clang/0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch b/recipes-devtools/clang/clang/0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch new file mode 100644 index 0000000..84a0d2b --- /dev/null +++ b/recipes-devtools/clang/clang/0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | From e54d4a15f31b8f84dc24ae14efc65713b1a6d6d7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 14 May 2024 22:04:43 -0700 | ||
| 4 | Subject: [PATCH] llvm: Add libunwind.pc.in and llvm-config scripts | ||
| 5 | |||
| 6 | These are added by OE project | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [ OE-Specific ] | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | libunwind/libunwind.pc.in | 9 ++++++ | ||
| 13 | llvm/tools/llvm-config/llvm-config | 52 ++++++++++++++++++++++++++++++ | ||
| 14 | 2 files changed, 61 insertions(+) | ||
| 15 | create mode 100644 libunwind/libunwind.pc.in | ||
| 16 | create mode 100644 llvm/tools/llvm-config/llvm-config | ||
| 17 | |||
| 18 | diff --git a/libunwind/libunwind.pc.in b/libunwind/libunwind.pc.in | ||
| 19 | new file mode 100644 | ||
| 20 | index 000000000000..a93d676604f9 | ||
| 21 | --- /dev/null | ||
| 22 | +++ b/libunwind/libunwind.pc.in | ||
| 23 | @@ -0,0 +1,9 @@ | ||
| 24 | +prefix=/usr | ||
| 25 | +exec_prefix=/usr | ||
| 26 | +libdir=@LIBDIR@ | ||
| 27 | +includedir=/usr/include | ||
| 28 | + | ||
| 29 | +Name: libunwind | ||
| 30 | +Description: libunwind base library | ||
| 31 | +Version: @VERSION@ | ||
| 32 | +Libs: -lunwind | ||
| 33 | diff --git a/llvm/tools/llvm-config/llvm-config b/llvm/tools/llvm-config/llvm-config | ||
| 34 | new file mode 100644 | ||
| 35 | index 000000000000..6a0dd54b8eab | ||
| 36 | --- /dev/null | ||
| 37 | +++ b/llvm/tools/llvm-config/llvm-config | ||
| 38 | @@ -0,0 +1,52 @@ | ||
| 39 | +#!/bin/bash | ||
| 40 | +# | ||
| 41 | +# Wrapper script for llvm-config. Supplies the right environment variables | ||
| 42 | +# for the target and delegates to the native llvm-config for anything else. This | ||
| 43 | +# is needed because arguments like --ldflags, --cxxflags, etc. are set by the | ||
| 44 | +# native compile rather than the target compile. | ||
| 45 | +# | ||
| 46 | +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
| 47 | +NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" | ||
| 48 | +export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}" | ||
| 49 | +if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then | ||
| 50 | + export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}" | ||
| 51 | +else | ||
| 52 | + export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}" | ||
| 53 | +fi | ||
| 54 | +if [[ $# == 0 ]]; then | ||
| 55 | + exec "$NEXT_LLVM_CONFIG" | ||
| 56 | +fi | ||
| 57 | + | ||
| 58 | +remain="" | ||
| 59 | +output="" | ||
| 60 | +for arg in "$@"; do | ||
| 61 | + case "$arg" in | ||
| 62 | + --cppflags) | ||
| 63 | + output="${output} ${CPPFLAGS}" | ||
| 64 | + ;; | ||
| 65 | + --cflags) | ||
| 66 | + output="${output} ${CFLAGS}" | ||
| 67 | + ;; | ||
| 68 | + --cxxflags) | ||
| 69 | + output="${output} ${CXXFLAGS}" | ||
| 70 | + ;; | ||
| 71 | + --ldflags) | ||
| 72 | + output="${output} ${LDFLAGS}" | ||
| 73 | + ;; | ||
| 74 | + --shared-mode) | ||
| 75 | + output="${output} shared" | ||
| 76 | + ;; | ||
| 77 | + --link-shared) | ||
| 78 | + break | ||
| 79 | + ;; | ||
| 80 | + *) | ||
| 81 | + remain="${remain} ${arg}" | ||
| 82 | + ;; | ||
| 83 | + esac | ||
| 84 | +done | ||
| 85 | + | ||
| 86 | +if [ "${remain}" != "" ]; then | ||
| 87 | + output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) | ||
| 88 | +fi | ||
| 89 | + | ||
| 90 | +echo "${output}" | ||
diff --git a/recipes-devtools/clang/clang/libunwind.pc.in b/recipes-devtools/clang/clang/libunwind.pc.in deleted file mode 100644 index a93d676..0000000 --- a/recipes-devtools/clang/clang/libunwind.pc.in +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | prefix=/usr | ||
| 2 | exec_prefix=/usr | ||
| 3 | libdir=@LIBDIR@ | ||
| 4 | includedir=/usr/include | ||
| 5 | |||
| 6 | Name: libunwind | ||
| 7 | Description: libunwind base library | ||
| 8 | Version: @VERSION@ | ||
| 9 | Libs: -lunwind | ||
diff --git a/recipes-devtools/clang/clang/llvm-config b/recipes-devtools/clang/clang/llvm-config deleted file mode 100644 index 6a0dd54..0000000 --- a/recipes-devtools/clang/clang/llvm-config +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Wrapper script for llvm-config. Supplies the right environment variables | ||
| 4 | # for the target and delegates to the native llvm-config for anything else. This | ||
| 5 | # is needed because arguments like --ldflags, --cxxflags, etc. are set by the | ||
| 6 | # native compile rather than the target compile. | ||
| 7 | # | ||
| 8 | SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
| 9 | NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" | ||
| 10 | export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}" | ||
| 11 | if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then | ||
| 12 | export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}" | ||
| 13 | else | ||
| 14 | export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}" | ||
| 15 | fi | ||
| 16 | if [[ $# == 0 ]]; then | ||
| 17 | exec "$NEXT_LLVM_CONFIG" | ||
| 18 | fi | ||
| 19 | |||
| 20 | remain="" | ||
| 21 | output="" | ||
| 22 | for arg in "$@"; do | ||
| 23 | case "$arg" in | ||
| 24 | --cppflags) | ||
| 25 | output="${output} ${CPPFLAGS}" | ||
| 26 | ;; | ||
| 27 | --cflags) | ||
| 28 | output="${output} ${CFLAGS}" | ||
| 29 | ;; | ||
| 30 | --cxxflags) | ||
| 31 | output="${output} ${CXXFLAGS}" | ||
| 32 | ;; | ||
| 33 | --ldflags) | ||
| 34 | output="${output} ${LDFLAGS}" | ||
| 35 | ;; | ||
| 36 | --shared-mode) | ||
| 37 | output="${output} shared" | ||
| 38 | ;; | ||
| 39 | --link-shared) | ||
| 40 | break | ||
| 41 | ;; | ||
| 42 | *) | ||
| 43 | remain="${remain} ${arg}" | ||
| 44 | ;; | ||
| 45 | esac | ||
| 46 | done | ||
| 47 | |||
| 48 | if [ "${remain}" != "" ]; then | ||
| 49 | output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) | ||
| 50 | fi | ||
| 51 | |||
| 52 | echo "${output}" | ||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 2891a3a..a29770b 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
| @@ -429,7 +429,7 @@ SYSROOT_PREPROCESS_FUNCS:append:class-target = " clang_sysroot_preprocess" | |||
| 429 | 429 | ||
| 430 | clang_sysroot_preprocess() { | 430 | clang_sysroot_preprocess() { |
| 431 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | 431 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 432 | install -m 0755 ${S}/../llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | 432 | install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 433 | ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} | 433 | ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} |
| 434 | # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to | 434 | # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to |
| 435 | install -d ${SYSROOT_DESTDIR}${bindir} | 435 | install -d ${SYSROOT_DESTDIR}${bindir} |
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index db3ae0a..9b31bf6 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
| @@ -10,8 +10,6 @@ SRC_URI[sha256sum] = "3591a52761a7d390ede51af01ea73abfecc4b1d16445f9d019b67a57ed | |||
| 10 | 10 | ||
| 11 | SRC_URI = "\ | 11 | SRC_URI = "\ |
| 12 | ${BASEURI} \ | 12 | ${BASEURI} \ |
| 13 | file://llvm-config \ | ||
| 14 | file://libunwind.pc.in \ | ||
| 15 | file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ | 13 | file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ |
| 16 | file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \ | 14 | file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \ |
| 17 | file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ | 15 | file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ |
| @@ -46,6 +44,7 @@ SRC_URI = "\ | |||
| 46 | file://0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch \ | 44 | file://0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch \ |
| 47 | file://0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch \ | 45 | file://0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch \ |
| 48 | file://0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch \ | 46 | file://0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch \ |
| 47 | file://0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch \ | ||
| 49 | " | 48 | " |
| 50 | # Fallback to no-PIE if not set | 49 | # Fallback to no-PIE if not set |
| 51 | GCCPIE ??= "" | 50 | GCCPIE ??= "" |
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb index 9d4f033..8ee800c 100644 --- a/recipes-devtools/clang/libcxx_git.bb +++ b/recipes-devtools/clang/libcxx_git.bb | |||
| @@ -105,7 +105,7 @@ do_install:append() { | |||
| 105 | install -Dm 0644 ${S}/libunwind/include/$f ${D}${includedir}/$f | 105 | install -Dm 0644 ${S}/libunwind/include/$f ${D}${includedir}/$f |
| 106 | done | 106 | done |
| 107 | install -d ${D}${libdir}/pkgconfig | 107 | install -d ${D}${libdir}/pkgconfig |
| 108 | sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/../libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc | 108 | sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/libunwind/libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc |
| 109 | fi | 109 | fi |
| 110 | } | 110 | } |
| 111 | 111 | ||
