Description: Install private libs in libs subfolder
 Artikulate upstream installs some private libraries in the public
 /usr/lib/$triplet location.
 .
 This patch fixes that and correctly installs private libs in a private
 subfolder: /usr/lib/$triplet/artikulate.
Forwarded: https://phabricator.kde.org/D26816
Author: Aurélien COUDERC <coucouf@debian.org>
Last-Update: 2020-01-20
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -112,11 +112,26 @@
     VERSION ${GENERIC_LIB_VERSION}
     SOVERSION ${GENERIC_LIB_SOVERSION}
 )
-install(
-    TARGETS artikulatecore
-    LIBRARY NAMELINK_SKIP
-    DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS}
-)
+if (NOT APPLE AND NOT WIN32)
+    if (NOT APPLE AND NOT WIN32)
+        set_target_properties(artikulatecore PROPERTIES
+            INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/artikulate;${CMAKE_INSTALL_RPATH}"
+            )
+    endif()
+
+    install(
+        TARGETS artikulatecore
+        LIBRARY DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate NAMELINK_SKIP
+        RUNTIME DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+        BUNDLE DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+    )
+else()
+    install(
+        TARGETS artikulatecore
+        LIBRARY NAMELINK_SKIP
+        DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS}
+    )
+endif()
 install(FILES artikulate.knsrc  DESTINATION  ${CONFIG_INSTALL_DIR})
 
 # set the source code files from which Artikulate is compiled
@@ -175,5 +190,16 @@
 )
 
 install(FILES artikulate.kcfg DESTINATION ${KCFG_INSTALL_DIR})
+
+if (NOT APPLE AND NOT WIN32)
+    set_target_properties(artikulate PROPERTIES
+        INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/artikulate;${CMAKE_INSTALL_RPATH}"
+    )
+endif()
 install(TARGETS artikulate ${INSTALL_TARGETS_DEFAULT_ARGS})
+if (NOT APPLE AND NOT WIN32)
+    set_target_properties(artikulate_editor PROPERTIES
+        INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/artikulate;${CMAKE_INSTALL_RPATH}"
+    )
+endif()
 install(TARGETS artikulate_editor ${INSTALL_TARGETS_DEFAULT_ARGS})
--- a/liblearnerprofile/src/CMakeLists.txt
+++ b/liblearnerprofile/src/CMakeLists.txt
@@ -54,9 +54,17 @@
         VERSION ${GENERIC_LIB_VERSION}
         SOVERSION ${GENERIC_LIB_SOVERSION}
 )
-
-install(
-    TARGETS artikulatelearnerprofile
-    LIBRARY NAMELINK_SKIP
-    ${INSTALL_TARGETS_DEFAULT_ARGS}
-)
+if (NOT APPLE AND NOT WIN32)
+    install(
+        TARGETS artikulatelearnerprofile
+        LIBRARY DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate NAMELINK_SKIP
+        RUNTIME DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+        BUNDLE DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+    )
+else()
+    install(
+        TARGETS artikulatelearnerprofile
+        LIBRARY NAMELINK_SKIP
+        ${INSTALL_TARGETS_DEFAULT_ARGS}
+    )
+endif()
--- a/libsound/src/CMakeLists.txt
+++ b/libsound/src/CMakeLists.txt
@@ -53,11 +53,20 @@
     SOVERSION ${GENERIC_LIB_SOVERSION}
 )
 
-install(
-    TARGETS artikulatesound
-    LIBRARY NAMELINK_SKIP
-    ${INSTALL_TARGETS_DEFAULT_ARGS}
-)
+if (NOT APPLE AND NOT WIN32)
+    install(
+        TARGETS artikulatesound
+        LIBRARY DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate NAMELINK_SKIP
+        RUNTIME DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+        BUNDLE DESTINATION ${KDE_INSTALL_FULL_LIBDIR}/artikulate
+    )
+else()
+    install(
+        TARGETS artikulatesound
+        LIBRARY NAMELINK_SKIP
+        ${INSTALL_TARGETS_DEFAULT_ARGS}
+    )
+endif()
 
 if (BUILD_GSTREAMER_PLUGIN)
     ecm_optional_add_subdirectory(qtgstreamerbackend)
--- a/libsound/src/qtmultimediabackend/CMakeLists.txt
+++ b/libsound/src/qtmultimediabackend/CMakeLists.txt
@@ -42,4 +42,9 @@
         KF5::CoreAddons
 )
 
+if (NOT APPLE AND NOT WIN32)
+    set_target_properties(qtmultimediabackend PROPERTIES
+        INSTALL_RPATH "${KDE_INSTALL_FULL_LIBDIR}/artikulate;${CMAKE_INSTALL_RPATH}"
+    )
+endif()
 install(TARGETS qtmultimediabackend DESTINATION ${PLUGIN_INSTALL_DIR}/artikulate/libsound)
