kicad/0001-Use-library-target-install-for-python-module-to-fix-.patch

43 lines
1.7 KiB
Diff
Raw Normal View History

From 6baf90fcbce310036feb88ab021c740c5c079c96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 11 Dec 2021 21:56:31 +0100
Subject: [PATCH] Use library target install for python module to fix RUNPATH
When the native python module is copied into the install tree, no special
handling for libraries/modules is triggered. This omits the RUNPATH
adjustments normally done by CMake during installation of binaries, which
is problematic for a number of reasons:
- library lookup can fail when dependencies require non-default RUNPATHs
- reproducible builds can fail when the buildroot contains semi-random
path components
Install the library target a second time, which is explicitly allowed
by CMake. As RENAME is not supported for `install(TARGETS)`, adjust the
name manually.
---
pcbnew/CMakeLists.txt | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 0ae24f0bd5..85b3cd471e 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -817,7 +817,13 @@ elseif( APPLE )
add_dependencies( ScriptingModulesPcbnewSoCopy ScriptingPythonDirectoryCreation )
set( PYMOD_EXT "so" )
else() # only linux remains among supported platforms
- install( FILES ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.kiface DESTINATION ${PYTHON_DEST} COMPONENT binary RENAME "_pcbnew.so" )
+ install( TARGETS pcbnew_kiface DESTINATION ${PYTHON_DEST} COMPONENT binary )
+ cmake_policy(SET CMP0087 NEW)
+ install( CODE
+ "file( RENAME
+ \$ENV{DESTDIR}${PYTHON_DEST}/\$<TARGET_FILE_NAME:pcbnew_kiface>
+ \$ENV{DESTDIR}${PYTHON_DEST}/_pcbnew.so
+ )" )
set( PYMOD_EXT "so" )
endif()
--
2.34.1