From 4ffbe8de13d17ee5755f9735b0ad178fdd79b9a4 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 14 May 2024 16:15:13 -0700 Subject: 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 --- ...d-libunwind.pc.in-and-llvm-config-scripts.patch | 90 ++++++++++++++++++++++ recipes-devtools/clang/clang/libunwind.pc.in | 9 --- recipes-devtools/clang/clang/llvm-config | 52 ------------- recipes-devtools/clang/clang_git.bb | 2 +- recipes-devtools/clang/common.inc | 3 +- recipes-devtools/clang/libcxx_git.bb | 2 +- 6 files changed, 93 insertions(+), 65 deletions(-) create mode 100644 recipes-devtools/clang/clang/0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch delete mode 100644 recipes-devtools/clang/clang/libunwind.pc.in delete mode 100644 recipes-devtools/clang/clang/llvm-config 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 @@ +From e54d4a15f31b8f84dc24ae14efc65713b1a6d6d7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 14 May 2024 22:04:43 -0700 +Subject: [PATCH] llvm: Add libunwind.pc.in and llvm-config scripts + +These are added by OE project + +Upstream-Status: Inappropriate [ OE-Specific ] + +Signed-off-by: Khem Raj +--- + libunwind/libunwind.pc.in | 9 ++++++ + llvm/tools/llvm-config/llvm-config | 52 ++++++++++++++++++++++++++++++ + 2 files changed, 61 insertions(+) + create mode 100644 libunwind/libunwind.pc.in + create mode 100644 llvm/tools/llvm-config/llvm-config + +diff --git a/libunwind/libunwind.pc.in b/libunwind/libunwind.pc.in +new file mode 100644 +index 000000000000..a93d676604f9 +--- /dev/null ++++ b/libunwind/libunwind.pc.in +@@ -0,0 +1,9 @@ ++prefix=/usr ++exec_prefix=/usr ++libdir=@LIBDIR@ ++includedir=/usr/include ++ ++Name: libunwind ++Description: libunwind base library ++Version: @VERSION@ ++Libs: -lunwind +diff --git a/llvm/tools/llvm-config/llvm-config b/llvm/tools/llvm-config/llvm-config +new file mode 100644 +index 000000000000..6a0dd54b8eab +--- /dev/null ++++ b/llvm/tools/llvm-config/llvm-config +@@ -0,0 +1,52 @@ ++#!/bin/bash ++# ++# Wrapper script for llvm-config. Supplies the right environment variables ++# for the target and delegates to the native llvm-config for anything else. This ++# is needed because arguments like --ldflags, --cxxflags, etc. are set by the ++# native compile rather than the target compile. ++# ++SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" ++NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" ++export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}" ++if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then ++ export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}" ++else ++ export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}" ++fi ++if [[ $# == 0 ]]; then ++ exec "$NEXT_LLVM_CONFIG" ++fi ++ ++remain="" ++output="" ++for arg in "$@"; do ++ case "$arg" in ++ --cppflags) ++ output="${output} ${CPPFLAGS}" ++ ;; ++ --cflags) ++ output="${output} ${CFLAGS}" ++ ;; ++ --cxxflags) ++ output="${output} ${CXXFLAGS}" ++ ;; ++ --ldflags) ++ output="${output} ${LDFLAGS}" ++ ;; ++ --shared-mode) ++ output="${output} shared" ++ ;; ++ --link-shared) ++ break ++ ;; ++ *) ++ remain="${remain} ${arg}" ++ ;; ++ esac ++done ++ ++if [ "${remain}" != "" ]; then ++ output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) ++fi ++ ++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 @@ -prefix=/usr -exec_prefix=/usr -libdir=@LIBDIR@ -includedir=/usr/include - -Name: libunwind -Description: libunwind base library -Version: @VERSION@ -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 @@ -#!/bin/bash -# -# Wrapper script for llvm-config. Supplies the right environment variables -# for the target and delegates to the native llvm-config for anything else. This -# is needed because arguments like --ldflags, --cxxflags, etc. are set by the -# native compile rather than the target compile. -# -SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" -export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}" -if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then - export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}" -else - export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}" -fi -if [[ $# == 0 ]]; then - exec "$NEXT_LLVM_CONFIG" -fi - -remain="" -output="" -for arg in "$@"; do - case "$arg" in - --cppflags) - output="${output} ${CPPFLAGS}" - ;; - --cflags) - output="${output} ${CFLAGS}" - ;; - --cxxflags) - output="${output} ${CXXFLAGS}" - ;; - --ldflags) - output="${output} ${LDFLAGS}" - ;; - --shared-mode) - output="${output} shared" - ;; - --link-shared) - break - ;; - *) - remain="${remain} ${arg}" - ;; - esac -done - -if [ "${remain}" != "" ]; then - output="${output} "$("$NEXT_LLVM_CONFIG" ${remain}) -fi - -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" clang_sysroot_preprocess() { install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ - install -m 0755 ${S}/../llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to 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 SRC_URI = "\ ${BASEURI} \ - file://llvm-config \ - file://libunwind.pc.in \ file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \ file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ @@ -46,6 +44,7 @@ SRC_URI = "\ file://0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch \ file://0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch \ file://0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch \ + file://0036-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch \ " # Fallback to no-PIE if not set 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() { install -Dm 0644 ${S}/libunwind/include/$f ${D}${includedir}/$f done install -d ${D}${libdir}/pkgconfig - sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/../libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc + sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/libunwind/libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc fi } -- cgit v1.2.3-54-g00ecf