Build in a pure Wayland environment 80/16680/3
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Wed, 2 Apr 2014 08:49:39 +0000 (10:49 +0200)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Tue, 8 Apr 2014 07:29:04 +0000 (09:29 +0200)
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 <kevin.thierry@open.eurogiciel.org>
client/CMakeLists.txt
client/net_nfc_client_system_handler.c
client/net_nfc_client_util.c
daemon/CMakeLists.txt
daemon/net_nfc_server_util.c
packaging/nfc-manager-neard.spec
src/manager/CMakeLists.txt

index 893711c..dd5b708 100644 (file)
@@ -8,8 +8,23 @@ 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)
+INCLUDE(FindPkgConfig)
+pkg_check_modules(client_pkgs REQUIRED security-server dlog vconf libtzplatform-config neardal
+                       libssl appsvc svi capi-media-wav-player ${WIN_PKG})
+
+IF(WAYLAND_SUPPORT)
+       ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+
+IF(X11_SUPPORT)
+       ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
 
 FOREACH(flag ${client_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 274fc3e..b80f35a 100644 (file)
  * limitations under the License.
  */
 
-#include "Ecore_X.h"
+#ifdef USE_X11
+#include <Ecore_X.h>
+#endif
+#ifdef USE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
 
 #include "net_nfc_typedef_internal.h"
 #include "net_nfc_debug_internal.h"
index e98a2f7..24bd770 100755 (executable)
 #include <wav_player.h>
 #include <appsvc.h>
 #include <aul.h>
+
+#ifdef USE_X11
 #include <Ecore_X.h>
+#endif
+#ifdef USE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
 
 #include "net_nfc_typedef.h"
 #include "net_nfc_typedef_internal.h"
@@ -939,6 +946,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()
 {
        pid_t pid;
+#ifdef USE_X11
        Ecore_X_Window focus;
 
        ecore_x_init(":0");
@@ -946,7 +954,10 @@ 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
+       NFC_DBG("To implement: Wayland support");
+#endif
        return -1;
 }
 
index d1f34d9..47477eb 100755 (executable)
@@ -6,17 +6,33 @@ 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)
+INCLUDE(FindPkgConfig)
 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
-               libtzplatform-config neardal)
+               pkgmgr pkgmgr-info capi-network-wifi pmapi wifi-direct
+               libtzplatform-config neardal ${WIN_PKG})
 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 pmapi libtzplatform-config neardal
+               ${WIN_PKG})
 ENDIF(ARM_TARGET)
 
+IF(WAYLAND_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+
+IF(X11_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
+
 FOREACH(flag ${daemon_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index 107cd74..7e26bf2 100755 (executable)
 #include <wav_player.h>
 #include <appsvc.h>
 #include <aul.h>
+
+#ifdef USE_X11
 #include <Ecore_X.h>
+#endif
+#ifdef USE_WAYLAND
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#endif
+
 
 #include "net_nfc_typedef.h"
 #include "net_nfc_typedef_internal.h"
@@ -940,6 +948,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()
 {
        pid_t pid;
+#ifdef USE_X11
        Ecore_X_Window focus;
 
        ecore_x_init(":0");
@@ -947,7 +956,10 @@ 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
+       NFC_DBG("To implement: Wayland support");
+#endif
        return -1;
 }
 
index 077f234..4f58804 100755 (executable)
@@ -1,3 +1,6 @@
+%bcond_with wayland    1
+%bcond_with x
+
 Name:       nfc-manager-neard
 Summary:    NFC framework manager
 Version:    0.1.6
@@ -27,7 +30,12 @@ BuildRequires:  pkgconfig(libssl)
 BuildRequires:  pkgconfig(libcurl)
 BuildRequires:  pkgconfig(pkgmgr)
 BuildRequires:  pkgconfig(pkgmgr-info)
-BuildRequires:  pkgconfig(ecore-x)
+%if %{with x}
+BuildRequires: pkgconfig(ecore-x)
+%endif
+%if %{with wayland}
+BuildRequires: pkgconfig(ecore-wayland)
+%endif
 BuildRequires:  pkgconfig(pmapi)
 BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(neardal)
@@ -95,7 +103,17 @@ NFC manager Client library for developing NFC client applications.
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version} %{?ARM_DEF}
+%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
 
 
 %install
index 0572308..806c3e9 100644 (file)
@@ -13,8 +13,22 @@ 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)
+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})
+
+IF(WAYLAND_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_WAYLAND")
+ENDIF(WAYLAND_SUPPORT)
+
+IF(X11_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
 
 FOREACH(flag ${manager_pkges_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")