Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[buteo-sync-plugins-social] Adapt to changes in Buteo plugin API. JB#…
…52916

Out-of-process plugins are now built as .so Qt plugins, instead of as
executable binaries.

Also remove unnecessary OUT_OF_PROCESS_PLUGIN define as library is
always built as an out-of-process plugin.
  • Loading branch information
blammit committed Mar 30, 2021
1 parent 8c7025e commit 1d80cc4
Show file tree
Hide file tree
Showing 75 changed files with 533 additions and 635 deletions.
111 changes: 26 additions & 85 deletions rpm/buteo-sync-plugins-social.spec
Expand Up @@ -13,7 +13,7 @@ BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Contacts)
BuildRequires: qt5-qttools-linguist
BuildRequires: pkgconfig(mlite5)
BuildRequires: pkgconfig(buteosyncfw5) >= 0.6.36
BuildRequires: pkgconfig(buteosyncfw5) >= 0.10.0
BuildRequires: pkgconfig(libsignon-qt5)
BuildRequires: pkgconfig(accounts-qt5) >= 1.13
BuildRequires: pkgconfig(socialcache) >= 0.0.48
Expand All @@ -35,10 +35,7 @@ A Buteo plugin which provides data synchronization with various social services.

%files
%defattr(-,root,root,-)
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/sociald-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libsociald-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libsociald-client.so
%config %{_sysconfdir}/buteo/profiles/client/sociald.xml
%config %{_sysconfdir}/buteo/profiles/sync/sociald.All.xml
%{_libdir}/libsyncpluginscommon.so.*
Expand All @@ -60,24 +57,15 @@ Provides: sociald-facebook-signon

%files facebook
# calendar:
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/facebook-calendars-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libfacebook-calendars-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libfacebook-calendars-client.so
%config %{_sysconfdir}/buteo/profiles/client/facebook-calendars.xml
%config %{_sysconfdir}/buteo/profiles/sync/facebook.Calendars.xml
# images:
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/facebook-images-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libfacebook-images-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libfacebook-images-client.so
%config %{_sysconfdir}/buteo/profiles/client/facebook-images.xml
%config %{_sysconfdir}/buteo/profiles/sync/facebook.Images.xml
# signon
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/facebook-signon-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libfacebook-signon-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libfacebook-signon-client.so
%config %{_sysconfdir}/buteo/profiles/client/facebook-signon.xml
%config %{_sysconfdir}/buteo/profiles/sync/facebook.Signon.xml

Expand Down Expand Up @@ -123,24 +111,15 @@ Provides: sociald-google-signon

%files google
# calendar
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/google-calendars-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libgoogle-calendars-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libgoogle-calendars-client.so
%config %{_sysconfdir}/buteo/profiles/client/google-calendars.xml
%config %{_sysconfdir}/buteo/profiles/sync/google.Calendars.xml
# contacts
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/google-contacts-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libgoogle-contacts-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libgoogle-contacts-client.so
%config %{_sysconfdir}/buteo/profiles/client/google-contacts.xml
%config %{_sysconfdir}/buteo/profiles/sync/google.Contacts.xml
# signon
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/google-signon-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libgoogle-signon-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libgoogle-signon-client.so
%config %{_sysconfdir}/buteo/profiles/client/google-signon.xml
%config %{_sysconfdir}/buteo/profiles/sync/google.Signon.xml

Expand Down Expand Up @@ -180,18 +159,12 @@ Provides: sociald-twitter-posts

%files twitter
# notifications
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/twitter-notifications-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libtwitter-notifications-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libtwitter-notifications-client.so
%config %{_sysconfdir}/buteo/profiles/client/twitter-notifications.xml
%config %{_sysconfdir}/buteo/profiles/sync/twitter.Notifications.xml
%{_datadir}/translations/lipstick-jolla-home-twitter-notif_eng_en.qm
# posts
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/twitter-posts-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libtwitter-posts-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libtwitter-posts-client.so
%config %{_sysconfdir}/buteo/profiles/client/twitter-posts.xml
%config %{_sysconfdir}/buteo/profiles/sync/twitter.Posts.xml

Expand Down Expand Up @@ -228,26 +201,17 @@ Provides: sociald-onedrive-backup

%files onedrive
# signon
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/onedrive-signon-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libonedrive-signon-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libonedrive-signon-client.so
%config %{_sysconfdir}/buteo/profiles/client/onedrive-signon.xml
%config %{_sysconfdir}/buteo/profiles/sync/onedrive.Signon.xml
# images
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/onedrive-images-client
%{_libdir}/buteo-plugins-qt5/oopp/libonedrive-images-client.so
# backup
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libonedrive-images-client.so
%config %{_sysconfdir}/buteo/profiles/client/onedrive-images.xml
%config %{_sysconfdir}/buteo/profiles/sync/onedrive.Images.xml
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/onedrive-backup-client
%{_libdir}/buteo-plugins-qt5/oopp/onedrive-backupquery-client
%{_libdir}/buteo-plugins-qt5/oopp/onedrive-backuprestore-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libonedrive-backup-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libonedrive-backup-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libonedrive-backupquery-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libonedrive-backuprestore-client.so
#%%{_libdir}/buteo-plugins-qt5/libonedrive-backupquery-client.so
#%%{_libdir}/buteo-plugins-qt5/libonedrive-backuprestore-client.so
%config %{_sysconfdir}/buteo/profiles/client/onedrive-backup.xml
Expand Down Expand Up @@ -305,38 +269,24 @@ Provides: sociald-vk-images

%files vk
# posts
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-posts-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libvk-posts-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libvk-posts-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-posts.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Posts.xml
# notifications
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-notifications-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libvk-notifications-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libvk-notifications-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-notifications.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Notifications.xml
# calendars
#out-of-proces-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-calendars-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libvk-calendars-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libvk-calendars-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-calendars.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Calendars.xml
# contacts
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-contacts-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libvk-contacts-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libvk-contacts-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-contacts.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Contacts.xml
# images
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-images-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libvk-images-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libvk-images-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-images.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Images.xml

Expand Down Expand Up @@ -392,19 +342,13 @@ Provides: sociald-dropbox-backup

%files dropbox
# images
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/dropbox-images-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libdropbox-images-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libdropbox-images-client.so
%config %{_sysconfdir}/buteo/profiles/client/dropbox-images.xml
%config %{_sysconfdir}/buteo/profiles/sync/dropbox.Images.xml
# backup
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/dropbox-backup-client
%{_libdir}/buteo-plugins-qt5/oopp/dropbox-backupquery-client
%{_libdir}/buteo-plugins-qt5/oopp/dropbox-backuprestore-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/libdropbox-backup-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libdropbox-backup-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libdropbox-backupquery-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libdropbox-backuprestore-client.so
#%%{_libdir}/buteo-plugins-qt5/libdropbox-backupquery-client.so
#%%{_libdir}/buteo-plugins-qt5/libdropbox-backuprestore-client.so
%config %{_sysconfdir}/buteo/profiles/client/dropbox-backup.xml
Expand Down Expand Up @@ -452,10 +396,7 @@ systemctl-user try-restart msyncd.service || :

%files knowncontacts
%defattr(-,root,root,-)
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/knowncontacts-client
#in-process-plugin form:
#%%{_libdir}/buteo-plugins-qt5/knowncontacts-client.so
%{_libdir}/buteo-plugins-qt5/oopp/libknowncontacts-client.so
%{_sysconfdir}/buteo/profiles/client/knowncontacts.xml
%{_sysconfdir}/buteo/profiles/sync/knowncontacts.Contacts.xml

Expand All @@ -476,7 +417,7 @@ Summary: Translation source for sociald
%setup -q -n %{name}-%{version}

%build
%qmake5 "DEFINES+=OUT_OF_PROCESS_PLUGIN" \
%qmake5 \
"CONFIG+=dropbox" \
"CONFIG+=facebook" \
"CONFIG+=google" \
Expand Down
27 changes: 3 additions & 24 deletions src/common.pri
Expand Up @@ -34,27 +34,6 @@ contains(DEFINES, 'SOCIALD_USE_QTPIM') {
HEADERS += contactmanagerengine.h
}

!contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5
message("building" $$TARGET "as in-process plugin")
}
contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = app
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
message("building" $$TARGET "as out-of-process plugin")

DEFINES += CLIENT_PLUGIN
BUTEO_OOPP_INCLUDE_DIR = $$system(pkg-config --cflags buteosyncfw5|cut -f2 -d'I')
INCLUDEPATH += $$BUTEO_OOPP_INCLUDE_DIR

HEADERS += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.h

SOURCES += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/plugin_main.cpp
}
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
8 changes: 1 addition & 7 deletions src/common/socialdbuteoplugin.h
Expand Up @@ -25,19 +25,13 @@
#include <QtCore/qglobal.h>
#include "buteosyncfw_p.h"

#if defined(OUT_OF_PROCESS_PLUGIN)
# define SOCIALDBUTEOPLUGIN_EXPORT Q_DECL_EXPORT
#else
# define SOCIALDBUTEOPLUGIN_EXPORT Q_DECL_IMPORT
#endif

/*
Datatype-specific implementations of this class
allow per-account sync profiles for that data type.
*/

class SocialNetworkSyncAdaptor;
class SOCIALDBUTEOPLUGIN_EXPORT SocialdButeoPlugin : public Buteo::ClientPlugin
class Q_DECL_EXPORT SocialdButeoPlugin : public Buteo::ClientPlugin
{
Q_OBJECT

Expand Down
2 changes: 0 additions & 2 deletions src/dropbox/dropbox-backup/dropbox-backup.pro
@@ -1,7 +1,5 @@
TARGET = dropbox-backup-client

DEFINES += "CLASSNAME=DropboxBackupPlugin"
DEFINES += CLASSNAME_H=\\\"dropboxbackupplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../dropbox-common.pri)
include($$PWD/../dropbox-backupoperation.pri)
Expand Down
22 changes: 10 additions & 12 deletions src/dropbox/dropbox-backup/dropboxbackupplugin.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (c) 2020 Open Mobile Platform LLC.
** Copyright (c) 2015 - 2021 Jolla Ltd.
**
** This program/library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
Expand All @@ -22,18 +23,6 @@
#include "dropboxbackupsyncadaptor.h"
#include "socialnetworksyncadaptor.h"

extern "C" DropboxBackupPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
{
return new DropboxBackupPlugin(pluginName, profile, callbackInterface);
}

extern "C" void destroyPlugin(DropboxBackupPlugin* plugin)
{
delete plugin;
}

DropboxBackupPlugin::DropboxBackupPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
Expand All @@ -51,3 +40,12 @@ SocialNetworkSyncAdaptor *DropboxBackupPlugin::createSocialNetworkSyncAdaptor()
{
return new DropboxBackupSyncAdaptor(this);
}


Buteo::ClientPlugin* DropboxBackupPluginLoader::createClientPlugin(
const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface)
{
return new DropboxBackupPlugin(pluginName, profile, cbInterface);
}
19 changes: 14 additions & 5 deletions src/dropbox/dropbox-backup/dropboxbackupplugin.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (c) 2020 Open Mobile Platform LLC.
** Copyright (c) 2015 - 2021 Jolla Ltd.
**
** This program/library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public License
Expand All @@ -23,7 +24,9 @@

#include "socialdbuteoplugin.h"

class SOCIALDBUTEOPLUGIN_EXPORT DropboxBackupPlugin : public SocialdButeoPlugin
#include <buteosyncfw5/SyncPluginLoader.h>

class Q_DECL_EXPORT DropboxBackupPlugin : public SocialdButeoPlugin
{
Q_OBJECT

Expand All @@ -37,10 +40,16 @@ class SOCIALDBUTEOPLUGIN_EXPORT DropboxBackupPlugin : public SocialdButeoPlugin
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor();
};

extern "C" DropboxBackupPlugin* createPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);
class DropboxBackupPluginLoader : public Buteo::SyncPluginLoader
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.DropboxBackupPluginLoader")
Q_INTERFACES(Buteo::SyncPluginLoader)

extern "C" void destroyPlugin(DropboxBackupPlugin* client);
public:
Buteo::ClientPlugin* createClientPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface) override;
};

#endif // DROPBOXBACKUPPLUGIN_H
2 changes: 0 additions & 2 deletions src/dropbox/dropbox-backupquery/dropbox-backupquery.pro
@@ -1,7 +1,5 @@
TARGET = dropbox-backupquery-client

DEFINES += "CLASSNAME=DropboxBackupQueryPlugin"
DEFINES += CLASSNAME_H=\\\"dropboxbackupqueryplugin.h\\\"
include($$PWD/../../common.pri)
include($$PWD/../dropbox-common.pri)
include($$PWD/../dropbox-backupoperation.pri)
Expand Down

0 comments on commit 1d80cc4

Please sign in to comment.