summaryrefslogtreecommitdiff
path: root/media-sound/audacity/files/audacity-3.3.3-fix-rpaths.patch
blob: b3fcdb85b022d8a1070f1ac019d1f452e95fa0ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
This is an adapted version of:

From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Thu, 22 Sep 2022 19:52:43 +0200
Subject: Fix rpath for private libraries on Linux

Fixes: https://github.com/audacity/audacity/issues/3289
Forwarded: https://github.com/audacity/audacity/pull/3671
[1] https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#caveats

diff -Nuar a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt	2023-06-08 15:17:02.000000000 +0200
+++ b/CMakeLists.txt	2023-07-14 01:18:46.452163033 +0200
@@ -412,6 +412,7 @@
 set( _LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
 set( _DATADIR "${CMAKE_INSTALL_DATADIR}" )
 set( _PKGLIB "${_LIBDIR}/audacity" )
+set( _PKGMODULE "${_PKGLIB}/modules" )
 set( _PKGDATA "${_DATADIR}/audacity/" )
 set( _MANDIR "${CMAKE_INSTALL_MANDIR}" )
 set( _MODDIR "${_PKGLIB}/modules" )
diff -Nuar a/cmake-proxies/cmake-modules/AudacityFunctions.cmake b/cmake-proxies/cmake-modules/AudacityFunctions.cmake
--- a/cmake-proxies/cmake-modules/AudacityFunctions.cmake	2023-06-08 15:17:02.000000000 +0200
+++ b/cmake-proxies/cmake-modules/AudacityFunctions.cmake	2023-07-14 01:23:42.025628702 +0200
@@ -338,6 +338,17 @@
    set( "${var}" "${node}" PARENT_SCOPE )
 endfunction()
 
+# Call install(TARGETS...) only on Linux systems (i.e. exclude MacOS and Windows)
+macro( install_target_linux target destination )
+   if( NOT "${CMAKE_GENERATOR}" MATCHES "Xcode|Visual Studio*" AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+      install( TARGETS "${target}" DESTINATION "${destination}" )
+   endif()
+endmacro()
+
+macro( install_audacity_module target )
+   install_target_linux( "${target}" "${_PKGMODULE}" )
+endmacro()
+
 define_property(TARGET PROPERTY AUDACITY_GRAPH_DEPENDENCIES
    BRIEF_DOCS
       "Propagates information used in generating a target dependency diagram"
@@ -420,6 +431,13 @@
       list( APPEND GRAPH_EDGES "\"${TARGET}\" -> \"${IMPORT}\" ${attributes}" )
    endforeach()
    set( GRAPH_EDGES "${GRAPH_EDGES}" PARENT_SCOPE )
+
+   # Note: Some modules set EXCLUDE_FROM_ALL afterwards to not be installed.
+   # Therefore only install libraries, but not modules here.
+   if( NOT REAL_LIBTYPE STREQUAL "MODULE" )
+      install_target_linux( "${TARGET}" "${_PKGLIB}" )
+   endif()
+
 endfunction()
 
 function ( make_interface_alias TARGET REAL_LIBTYTPE )
@@ -487,6 +505,7 @@
          PROPERTIES
             PREFIX ""
             FOLDER "modules" # for IDE organization
+            INSTALL_RPATH "$ORIGIN/.."
       )
 
       if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
@@ -501,6 +520,7 @@
          PROPERTIES
             PREFIX ""
             FOLDER "libraries" # for IDE organization
+            INSTALL_RPATH "$ORIGIN"
       )
 
       if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
diff -Nuar a/modules/mod-script-pipe/CMakeLists.txt b/modules/mod-script-pipe/CMakeLists.txt
--- a/modules/mod-script-pipe/CMakeLists.txt	2023-06-08 15:17:02.000000000 +0200
+++ b/modules/mod-script-pipe/CMakeLists.txt	2023-07-14 01:25:10.730068564 +0200
@@ -15,3 +15,4 @@
 )
 audacity_module( mod-script-pipe "${SOURCES}" "Audacity"
    "${DEFINES}" "" )
+install_audacity_module( mod-script-pipe )
diff -Nuar a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt	2023-06-08 15:17:02.000000000 +0200
+++ b/src/CMakeLists.txt	2023-07-14 01:26:23.098427419 +0200
@@ -1557,11 +1557,6 @@
                RUNTIME
                RESOURCE DESTINATION "${_PKGDATA}" )
 
-      install( DIRECTORY "${_DEST}/${_LIBDIR}/"
-               DESTINATION "${_LIBDIR}"
-               USE_SOURCE_PERMISSIONS
-               FILES_MATCHING PATTERN "*.so*" )
-
       install( FILES "${_INTDIR}/audacity.desktop"
                DESTINATION "${_DATADIR}/applications" )
       install( FILES "${topdir}/LICENSE.txt" "${topdir}/README.md"