Merge lp:~meberl/inkscape/extension-fixes into lp:~inkscape.dev/inkscape/trunk

Proposed by meberl
Status: Merged
Approved by: Mc
Approved revision: 14864
Merged at revision: 14866
Proposed branch: lp:~meberl/inkscape/extension-fixes
Merge into: lp:~inkscape.dev/inkscape/trunk
Diff against target: 143 lines (+25/-13)
5 files modified
CMakeLists.txt (+3/-4)
src/CMakeLists.txt (+10/-0)
src/extension/loader.cpp (+1/-1)
src/extension/loader.h (+3/-3)
src/extension/system.cpp (+8/-5)
To merge this branch: bzr merge lp:~meberl/inkscape/extension-fixes
Reviewer Review Type Date Requested Status
Mc Approve
Review via email: mp+293372@code.launchpad.net

Description of the change

- Restructured CMake a bit, the install targets are now in src/CMakeLists.txt.
- CMake build now links the inkscape and inkview executables against the libinkscape_base library that is installed. This can be verified with ldd.
- Fixed a bug in the extension system. The plugin loader searches for the binary in the directory of the inx file.

To post a comment you must log in.
Revision history for this message
Mc (mc...) wrote :

Just tested, and cannot run after installing :

./inkscape: error while loading shared libraries: libgdl_LIB.so: cannot open shared object file: No such file or directory

$ ldd ./inkscape
 linux-vdso.so.1 (0x00007fff3d133000)
 libinkscape_base.so => /home/mc/[...install path...]/bin/./../lib/libinkscape_base.so (0x00007f6a2e5b6000)
 libgdl_LIB.so => not found
 libnrtype_LIB.so => not found
 libcroco_LIB.so => not found
 libavoid_LIB.so => not found
 libcola_LIB.so => not found
 libvpsc_LIB.so => not found
 liblivarot_LIB.so => not found
 libuemf_LIB.so => not found
 lib2geom_LIB.so => not found
 libdepixelize_LIB.so => not found
 libutil_LIB.so => not found
 libgc_LIB.so => not found
 libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f6a2e368000)
[...]

review: Needs Fixing (test)
Revision history for this message
Mc (mc...) wrote :

Ok, I fixed it. Merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-04-16 17:26:13 +0000
3+++ CMakeLists.txt 2016-04-29 09:53:54 +0000
4@@ -19,6 +19,8 @@
5 set(INKSCAPE_VERSION 0.91+devel)
6 set(PROJECT_NAME inkscape)
7 set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
8+SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/")
9+
10
11 cmake_policy(SET CMP0003 NEW) # don't be prolific with library paths
12 cmake_policy(SET CMP0005 NEW) # proper define quoting
13@@ -173,10 +175,7 @@
14 # Installation
15 # -----------------------------------------------------------------------------
16 if(UNIX)
17- install(
18- PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/inkscape ${EXECUTABLE_OUTPUT_PATH}/inkview
19- DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
20- )
21+ #The install directive for the binaries and libraries are found in src/CMakeList.txt
22
23 install(
24 FILES ${CMAKE_BINARY_DIR}/inkscape.desktop
25
26=== modified file 'src/CMakeLists.txt'
27--- src/CMakeLists.txt 2016-04-16 17:24:08 +0000
28+++ src/CMakeLists.txt 2016-04-29 09:53:54 +0000
29@@ -558,6 +558,8 @@
30 endif()
31
32
33+
34+
35 # Link the inkscape_base library against all external dependencies
36 target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS})
37
38@@ -565,3 +567,11 @@
39 target_link_libraries(inkscape inkscape_base )
40 target_link_libraries(inkview inkscape_base)
41
42+#Define the installation
43+install(
44+ TARGETS inkscape_base inkscape inkview
45+ RUNTIME DESTINATION bin
46+ LIBRARY DESTINATION lib
47+)
48+
49+
50
51=== modified file 'src/extension/loader.cpp'
52--- src/extension/loader.cpp 2016-04-21 06:14:10 +0000
53+++ src/extension/loader.cpp 2016-04-29 09:53:54 +0000
54@@ -74,7 +74,7 @@
55 _getInkscapeVersion GetInkscapeVersion = NULL;
56
57 // build the path where to look for the plugin
58- gchar *path = g_build_filename(_baseDirectory, name, (char *) NULL);
59+ gchar *path = g_build_filename(_baseDirectory.c_str(), name, (char *) NULL);
60 module = g_module_open(path, G_MODULE_BIND_LOCAL);
61 g_free(path);
62
63
64=== modified file 'src/extension/loader.h'
65--- src/extension/loader.h 2016-04-12 09:43:56 +0000
66+++ src/extension/loader.h 2016-04-29 09:53:54 +0000
67@@ -31,7 +31,7 @@
68 *
69 * @param dir is the path where the plugin should be loaded from.
70 */
71- void set_base_directory(const gchar *dir) {
72+ void set_base_directory(std::string dir) {
73 _baseDirectory = dir;
74 }
75
76@@ -51,7 +51,7 @@
77 Implementation::Implementation *load_implementation(Inkscape::XML::Document *doc);
78
79 private:
80- const gchar *_baseDirectory; /**< The base directory to load a plugin from */
81+ std::string _baseDirectory; /**< The base directory to load a plugin from */
82
83
84 };
85@@ -70,4 +70,4 @@
86 fill-column:99
87 End:
88 */
89-// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99:
90\ No newline at end of file
91+// vim:filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99:
92
93=== modified file 'src/extension/system.cpp'
94--- src/extension/system.cpp 2016-04-12 09:43:56 +0000
95+++ src/extension/system.cpp 2016-04-29 09:53:54 +0000
96@@ -47,7 +47,7 @@
97
98 static void open_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data);
99 static void save_internal(Inkscape::Extension::Extension *in_plug, gpointer in_data);
100-static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp);
101+static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir);
102
103 /**
104 * \return A new document created from the filename passed in
105@@ -422,7 +422,7 @@
106 * case could apply to modules that are built in (like the SVG load/save functions).
107 */
108 static Extension *
109-build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp)
110+build_from_reprdoc(Inkscape::XML::Document *doc, Implementation::Implementation *in_imp, std::string* baseDir)
111 {
112 enum {
113 MODULE_EXTENSION,
114@@ -490,7 +490,9 @@
115 }
116 case MODULE_PLUGIN: {
117 Inkscape::Extension::Loader loader = Inkscape::Extension::Loader();
118- loader.set_base_directory ( Inkscape::Application::profile_path("extensions"));
119+ if( baseDir != NULL){
120+ loader.set_base_directory ( *baseDir );
121+ }
122 imp = loader.load_implementation(doc);
123 break;
124 }
125@@ -546,7 +548,8 @@
126 build_from_file(gchar const *filename)
127 {
128 Inkscape::XML::Document *doc = sp_repr_read_file(filename, INKSCAPE_EXTENSION_URI);
129- Extension *ext = build_from_reprdoc(doc, NULL);
130+ std::string dir = Glib::path_get_dirname(filename);
131+ Extension *ext = build_from_reprdoc(doc, NULL, &dir);
132 if (ext != NULL)
133 Inkscape::GC::release(doc);
134 else
135@@ -568,7 +571,7 @@
136 {
137 Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI);
138 g_return_val_if_fail(doc != NULL, NULL);
139- Extension *ext = build_from_reprdoc(doc, in_imp);
140+ Extension *ext = build_from_reprdoc(doc, in_imp, NULL);
141 Inkscape::GC::release(doc);
142 return ext;
143 }