[shotwell] plugins: Remove symbol multiplication



commit 10fcb55552cb55accaa2c529beb494d1e31e730c
Author: Jens Georg <mail jensge org>
Date:   Sun Jun 19 19:30:51 2016 +0200

    plugins: Remove symbol multiplication
    
    RESTSupport was included twice, resorces 4 times, defining all symbols
    multiple times - not that good.
    
    Solved by compiling RESTSupport and Resources into a shared library
    
    Signed-off-by: Jens Georg <mail jensge org>

 Makefile                                    |    5 ++++-
 plugins/Makefile.plugin.mk                  |   11 ++++++-----
 plugins/common/Makefile                     |   19 +++++++++++++++++++
 plugins/common/RESTSupport.vala             |    2 +-
 plugins/plugins.mk                          |    1 +
 plugins/shotwell-data-imports/Makefile      |    4 +++-
 plugins/shotwell-publishing-extras/Makefile |    1 -
 plugins/shotwell-publishing/Makefile        |    3 +--
 plugins/shotwell-transitions/Makefile       |    4 ++++
 9 files changed, 39 insertions(+), 11 deletions(-)
---
diff --git a/Makefile b/Makefile
index c48e9eb..974258f 100644
--- a/Makefile
+++ b/Makefile
@@ -310,7 +310,8 @@ UNITIZE_INITS := $(foreach nm,$(UNIT_NAMESPACES),$(UNITIZE_DIR)/_$(nm)Internals.
 UNITIZE_STAMP := $(UNITIZE_DIR)/.unitized
 
 PLUGINS_DIR := plugins
-PLUGINS_SO := $(foreach plugin,$(PLUGINS),$(PLUGINS_DIR)/$(plugin)/$(plugin).so)
+INSTALL_PLUGINS = $(filter-out common,$(PLUGINS))
+PLUGINS_SO := $(foreach plugin,$(INSTALL_PLUGINS),$(PLUGINS_DIR)/$(plugin)/$(plugin).so)
 EXTRA_PLUGINS_SO := $(foreach plugin,$(EXTRA_PLUGINS),$(PLUGINS_DIR)/$(plugin)/$(plugin).so)
 PLUGINS_DIST_FILES := `$(MAKE) --directory=plugins --no-print-directory listfiles`
 
@@ -563,6 +564,7 @@ endif
                $(SYSTEM_LANG_DIR)/$(lang)/LC_MESSAGES/shotwell.mo`)
        mkdir -p $(DESTDIR)$(PREFIX)/$(LIB)/shotwell/plugins/builtin
        $(INSTALL_PROGRAM) $(PLUGINS_SO) $(DESTDIR)$(PREFIX)/$(LIB)/shotwell/plugins/builtin
+       $(INSTALL_PROGRAM) plugins/common/libshotwell-plugin-common.so $(DESTDIR)$(PREFIX)/$(LIB)
 ifdef PLUGINS_RC
        $(INSTALL_DATA) $(PLUGINS_RC) $(DESTDIR)$(PREFIX)/$(LIB)/shotwell/plugins/builtin
 endif
@@ -611,6 +613,7 @@ ifdef ENABLE_APPORT_HOOK_INSTALL
 endif
        $(foreach lang,$(CORE_SUPPORTED_LANGUAGES),`rm -f $(SYSTEM_LANG_DIR)/$(lang)/LC_MESSAGES/shotwell.mo`)
        rm -rf $(DESTDIR)$(PREFIX)/$(LIB)/shotwell/plugins/builtin
+       rm -rf $(DESTDIR)$(PREFIX)/$(LIB)/libshotwell-plugin-common.so
 ifdef INSTALL_HEADERS
        rm -rf $(DESTDIR)$(PREFIX)/include/shotwell
        rm -f $(foreach vapi,$(PLUGIN_VAPI),$(DESTDIR)$(PREFIX)/share/vala/vapi/$(notdir $(vapi)))
diff --git a/plugins/Makefile.plugin.mk b/plugins/Makefile.plugin.mk
index 03df7b0..d5b3a29 100644
--- a/plugins/Makefile.plugin.mk
+++ b/plugins/Makefile.plugin.mk
@@ -28,9 +28,6 @@ PKGS := $(shell sed ':a;N;$$!ba;s/\n/ /g' ../shotwell-plugin-dev-1.0.deps) $(PKG
 EXT_PKGS := $(PKGS)
 PKGS := shotwell-plugin-dev-1.0 $(PKGS) $(PLUGIN_PKGS)
 
-# automatically include the Resources.vala common file
-SRC_FILES := ../common/Resources.vala $(SRC_FILES)
-
 CFILES := $(notdir $(SRC_FILES:.vala=.c))
 OFILES := $(notdir $(SRC_FILES:.vala=.o))
 
@@ -41,10 +38,14 @@ DEFINES := -D_VERSION='"$(PLUGINS_VERSION)"' -DGETTEXT_PACKAGE='"shotwell"'
 
 all: $(PLUGIN).so
 
+PLUGIN_EXTRAFLAGS ?= --vapidir=../common --pkg shotwell-plugin-common
+PLUGIN_EXTRALINKFLAGS ?= -L../common/ -lshotwell-plugin-common
+
 .stamp: $(SRC_FILES) $(MAKE_FILES) $(HEADER_FILES)
        $(VALAC) --target-glib=$(MIN_GLIB_VERSION) -g --enable-checking --fatal-warnings --ccode 
--enable-deprecated \
                --vapidir=../ $(foreach pkg,$(PKGS),--pkg=$(pkg)) $(foreach 
pkg,$(CUSTOM_VAPI_PKGS),--pkg=$(pkg)) \
                $(USER_VALAFLAGS) \
+               $(PLUGIN_EXTRAFLAGS) \
                --vapidir=../../vapi \
                $(SRC_FILES)
        @touch .stamp
@@ -53,10 +54,10 @@ $(CFILES): .stamp
        @
 
 .c.o:
-       $(CC) -c $(CFLAGS) $(DEFINES) -I../.. $<
+       $(CC) -c $(CFLAGS) $(DEFINES) -I../.. -I ../common $<
 
 $(PLUGIN).so: $(OFILES)
-       $(CC) $(LDFLAGS) -shared $(OFILES) $(LIBS) -o $@
+       $(CC) $(LDFLAGS) -shared $(OFILES) $(LIBS) $(PLUGIN_EXTRALINKFLAGS) -o $@
 
 .PHONY: cleantemps
 cleantemps:
diff --git a/plugins/common/Makefile b/plugins/common/Makefile
new file mode 100644
index 0000000..5047339
--- /dev/null
+++ b/plugins/common/Makefile
@@ -0,0 +1,19 @@
+
+PLUGIN := libshotwell-plugin-common
+
+PLUGIN_PKGS := \
+       gee-0.8 \
+       libxml-2.0 \
+       libsoup-2.4 \
+       json-glib-1.0 \
+       webkit2gtk-4.0
+
+SRC_FILES := Resources.vala RESTSupport.vala
+
+PLUGIN_EXTRAFLAGS := --vapi=shotwell-plugin-common.vapi \
+       --header=shotwell-plugin-common.h
+
+PLUGIN_EXTRALINKFLAGS :=
+
+include ../Makefile.plugin.mk
+
diff --git a/plugins/common/RESTSupport.vala b/plugins/common/RESTSupport.vala
index d23923c..d9bf2ce 100644
--- a/plugins/common/RESTSupport.vala
+++ b/plugins/common/RESTSupport.vala
@@ -585,7 +585,7 @@ public string decimal_entity_encode(string source) {
     return encoded_str_builder.str;
 }
 
-internal abstract class BatchUploader {
+public abstract class BatchUploader {
     private int current_file = 0;
     private Spit.Publishing.Publishable[] publishables = null;
     private Session session = null;
diff --git a/plugins/plugins.mk b/plugins/plugins.mk
index 2f28608..687ceeb 100644
--- a/plugins/plugins.mk
+++ b/plugins/plugins.mk
@@ -1,5 +1,6 @@
 
 PLUGINS := \
+       common \
        shotwell-transitions \
        shotwell-publishing \
        shotwell-data-imports
diff --git a/plugins/shotwell-data-imports/Makefile b/plugins/shotwell-data-imports/Makefile
index 1769771..203aeed 100644
--- a/plugins/shotwell-data-imports/Makefile
+++ b/plugins/shotwell-data-imports/Makefile
@@ -5,7 +5,9 @@ PLUGIN_PKGS := \
        gtk+-3.0 \
        gexiv2 \
        gee-0.8 \
-       sqlite3
+       sqlite3 \
+       libxml-2.0 \
+       libsoup-2.4
 
 SRC_FILES := \
        shotwell-data-imports.vala \
diff --git a/plugins/shotwell-publishing-extras/Makefile b/plugins/shotwell-publishing-extras/Makefile
index 58ff6e3..83a42c2 100644
--- a/plugins/shotwell-publishing-extras/Makefile
+++ b/plugins/shotwell-publishing-extras/Makefile
@@ -16,7 +16,6 @@ SRC_FILES := \
        YandexPublishing.vala \
        TumblrPublishing.vala \
        RajcePublishing.vala \
-       ../common/RESTSupport.vala
 
 # RC_FILES must also be added to ../plugins.mk to ensure they're installed properly
 RC_FILES := \
diff --git a/plugins/shotwell-publishing/Makefile b/plugins/shotwell-publishing/Makefile
index 830b7ca..607bc6b 100644
--- a/plugins/shotwell-publishing/Makefile
+++ b/plugins/shotwell-publishing/Makefile
@@ -17,8 +17,7 @@ SRC_FILES := \
        PicasaPublishing.vala \
        FlickrPublishing.vala \
        YouTubePublishing.vala \
-       PiwigoPublishing.vala \
-       ../common/RESTSupport.vala
+       PiwigoPublishing.vala
 
 RC_FILES := \
        facebook.png \
diff --git a/plugins/shotwell-transitions/Makefile b/plugins/shotwell-transitions/Makefile
index 043891c..9044011 100644
--- a/plugins/shotwell-transitions/Makefile
+++ b/plugins/shotwell-transitions/Makefile
@@ -1,6 +1,10 @@
 
 PLUGIN := shotwell-transitions
 
+PLUGIN_PKGS := \
+       libxml-2.0 \
+       libsoup-2.4
+
 SRC_FILES := \
        shotwell-transitions.vala \
        FadeEffect.vala \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]