From 907c5af1e51595218adaf583409189857e68b6cc Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Fri, 30 Aug 2013 09:12:14 -0700 Subject: [PATCH] TIVI-1436: Add build config option for graphics backend The server implementation needs to display popup windows in the UI. This change will add a build time configuration option to build for either X or wayland, with the default support set for X. In addition to this, the dbus service files were being installed in the wrong location and we now need a dbus confg file in order to have permission to publish the service on the system bus. --- CMakeLists.txt | 13 +++++++++++-- org.tizen.slp.pkgmgr.conf.in | 16 ++++++++++++++++ org.tizen.slp.pkgmgr.service.in | 2 +- packaging/pkgmgr.spec | 13 +++++++++++-- server/src/pkgmgr-server.c | 20 +++++++++++++++++++- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 org.tizen.slp.pkgmgr.conf.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 751a382..d139429 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,14 @@ set(CMAKE_SKIP_BUILD_RPATH true) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/comm ) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file pkgmgr-info iniparser) + +OPTION(X11_SUPPORT "Enable X support" ON) +IF(X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") + pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file pkgmgr-info iniparser) +ELSE() + pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-wayland ail ecore-file pkgmgr-info iniparser) +ENDIF(X11_SUPPORT) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -86,6 +93,7 @@ SET_TARGET_PROPERTIES(pkgmgr-server PROPERTIES COMPILE_FLAGS "${pkgmgr-server_CF CONFIGURE_FILE(pkgmgr.pc.in pkgmgr.pc @ONLY) configure_file(org.tizen.slp.pkgmgr.service.in org.tizen.slp.pkgmgr.service @ONLY) +configure_file(org.tizen.slp.pkgmgr.conf.in org.tizen.slp.pkgmgr.conf @ONLY) configure_file(pkg_path.conf.in pkg_path.conf @ONLY) configure_file(pkgmgr.patch.sh.in pkgmgr.patch.sh @ONLY) @@ -95,7 +103,8 @@ INSTALL(FILES ${CMAKE_BINARY_DIR}/pkgmgr-server DESTINATION bin PERMISSIONS OWNE INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/package-manager.h DESTINATION include) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/pkgmgr-dbinfo.h DESTINATION include) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.service DESTINATION ${PREFIX}/share/dbus-1/services/) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.service DESTINATION ${PREFIX}/share/dbus-1/system-services/) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.conf DESTINATION ${SYSCONFDIR}/dbus-1/system.d/) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_path.conf DESTINATION ${SYSCONFDIR}/package-manager/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/queue_status DESTINATION ${SYSCONFDIR}/package-manager/server/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr.patch.sh DESTINATION ${SYSCONFDIR}/opt/upgrade/) diff --git a/org.tizen.slp.pkgmgr.conf.in b/org.tizen.slp.pkgmgr.conf.in new file mode 100644 index 0000000..6ed2afa --- /dev/null +++ b/org.tizen.slp.pkgmgr.conf.in @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.slp.pkgmgr.service.in b/org.tizen.slp.pkgmgr.service.in index 638a6f6..31d9e2d 100644 --- a/org.tizen.slp.pkgmgr.service.in +++ b/org.tizen.slp.pkgmgr.service.in @@ -1,4 +1,4 @@ [D-BUS Service] User=root Name=org.tizen.slp.pkgmgr -Exec=@PREFIX@/bin/env DISPLAY=:0 @PREFIX@/bin/pkgmgr-server +Exec=@PREFIX@/bin/pkgmgr-server diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index a5bb505..a4c64a0 100644 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -1,3 +1,5 @@ +%bcond_with wayland + Name: pkgmgr Summary: Packager Manager client library package Version: 0.2.89 @@ -83,7 +85,13 @@ Package Manager client types develpoment package for packaging cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} %{SOURCE1005} %{SOURCE1006} %{SOURCE1007} . %build -%cmake . +%cmake . \ +%if %{with wayland} + -DX11_SUPPORT=Off +%else + -DX11_SUPPORT=On +%endif + make %{?jobs:-j%jobs} %install @@ -156,7 +164,8 @@ update-mime-database /usr/share/mime %files server -f package-manager.lang %manifest %{name}-server.manifest %defattr(-,root,root,-) -%{_datadir}/dbus-1/services/org.tizen.slp.pkgmgr.service +%{_datadir}/dbus-1/system-services/org.tizen.slp.pkgmgr.service +%{_sysconfdir}/dbus-1/system.d/org.tizen.slp.pkgmgr.conf %{_bindir}/pkgmgr-server %{_sysconfdir}/package-manager/server diff --git a/server/src/pkgmgr-server.c b/server/src/pkgmgr-server.c index 02fdeca..dc40007 100755 --- a/server/src/pkgmgr-server.c +++ b/server/src/pkgmgr-server.c @@ -34,7 +34,9 @@ #include #include #include +#ifdef HAVE_X11 #include +#endif #include #include #include @@ -560,6 +562,7 @@ static char *__get_exe_path(const char *pkgid) } #endif +#ifdef HAVE_X11 static int __X_rotate_disable_focus(Display *dpy, Window win) { XWMHints *hints; @@ -680,6 +683,7 @@ static Eina_Bool __X_rotate_cb(void *data, int type, void *event) return ECORE_CALLBACK_RENEW; } +#endif // HAVE_X11 static int create_popup(struct appdata *ad) @@ -711,10 +715,13 @@ int create_popup(struct appdata *ad) int y; unsigned char *prop_data = NULL; int count; + int ret; + +#ifdef HAVE_X11 ecore_x_window_geometry_get(ecore_x_window_root_get( ecore_x_window_focus_get()), &x, &y, &w, &h); - int ret = + ret = ecore_x_window_prop_property_get(ecore_x_window_root_get (ecore_x_window_focus_get()), ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE, @@ -733,6 +740,7 @@ int create_popup(struct appdata *ad) ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __X_rotate_cb, ad->win); +#endif // HAVE_X11 double s; s = w / DESKTOP_W; @@ -2079,6 +2087,16 @@ int main(int argc, char *argv[]) backend_info *ptr = NULL; int r; +#ifdef HAVE_X11 + // If DISPLAY is not set then let it default to :0 + // so we can remove hacks in the service file + // to set the env variable (which will blow up wayland) + // + // Passing overwrite as zero so it will not clobber an + // existing value + setenv("DISPLAY", ":0", 0); +#endif + ecore_init(); DBG("server start"); -- 2.7.4