Skip to content
Permalink
Browse files
[nemo-transferengine] Allow nemo-transferengine to be built on Qt5
  • Loading branch information
Vesa Halttunen committed May 13, 2013
1 parent 983922c commit 3fb3c880f9fa62428bec63fbcf334ef91ace403a
@@ -25,7 +25,7 @@
****************************************************************************************/

#include "imageoperation.h"
#include <quillmetadata/QuillMetadata>
#include <QuillMetadata>

#include <QFileInfo>
#include <QtDebug>
@@ -1,10 +1,12 @@
TEMPLATE = lib
TARGET = nemotransferengine
equals(QT_MAJOR_VERSION, 4): TARGET = nemotransferengine
equals(QT_MAJOR_VERSION, 5): TARGET = nemotransferengine-qt5
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += shared link_pkgconfig
QT += dbus
CONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += quillmetadata-qt5

system(qdbusxml2cpp -v -c TransferEngineInterface -p transferengineinterface.h:transferengineinterface.cpp -i metatypedeclarations.h ../dbus/org.nemo.transferengine.xml)

@@ -39,12 +41,14 @@ SOURCES += \
OTHER_FILES += nemotransfernegine.pc nemotransferengine-plugin.prf

headers.files = $$HEADERS
headers.path = /usr/include/TransferEngine
equals(QT_MAJOR_VERSION, 4): headers.path = /usr/include/TransferEngine
equals(QT_MAJOR_VERSION, 5): headers.path = /usr/include/TransferEngine-qt5

target.path = /usr/lib

pkgconfigpc.path = /usr/lib/pkgconfig/
pkgconfigpc.files = nemotransferengine.pc
equals(QT_MAJOR_VERSION, 4): pkgconfigpc.files = nemotransferengine.pc
equals(QT_MAJOR_VERSION, 5): pkgconfigpc.files = nemotransferengine-qt5.pc

prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
prf.files = nemotransferengine-plugin.prf
@@ -0,0 +1,11 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/TransferEngine-qt5

Name: libnemotransferengine-qt5
Description: Nemo transfer engine library for share plugins and transfer engine API
Version: 0.0.1
Requires: Qt5Core Qt5DBus
Libs: -L${libdir} -lnemotransferengine-qt5
Cflags: -I${includedir}
@@ -0,0 +1,119 @@
Name: nemo-transferengine-qt5
Version: 0.0.16
Release: 0
Summary: Transfer Engine for uploading media content and tracking transfers.
Group: System Environment/Daemon
License: LGPLv2.1
URL: https://github.com/nemomobile/transfer-engine
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(accounts-qt5)
BuildRequires: desktop-file-utils
BuildRequires: pkgconfig(mlite5)
BuildRequires: pkgconfig(quillmetadata-qt5)

%description
%{summary}.

%files
%defattr(-,root,root,-)
%dir %{_datadir}/nemo-transferengine
%{_libdir}/*.so*
%{_bindir}/nemo-transfer-engine
%{_datadir}/dbus-1/services/org.nemo.transferengine.service
%{_datadir}/translations/nemo-transfer-engine_eng_en.qm



%package devel
Summary: Development headers for transfer engine library.
Group: Development/Libraries
Requires: nemo-transferengine = %{version}

%description -n nemo-transferengine-qt5-devel
%{summary}.

%files devel
%defattr(-,root,root,-)
%{_includedir}/TransferEngine-qt5/*.h
%{_qt_datadir}/mkspecs/features/nemotransferengine-plugin.prf
%{_libdir}/pkgconfig/nemotransferengine-qt5.pc

%package ts-devel
Summary: Translation source for Nemo TransferEngine
License: LGPLv2.1
Group: System Environment/Daemon

%description ts-devel
Translation source for Nemo TransferEngine

%files ts-devel
%defattr(-,root,root,-)
%{_datadir}/translations/source/nemo-transfer-engine.ts

%package tests
Summary: Unit tests for Nemo TransferEngine
License: LGPLv2.1
Group: System Environment/Daemon

%description tests
Unit tests for Nemo TransferEngine

%files tests
%defattr(-,root,root,-)
/opt/tests/nemo-transfer-engine/*

%package doc
Summary: Documentation for Nemo TransferEngine
License: BSD
Group: System Environment/Daemon

%description doc
Documentation for Nemo TransferEngine

%files doc
%defattr(-,root,root,-)
%{_datadir}/doc/nemo-transferengine/*



%prep
%setup -q -n %{name}-%{version}

%build

%qmake5

make %{?jobs:-j%jobs}
make docs

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{_datadir}/nemo-transferengine
%qmake_install

mkdir -p %{buildroot}/%{_docdir}/%{name}
cp -R doc/html/* %{buildroot}/%{_docdir}/%{name}/

%define def_uid $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
%define def_user $(getent passwd %def_uid | sed 's/:.*//')
%define db_file /home/%{def_user}/.local/nemo-transferengine/transferdb.sqlite
%define te_pid $(pgrep -f nemo-transfer-engine)

%post -n nemo-transferengine-qt5
/sbin/ldconfig
if [ -n "%{te_pid}" ]
then
kill -s 10 %{te_pid}
fi

exit 0

%postun -n nemo-transferengine-qt5
/sbin/ldconfig

if [ -f "%{db_file}" ]
then
rm %{db_file}
fi
exit 0
@@ -5,14 +5,15 @@ INCLUDEPATH += . ../lib

QT += dbus sql

LIBS += -L../lib -lnemotransferengine
equals(QT_MAJOR_VERSION, 4): LIBS += -L../lib -lnemotransferengine
equals(QT_MAJOR_VERSION, 5): LIBS += -L../lib -lnemotransferengine-qt5

# generate adaptor code
system(qdbusxml2cpp -c TransferEngineAdaptor -a transferengineadaptor.h:transferengineadaptor.cpp -i metatypedeclarations.h ../dbus/org.nemo.transferengine.xml)

CONFIG += link_pkgconfig
PKGCONFIG += mlite
PKGCONFIG += accounts-qt
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += mlite accounts-qt
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += mlite5 accounts-qt5

# translations
TS_FILE = $$OUT_PWD/nemo-transfer-engine.ts
@@ -2,7 +2,9 @@ TEMPLATE = app
TARGET = ut_nemo-transfer-engine
DEPENDPATH += .
INCLUDEPATH += . ../src ../lib

CONFIG += link_pkgconfig
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += quillmetadata
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += quillmetadata-qt5

# Test files
HEADERS += \
@@ -27,7 +29,6 @@ SOURCES += \
../lib/mediaitem.cpp


LIBS += -lquillmetadata
QT += testlib

PATH = /opt/tests/nemo-transfer-engine
@@ -26,7 +26,7 @@

#include "ut_imageoperation.h"
#include <qtest.h>
#include <quillmetadata/QuillMetadata>
#include <QuillMetadata>
#include "imageoperation.h"
#include <QtDebug>
#include <QDir>
@@ -149,6 +149,7 @@ void ut_mediatransferinterface::testProgress()



#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
void ut_mediatransferinterface::testStatus_data()
{
QTest::addColumn<MediaTransferInterface::TransferStatus>("status");
@@ -176,3 +177,4 @@ void ut_mediatransferinterface::testStatus()


Q_DECLARE_METATYPE(MediaTransferInterface::TransferStatus)
#endif
@@ -59,8 +59,10 @@ private slots:
void cleanup();
void testSetMediaItem();
void testProgress();
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
void testStatus_data();
void testStatus();
#endif

private:
TestInterface *tf;

0 comments on commit 3fb3c88

Please sign in to comment.