TIVI-1436: Add build config option for graphics backend 15/9015/1 accepted/tizen/ivi/genivi accepted/tizen/ivi/release tizen_ivi_genivi accepted/tizen/20130912.153617 accepted/tizen/20130912.185910 accepted/tizen/20130912.194048 accepted/tizen/ivi/genivi/20140131.060031 accepted/tizen_ivi_release/20131120.050448 ivi_oct_m2 submit/tizen/20130912.080405 submit/tizen/20130912.090704 submit/tizen_ivi_genivi/20140131.060238 submit/tizen_ivi_release/20131120.023516 submit/tizen_ivi_release/20131120.025953
authorRusty Lynch <rusty.lynch@intel.com>
Fri, 30 Aug 2013 16:12:14 +0000 (09:12 -0700)
committerRusty Lynch <rusty.lynch@intel.com>
Fri, 30 Aug 2013 19:45:25 +0000 (12:45 -0700)
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
org.tizen.slp.pkgmgr.conf.in [new file with mode: 0644]
org.tizen.slp.pkgmgr.service.in
packaging/pkgmgr.spec
server/src/pkgmgr-server.c

index 751a382..d139429 100644 (file)
@@ -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 (file)
index 0000000..6ed2afa
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+        <policy user="root">
+                <allow own="org.tizen.slp.pkgmgr"/>
+                <allow own="org.tizen.slp.pkgmgr_status"/>
+                <allow receive_sender="org.tizen.slp.pkgmgr"/>
+                <allow send_destination="org.tizen.slp.pkgmgr"/>
+        </policy>
+        <policy context="default">
+                <allow receive_sender="org.tizen.slp.pkgmgr"/>
+                <allow send_destination="org.tizen.slp.pkgmgr"/>
+        </policy>
+</busconfig>
index 638a6f6..31d9e2d 100644 (file)
@@ -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
index a5bb505..a4c64a0 100644 (file)
@@ -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
 
index 02fdeca..dc40007 100755 (executable)
@@ -34,7 +34,9 @@
 #include <signal.h>
 #include <Elementary.h>
 #include <appcore-efl.h>
+#ifdef HAVE_X11
 #include <Ecore_X.h>
+#endif
 #include <Ecore_File.h>
 #include <ail.h>
 #include <pkgmgr-info.h>
@@ -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");