From b86806ef34d4c9171165c1533064bf34ad822e20 Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Sat, 12 Oct 2024 18:43:25 +0800
Subject: [PATCH] create links with relative path

It fails to build python3-wxgtk4 which depends on wxwidgets:

| ERROR: wxwidgets-native-3.2.1-r0 do_populate_sysroot: sstate found an
    absolute path symlink /path/to/build/tmp-glibc/work/x86_64-linux
    /wxwidgets-native/3.2.1-r0/sysroot-destdir/path/to/build/tmp-glibc/work
    /x86_64-linux/wxwidgets-native/3.2.1-r0/recipe-sysroot-native/usr/bin/wx-config
    pointing at /path/to/build/tmp-glibc/work/x86_64-linux/wxwidgets-native/3.2.1-r0
    /recipe-sysroot-native/usr/lib/wx/config/gtk3-unicode-3.2.
  Please replace this with a relative link.
| ERROR: wxwidgets-native-3.2.1-r0 do_populate_sysroot: sstate found an
    absolute path symlink /path/to/build/tmp-glibc/work/x86_64-linux/wxwidgets-native
    /3.2.1-r0/sysroot-destdir/path/to/build/tmp-glibc/work/x86_64-linux/wxwidgets-native
    /3.2.1-r0/recipe-sysroot-native/usr/bin/wxrc pointing at /path/to/build/tmp-glibc
    /work/x86_64-linux/wxwidgets-native/3.2.1-r0/recipe-sysroot-native/usr/bin/wxrc-3.2.
   Please replace this with a relative link.

Create symlink with relative path to fix the issues.

Upstream-Status: Pending

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 build/cmake/install.cmake        | 2 +-
 build/cmake/utils/CMakeLists.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake
index d3303faabb..c79e187f37 100644
--- a/build/cmake/install.cmake
+++ b/build/cmake/install.cmake
@@ -42,7 +42,7 @@ else()
     install(DIRECTORY DESTINATION "bin")
     install(CODE "execute_process( \
         COMMAND ${CMAKE_COMMAND} -E create_symlink \
-        \"${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/wx/config/${wxBUILD_FILE_ID}\" \
+        \"../lib${LIB_SUFFIX}/wx/config/${wxBUILD_FILE_ID}\" \
         \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \
         )"
     )
diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt
index dbed8cc9b3..1dbc3261d3 100644
--- a/build/cmake/utils/CMakeLists.txt
+++ b/build/cmake/utils/CMakeLists.txt
@@ -40,7 +40,7 @@ if(wxUSE_XRC)
         # Don't use wx_install() here to preserve escaping.
         install(CODE "execute_process( \
             COMMAND ${CMAKE_COMMAND} -E create_symlink \
-            \"${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \
+            \"./${wxrc_output_name}${EXE_SUFFIX}\" \
             \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \
             )"
         )
-- 
2.25.1

