From a8acb400ceefbaf1c3950c323c285937548bcbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20THIERRY?= Date: Thu, 20 Feb 2014 17:03:47 +0100 Subject: Build in a pure Wayland environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that this change only allow the package to build in a pure wayland environment but doesn't make it functionnal since some X11 -> Wayland equivalents doesn't exist yet. The changes that remain to be made in order to get it working in a pure Wayland environment are marked by the comment "TO DO WAYLAND". Bug report regarding this issue: PTREL-724. Change-Id: I69194192d39605e9858141af7f1e74c4206f32c5 Signed-off-by: Kévin THIERRY Signed-off-by: Ronan Le Martret --- client/CMakeLists.txt | 10 +- client/net_nfc_client_system_handler.c | 2 - client/net_nfc_client_util.c | 11 +- daemon/CMakeLists.txt | 11 +- daemon/net_nfc_server_util.c | 12 +- packaging/nfc-manager-neard.spec | 246 ++++++++++++++++----------------- src/clientlib/net_nfc_app_util.c | 12 +- src/commonlib/net_nfc_util.c | 2 + src/manager/CMakeLists.txt | 32 ++++- 9 files changed, 205 insertions(+), 133 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 893711c..f400a0b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -8,8 +8,14 @@ SET(NFC_CLIENT "nfc") AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} CLIENT_SRCS) -pkg_check_modules(client_pkgs REQUIRED security-server dlog ecore-x vconf libtzplatform-config neardal - libssl ecore-x appsvc svi capi-media-wav-player) +IF(X11_SUPPORT) + SET(WIN_PKG "ecore-x") +ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + SET(WIN_PKG "${WIN_PKG} ecore-wayland") +ENDIF(WAYLAND_SUPPORT) + +pkg_check_modules(client_pkgs REQUIRED security-server dlog vconf libtzplatform-config neardal libssl appsvc svi capi-media-wav-player ${WIN_PKG}) FOREACH(flag ${client_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/client/net_nfc_client_system_handler.c b/client/net_nfc_client_system_handler.c index 274fc3e..ecd2c55 100644 --- a/client/net_nfc_client_system_handler.c +++ b/client/net_nfc_client_system_handler.c @@ -14,8 +14,6 @@ * limitations under the License. */ -#include "Ecore_X.h" - #include "net_nfc_typedef_internal.h" #include "net_nfc_debug_internal.h" #include "net_nfc_util_ndef_message.h" diff --git a/client/net_nfc_client_util.c b/client/net_nfc_client_util.c index e98a2f7..2b2edf6 100755 --- a/client/net_nfc_client_util.c +++ b/client/net_nfc_client_util.c @@ -35,7 +35,13 @@ #include #include #include +#ifdef USE_X11 #include +#endif +#ifdef USE_WAYLAND +#include +#include +#endif #include "net_nfc_typedef.h" #include "net_nfc_typedef_internal.h" @@ -938,6 +944,7 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t pid_t net_nfc_app_util_get_focus_app_pid() { +#ifdef USE_X11 pid_t pid; Ecore_X_Window focus; @@ -946,7 +953,9 @@ pid_t net_nfc_app_util_get_focus_app_pid() focus = ecore_x_window_focus_get(); if (ecore_x_netwm_pid_get(focus, &pid)) return pid; - +#endif +#ifdef USE_WAYLAND // TO DO WAYLAND +#endif return -1; } diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index d1f34d9..218276e 100755 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -6,15 +6,22 @@ SET(NFC_DAEMON "nfc-manager-daemon") FILE(GLOB DAEMON_SRCS *.c) +IF(X11_SUPPORT) + SET(WIN_PKG "ecore-x") +ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + SET(WIN_PKG "${WIN_PKG} ecore-wayland") +ENDIF(WAYLAND_SUPPORT) + IF(ARM_TARGET) pkg_check_modules(daemon_pkgs REQUIRED aul glib-2.0 gio-unix-2.0 security-server vconf dlog tapi appsvc libcurl bluetooth-api libssl svi capi-media-wav-player - pkgmgr pkgmgr-info capi-network-wifi ecore-x pmapi wifi-direct + pkgmgr pkgmgr-info capi-network-wifi ${WIN_PKG} pmapi wifi-direct libtzplatform-config neardal) ELSE(ARM_TARGET) pkg_check_modules(daemon_pkgs REQUIRED aul glib-2.0 gio-unix-2.0 security-server vconf dlog tapi appsvc libcurl bluetooth-api libssl svi capi-media-wav-player - pkgmgr pkgmgr-info capi-network-wifi ecore-x pmapi libtzplatform-config neardal) + pkgmgr pkgmgr-info capi-network-wifi ${WIN_PKG} pmapi libtzplatform-config neardal) ENDIF(ARM_TARGET) FOREACH(flag ${daemon_pkgs_CFLAGS}) diff --git a/daemon/net_nfc_server_util.c b/daemon/net_nfc_server_util.c index 107cd74..fed0d8c 100755 --- a/daemon/net_nfc_server_util.c +++ b/daemon/net_nfc_server_util.c @@ -29,13 +29,19 @@ #include #include #include +#ifdef USE_X11 +#include +#endif +#ifdef USE_WAYLAND +#include +#include +#endif #include #include #include #include #include -#include #include "net_nfc_typedef.h" #include "net_nfc_typedef_internal.h" @@ -939,6 +945,7 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t pid_t net_nfc_app_util_get_focus_app_pid() { +#ifdef USE_X11 pid_t pid; Ecore_X_Window focus; @@ -947,6 +954,9 @@ pid_t net_nfc_app_util_get_focus_app_pid() focus = ecore_x_window_focus_get(); if (ecore_x_netwm_pid_get(focus, &pid)) return pid; +#endif +#ifdef USE_WAYLAND // TO DO WAYLAND +#endif return -1; } diff --git a/packaging/nfc-manager-neard.spec b/packaging/nfc-manager-neard.spec index d3436e4..bb29c59 100644 --- a/packaging/nfc-manager-neard.spec +++ b/packaging/nfc-manager-neard.spec @@ -1,180 +1,180 @@ +%bcond_with wayland +%bcond_with x + Name: nfc-manager-neard Summary: NFC framework manager -Version: 0.0.45 +Version: 0.1.6 Release: 0 Group: Network & Connectivity/NFC License: Flora -URL: https://review.tizen.org/git/platform/core/connectivity/nfc-manager-neard.git Source0: %{name}-%{version}.tar.gz -Source1: nfc-manager.service +Source1: %{name}.service +Source1001: %{name}.manifest Requires: neard Requires: neardal -BuildRequires: pkgconfig(aul) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(gobject-2.0) -BuildRequires: pkgconfig(security-server) -BuildRequires: pkgconfig(dbus-glib-1) -BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(tapi) -BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(bluetooth-api) -BuildRequires: pkgconfig(mm-sound) -BuildRequires: pkgconfig(appsvc) -BuildRequires: pkgconfig(heynoti) -BuildRequires: pkgconfig(svi) -BuildRequires: pkgconfig(capi-media-wav-player) -BuildRequires: pkgconfig(smartcard-service) -BuildRequires: pkgconfig(smartcard-service-common) -BuildRequires: pkgconfig(libssl) -BuildRequires: pkgconfig(pmapi) -BuildRequires: pkgconfig(pkgmgr) -BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: cmake +BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gobject-2.0) +BuildRequires: pkgconfig(security-server) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(tapi) +BuildRequires: pkgconfig(bluetooth-api) +BuildRequires: pkgconfig(capi-network-wifi) +BuildRequires: pkgconfig(mm-sound) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(svi) +BuildRequires: pkgconfig(capi-media-wav-player) +BuildRequires: pkgconfig(libssl) +BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(pkgmgr) +BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: pkgconfig(pmapi) +BuildRequires: pkgconfig(libtzplatform-config) +%if %{with x} BuildRequires: pkgconfig(ecore-x) -BuildRequires: pkgconfig(capi-appfw-app-manager) -BuildRequires: pkgconfig(neardal) -BuildRequires: pkgconfig(libtzplatform-config) -BuildRequires: cmake -BuildRequires: gettext-tools +%endif +%if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) +%endif +BuildRequires: pkgconfig(capi-network-wifi) +BuildRequires: pkgconfig(neardal) +BuildRequires: python +BuildRequires: python-xml +BuildRequires: gettext-tools +%ifarch %arm +BuildRequires: pkgconfig(wifi-direct) +%global ARM_DEF "-DARM_TARGET=Y" +%endif + Requires(post): /sbin/ldconfig Requires(post): /usr/bin/vconftool -requires(postun): /sbin/ldconfig - +Requires(postun): /sbin/ldconfig +Requires: nfc-client-lib-neard = %{version} %description -NFC library Manager. - - -%prep -%setup -q - - -%package devel -Summary: Download agent -Group: Development/Building -Requires: %{name} = %{version}-%{release} - - -%description devel -NFC library Manager (devel) +Tizen NFC framework manager. +%package -n nfc-common-neard-devel +Summary: NFC common library (devel) +Group: Network & Connectivity/Development -%package -n nfc-common-lib-neard -Summary: NFC common library -Requires: %{name} = %{version}-%{release} +%description -n nfc-common-neard-devel +NFC manager common header for internal development. +%package -n nfc-client-lib-neard +Summary: NFC client library +Group: Network & Connectivity/NFC -%description -n nfc-common-lib-neard -NFC Common library. +%description -n nfc-client-lib-neard +NFC manager Client library for NFC client applications. +%package -n nfc-client-lib-neard-devel +Summary: NFC client library (devel) +Group: Network & Connectivity/Development +Requires: nfc-client-lib = %{version} -%package -n nfc-common-lib-neard-devel -Summary: NFC common library (devel) -Group: Development/Building -Requires: %{name} = %{version}-%{release} +%description -n nfc-client-lib-neard-devel +NFC manager Client library for developing NFC client applications. +#%%package -n nfc-client-test +#Summary: NFC client test +#Group: Network & Connectivity/NFC +#Requires: %%{name} = %%{version} -%description -n nfc-common-lib-neard-devel -NFC common library (devel) +#%%description -n nfc-client-test +#NFC client test (devel) +%prep +%setup -q +cp %{SOURCE1001} . %build -export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--as-needed" -mkdir cmake_tmp -cd cmake_tmp -LDFLAGS="$LDFLAGS" %cmake .. +MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` +%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} %{?ARM_DEF} \ +%if %{with wayland} + -DWAYLAND_SUPPORT=On \ +%else + -DWAYLAND_SUPPORT=Off \ +%endif +%if %{with x} + -DX11_SUPPORT=On +%else + -DX11_SUPPORT=Off +%endif make - %install -cd cmake_tmp %make_install -cd .. -mkdir -p %{buildroot}/usr/share/license -cp -af LICENSE.Flora %{buildroot}/usr/share/license/nfc-common-lib -cp -af LICENSE.Flora %{buildroot}/usr/share/license/nfc-manager - -mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants -cp -af %{SOURCE1} %{buildroot}/usr/lib/systemd/system/ -ln -s ../nfc-manager.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/nfc-manager.service +mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +cp -af %{SOURCE1} %{buildroot}%{_unitdir}/ +ln -s ../%{name}.service %{buildroot}%{_unitdir}/multi-user.target.wants/%{name}.service %post /sbin/ldconfig -GID=$(getent group %{TZ_SYS_USER_GROUP} | cut -d: -f3) -vconftool set -t bool db/nfc/feature 1 -g $GID -f -vconftool set -t bool db/nfc/enable 0 -g $GID -f -vconftool set -t bool db/nfc/sbeam 0 -g $GID -f -vconftool set -t int db/nfc/se_type 0 -g $GID -f -vconftool set -t bool db/nfc/predefined_item_state 0 -g $GID -f -vconftool set -t string db/nfc/predefined_item "None" -g $GID -f - -ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc3.d/S81libnfc-manager-0 -f -ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc5.d/S81libnfc-manager-0 -f - -mkdir -p %{TZ_SYS_ETC}/nfc_debug -chown :$GID %{TZ_SYS_ETC}/nfc_debug -chmod 775 %{TZ_SYS_ETC}/nfc_debug systemctl daemon-reload if [ $1 == 1 ]; then - systemctl restart nfc-manager.service + systemctl restart %{name}.service fi +%post -n nfc-client-lib-neard +/sbin/ldconfig +USER_GROUP_ID=$(getent group %{TZ_SYS_USER_GROUP} | cut -d: -f3) +vconftool set -t bool db/nfc/feature 0 -g $USER_GROUP_ID -f +vconftool set -t bool db/nfc/predefined_item_state 0 -g $USER_GROUP_ID -f +vconftool set -t string db/nfc/predefined_item "None" -g $USER_GROUP_ID -f +vconftool set -t bool db/nfc/enable 0 -g $USER_GROUP_ID -f +vconftool set -t int db/nfc/se_type 0 -g $USER_GROUP_ID -f %postun /sbin/ldconfig -mkdir -p /etc/rc.d/rc3.d -mkdir -p /etc/rc.d/rc5.d -rm -f /etc/rc.d/rc3.d/S81libnfc-manager-0 -rm -f /etc/rc.d/rc5.d/S81libnfc-manager-0 - if [ $1 == 0 ]; then - systemctl stop nfc-manager.service + systemctl stop %{name}.service fi systemctl daemon-reload -%post -n nfc-common-lib-neard -p /sbin/ldconfig - - -%postun -n nfc-common-lib-neard -p /sbin/ldconfig +%postun -n nfc-client-lib-neard -p /sbin/ldconfig %files -%manifest nfc-manager.manifest +%manifest %{name}.manifest %defattr(-,root,root,-) -%{_libdir}/libnfc.so.1 -%{_libdir}/libnfc.so.1.0.0 -%{_prefix}/bin/nfc-manager-daemon -%{_prefix}/bin/ndef-tool -%{_datadir}/dbus-1/services/org.tizen.nfc_service.service -/usr/share/license/nfc-manager -/usr/lib/systemd/system/nfc-manager.service -/usr/lib/systemd/system/multi-user.target.wants/nfc-manager.service - - -%files devel -%manifest nfc-manager-devel.manifest +%{_bindir}/nfc-manager-daemon +#%%{_bindir}/ndef-tool +%{_unitdir}/%{name}.service +%{_unitdir}/multi-user.target.wants/%{name}.service +%{_datadir}/dbus-1/system-services/org.tizen.NetNfcService.service +%{_datadir}/packages/nfc-manager.xml +%{_datadir}/nfc-manager-daemon/sounds/* +%license LICENSE.Flora + + +%files -n nfc-client-lib-neard +%manifest %{name}.manifest %defattr(-,root,root,-) -%{_libdir}/pkgconfig/nfc.pc -%{_includedir}/nfc/*.h -%{_libdir}/libnfc.so +%{_libdir}/libnfc.so.* +%license LICENSE.Flora -%files -n nfc-common-lib-neard -%manifest nfc-common-lib.manifest +%files -n nfc-client-lib-neard-devel %defattr(-,root,root,-) -%{_libdir}/libnfc-common-lib.so.1 -%{_libdir}/libnfc-common-lib.so.1.0.0 -/usr/share/license/nfc-common-lib -/usr/share/nfc-manager-daemon/sounds/* +%{_libdir}/libnfc.so +%{_libdir}/pkgconfig/nfc.pc +%{_includedir}/nfc/*.h -%files -n nfc-common-lib-neard-devel -%manifest nfc-common-lib-devel.manifest +%files -n nfc-common-neard-devel %defattr(-,root,root,-) -%{_libdir}/libnfc-common-lib.so -%{_libdir}/pkgconfig/nfc-common-lib.pc -%{_includedir}/nfc-common-lib/*.h +%{_libdir}/pkgconfig/nfc-common.pc +%{_includedir}/nfc-common/*.h + +#%%files -n nfc-client-test +#%%manifest nfc-client-test.manifest +#%%defattr(-,root,root,-) +#%%{_bindir}/nfc_client +#%%license LICENSE.Flora \ No newline at end of file diff --git a/src/clientlib/net_nfc_app_util.c b/src/clientlib/net_nfc_app_util.c index 56474b1..245cffa 100644 --- a/src/clientlib/net_nfc_app_util.c +++ b/src/clientlib/net_nfc_app_util.c @@ -29,11 +29,17 @@ #include #include #include +#ifdef USE_X11 +#include +#endif +#ifdef USE_WAYLAND +#include +#include +#endif #include "appsvc.h" #include "aul.h" #include "vconf.h" -#include "Ecore_X.h" #include "net_nfc_typedef.h" #include "net_nfc_typedef_private.h" @@ -911,6 +917,7 @@ int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t static pid_t _net_nfc_app_util_get_focus_app_pid() { +#ifdef USE_X11 Ecore_X_Window focus; pid_t pid; @@ -919,6 +926,9 @@ static pid_t _net_nfc_app_util_get_focus_app_pid() focus = ecore_x_window_focus_get(); if (ecore_x_netwm_pid_get(focus, &pid)) return pid; +#endif +#ifdef USE_WAYLAND // TO DO WAYLAND +#endif return -1; } diff --git a/src/commonlib/net_nfc_util.c b/src/commonlib/net_nfc_util.c index 86c0ccd..f6bc7d4 100644 --- a/src/commonlib/net_nfc_util.c +++ b/src/commonlib/net_nfc_util.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include // platform header #include diff --git a/src/manager/CMakeLists.txt b/src/manager/CMakeLists.txt index 58dea7e..292e322 100644 --- a/src/manager/CMakeLists.txt +++ b/src/manager/CMakeLists.txt @@ -13,8 +13,38 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE "Release") ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") +IF(X11_SUPPORT) + SET(WIN_PKG "ecore-x") +ENDIF(X11_SUPPORT) +IF(WAYLAND_SUPPORT) + SET(WIN_PKG "${WIN_PKG} ecore-wayland") +ENDIF(WAYLAND_SUPPORT) + INCLUDE(FindPkgConfig) -pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gobject-2.0 security-server dbus-glib-1 vconf dlog tapi appsvc libcurl bluetooth-api heynoti smartcard-service smartcard-service-common libssl pmapi svi capi-media-wav-player pkgmgr pkgmgr-info ecore-x neardal libtzplatform-config) +pkg_check_modules(manager_pkges REQUIRED aul + glib-2.0 + gobject-2.0 + security-server + dbus-glib-1 + vconf + dlog + tapi + appsvc + libcurl + bluetooth-api + heynoti + smartcard-service + smartcard-service-common + libssl + pmapi + svi + capi-media-wav-player + pkgmgr + pkgmgr-info + ${WIN_PKG} + neardal + libtzplatform-config) + FOREACH(flag ${manager_pkges_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -- cgit v1.2.3