libical: Do not set CC explicitly for gir compiler

Message ID 20220304044635.1625747-1-raj.khem@gmail.com
State Accepted, archived
Commit e591b462227ded84f3f8e7273200824ad63313c4
Headers show
Series libical: Do not set CC explicitly for gir compiler | expand

Commit Message

Khem Raj March 4, 2022, 4:46 a.m. UTC
This ensures that right sysroot is used during build, otherwise we see
warnings in build about using wrong sysroot and it fails explicitly with
clang

x86_64-yoe-linux-ld: warning: library search path "/usr/lib/gcc/x86_6
4-pc-linux-gnu/11.2.0/../../../../lib64" is unsafe for cross-compilation

x86_64-yoe-linux-ld: cannot find /usr/lib/clang/14.0.0/lib/linux/libc
lang_rt.builtins-x86_64.a: No such file or directory

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...e-Do-not-export-CC-into-gir-compiler.patch | 33 +++++++++++++++++++
 .../recipes-support/libical/libical_3.0.14.bb |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libical/libical/0001-cmake-Do-not-export-CC-into-gir-compiler.patch

Patch

diff --git a/meta/recipes-support/libical/libical/0001-cmake-Do-not-export-CC-into-gir-compiler.patch b/meta/recipes-support/libical/libical/0001-cmake-Do-not-export-CC-into-gir-compiler.patch
new file mode 100644
index 00000000000..3841c060eeb
--- /dev/null
+++ b/meta/recipes-support/libical/libical/0001-cmake-Do-not-export-CC-into-gir-compiler.patch
@@ -0,0 +1,33 @@ 
+From c06d8a8990c996cbb854508a944202ba70ba7a7c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 3 Mar 2022 20:10:04 -0800
+Subject: [PATCH] cmake: Do not export CC into gir compiler
+
+this helps cross compilers where full compiler commandline defines the
+compiler rather than just CC variable, therefore let it use the default
+values from environment and not synthesize it from CMAKE_C_COMPILER just
+for this case.
+
+Upstream-Status: Submitted [https://github.com/libical/libical/pull/552]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ cmake/modules/GObjectIntrospectionMacros.cmake | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/cmake/modules/GObjectIntrospectionMacros.cmake b/cmake/modules/GObjectIntrospectionMacros.cmake
+index 83aff931..d7d3f898 100644
+--- a/cmake/modules/GObjectIntrospectionMacros.cmake
++++ b/cmake/modules/GObjectIntrospectionMacros.cmake
+@@ -50,8 +50,7 @@ macro(gir_add_introspections introspections_girs)
+     set(_gir_libtool "--no-libtool")
+ 
+     add_custom_command(
+-      COMMAND ${CMAKE_COMMAND} -E env "CC='${CMAKE_C_COMPILER}'"
+-              ${GObjectIntrospection_SCANNER}
++      COMMAND ${GObjectIntrospection_SCANNER}
+               ${GObjectIntrospection_SCANNER_ARGS}
+               --namespace=${_gir_namespace}
+               --nsversion=${_gir_version}
+-- 
+2.35.1
+
diff --git a/meta/recipes-support/libical/libical_3.0.14.bb b/meta/recipes-support/libical/libical_3.0.14.bb
index 717eb11e125..58baf3f32f7 100644
--- a/meta/recipes-support/libical/libical_3.0.14.bb
+++ b/meta/recipes-support/libical/libical_3.0.14.bb
@@ -12,7 +12,9 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=1910a2a76ddf6a9ba369182494170d87 \
                     "
 SECTION = "libs"
 
-SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.gz"
+SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
+           file://0001-cmake-Do-not-export-CC-into-gir-compiler.patch \
+          "
 SRC_URI[sha256sum] = "4284b780356f1dc6a01f16083e7b836e63d3815e27ed0eaaad684712357ccc8f"
 UPSTREAM_CHECK_URI = "https://github.com/libical/libical/releases"