summaryrefslogtreecommitdiffstats
path: root/libcouchbase-0002-do-not-install-plugins-into-libdir.patch
blob: 74a05289ac0e54485e1a12d183da2e5cfe3ac0b0 (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
From 3d7f066b7d97a8d05fcde0b6cb1b6ac521279d82 Mon Sep 17 00:00:00 2001
From: Sergey Avseyev <sergey.avseyev@gmail.com>
Date: Wed, 27 Sep 2017 02:04:00 +0300
Subject: [PATCH] Do not install plugins into libdir

---
 cmake/config-cmake.h.in            | 2 +-
 plugins/io/libev/CMakeLists.txt    | 2 +-
 plugins/io/libevent/CMakeLists.txt | 2 +-
 plugins/io/libuv/CMakeLists.txt    | 2 +-
 src/iofactory.c                    | 6 ++++++
 5 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/cmake/config-cmake.h.in b/cmake/config-cmake.h.in
index 81128091..f97d8bf5 100644
--- a/cmake/config-cmake.h.in
+++ b/cmake/config-cmake.h.in
@@ -56,7 +56,7 @@
 
 #cmakedefine LCB_USE_HDR_HISTOGRAM
 
-#define LCB_LIBDIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
+#define LCB_LIBDIR "${CMAKE_INSTALL_LIBDIR}/libcouchbase"
 
 #include "config_static.h"
 #endif
diff --git a/plugins/io/libev/CMakeLists.txt b/plugins/io/libev/CMakeLists.txt
index 6eaa62f6..1ad13736 100644
--- a/plugins/io/libev/CMakeLists.txt
+++ b/plugins/io/libev/CMakeLists.txt
@@ -26,4 +26,4 @@ ENDIF()
 
 INSTALL(TARGETS
     couchbase_libev
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/libcouchbase")
diff --git a/plugins/io/libevent/CMakeLists.txt b/plugins/io/libevent/CMakeLists.txt
index 1b96a9e3..95ff434b 100644
--- a/plugins/io/libevent/CMakeLists.txt
+++ b/plugins/io/libevent/CMakeLists.txt
@@ -22,7 +22,7 @@ IF(LCB_EMBED_PLUGIN_LIBEVENT)
     SET(LCB_LINK_SPEC "${LCB_LINKS_SPEC} ${LIBEVENT_LIBRARIES}")
 ELSE()
     ADD_LIBRARY(couchbase_libevent SHARED plugin-libevent.c)
-    INSTALL(TARGETS couchbase_libevent LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    INSTALL(TARGETS couchbase_libevent LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/libcouchbase")
     TARGET_LINK_LIBRARIES(couchbase_libevent ${LIBEVENT_LIBRARIES})
 ENDIF()
 
diff --git a/plugins/io/libuv/CMakeLists.txt b/plugins/io/libuv/CMakeLists.txt
index 2492a835..86f31687 100644
--- a/plugins/io/libuv/CMakeLists.txt
+++ b/plugins/io/libuv/CMakeLists.txt
@@ -38,5 +38,5 @@ INCLUDE_DIRECTORIES(AFTER ${LIBUV_INCLUDE_DIR})
 ADD_DEFINITIONS(-DLIBCOUCHBASE_INTERNAL=1)
 INSTALL(TARGETS
     couchbase_libuv
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/libcouchbase"
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/src/iofactory.c b/src/iofactory.c
index 74eae50c..ca1a2d1b 100644
--- a/src/iofactory.c
+++ b/src/iofactory.c
@@ -366,6 +366,12 @@ static lcb_error_t generate_options(plugin_info *pi,
                 }
                 ret = get_create_func(ours->v.v1.sofile, ours->v.v1.symbol, &plugin, want_debug);
                 if (ret != LCB_SUCCESS) {
+                    char path[PATH_MAX];
+                    /* try to look up the so-file in the libdir */
+                    snprintf(path, PATH_MAX, "%s/%s", LCB_LIBDIR, ours->v.v1.sofile);
+                    ret = get_create_func(path, ours->v.v1.symbol, &plugin, want_debug);
+                }
+                if (ret != LCB_SUCCESS) {
                     if (type) {
                         *type = LCB_IO_OPS_SELECT;
                     }
-- 
2.13.6