Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mce] Use dbus_gmain instead of dbus-glib. JB#51115
Also remove dependency on dbus-glib.

Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
  • Loading branch information
Thaodan committed Sep 14, 2020
1 parent e29d2a2 commit 70ef6b1
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .depend
Expand Up @@ -178,6 +178,7 @@ mce-dbus.o:\
mce-dbus.c\
builtin-gconf.h\
datapipe.h\
dbus-gmain/dbus-gmain.h\
mce-dbus.h\
mce-lib.h\
mce-log.h\
Expand All @@ -189,6 +190,7 @@ mce-dbus.pic.o:\
mce-dbus.c\
builtin-gconf.h\
datapipe.h\
dbus-gmain/dbus-gmain.h\
mce-dbus.h\
mce-lib.h\
mce-log.h\
Expand Down Expand Up @@ -1347,11 +1349,13 @@ tklock.pic.o:\
tools/dummy_compositor.o:\
tools/dummy_compositor.c\
builtin-gconf.h\
dbus-gmain/dbus-gmain.h\
mce-dbus.h\

tools/dummy_compositor.pic.o:\
tools/dummy_compositor.c\
builtin-gconf.h\
dbus-gmain/dbus-gmain.h\
mce-dbus.h\

tools/evdev_trace.o:\
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "dbus-gmain"]
path = dbus-gmain
url = https://gitlab.freedesktop.org/dbus/dbus-glib.git
31 changes: 25 additions & 6 deletions Makefile
Expand Up @@ -143,6 +143,7 @@ TOOLDIR := tools
TESTSDIR := tests
UTESTDIR := tests/ut
MODULE_DIR := modules
DBUS_GMAIN_DIR := dbus-gmain

# Binaries to build
TARGETS += mce
Expand Down Expand Up @@ -281,7 +282,6 @@ MCE_PKG_NAMES += glib-2.0
MCE_PKG_NAMES += gio-2.0
MCE_PKG_NAMES += gmodule-2.0
MCE_PKG_NAMES += dbus-1
MCE_PKG_NAMES += dbus-glib-1
MCE_PKG_NAMES += dsme
MCE_PKG_NAMES += libiphb
MCE_PKG_NAMES += libsystemd
Expand Down Expand Up @@ -332,6 +332,8 @@ ifeq ($(strip $(ENABLE_WAKELOCKS)),y)
MCE_CORE += libwakelock.c
endif

MCE_CORE += $(DBUS_GMAIN_DIR)/dbus-gmain.c

mce : CFLAGS += $(MCE_CFLAGS)
mce : LDLIBS += $(MCE_LDLIBS)
ifeq ($(ENABLE_HYBRIS),y)
Expand All @@ -342,6 +344,22 @@ mce : mce.o $(patsubst %.c,%.o,$(MCE_CORE))
CFLAGS += -g
LDFLAGS += -g

# ----------------------------------------------------------------------------
# DBUS_GMAIN
# ----------------------------------------------------------------------------

# The dbus-gmain submodule contains sources that have
# issues and do not compile cleanly. As the content is
# what it is, silence warnings etc when compiling source
# files from there...

DBUS_GMAIN_CPPFLAGS += -I.
DBUS_GMAIN_CFLAGS += -Wno-unused-parameter
DBUS_GMAIN_CFLAGS += -Wno-cast-function-type

$(DBUS_GMAIN_DIR)/%.o : CPPFLAGS += $(DBUS_GMAIN_CPPFLAGS)
$(DBUS_GMAIN_DIR)/%.o : CFLAGS += $(DBUS_GMAIN_CFLAGS)

# ----------------------------------------------------------------------------
# MODULES
# ----------------------------------------------------------------------------
Expand All @@ -350,7 +368,6 @@ MODULE_PKG_NAMES += gobject-2.0
MODULE_PKG_NAMES += glib-2.0
MODULE_PKG_NAMES += gmodule-2.0
MODULE_PKG_NAMES += dbus-1
MODULE_PKG_NAMES += dbus-glib-1
MODULE_PKG_NAMES += usb_moded
MODULE_PKG_NAMES += libudev

Expand All @@ -377,7 +394,6 @@ $(MODULE_DIR)/%.so : $(MODULE_DIR)/%.pic.o
TOOLS_PKG_NAMES += gobject-2.0
TOOLS_PKG_NAMES += glib-2.0
TOOLS_PKG_NAMES += dbus-1
TOOLS_PKG_NAMES += dbus-glib-1

TOOLS_PKG_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(TOOLS_PKG_NAMES))
TOOLS_PKG_LDLIBS := $(shell $(PKG_CONFIG) --libs $(TOOLS_PKG_NAMES))
Expand All @@ -395,15 +411,14 @@ $(TOOLDIR)/evdev_trace : $(TOOLDIR)/evdev_trace.o evdev.o $(TOOLDIR)/fileusers.o

$(TOOLDIR)/dummy_compositor : CFLAGS += $(TOOLS_CFLAGS)
$(TOOLDIR)/dummy_compositor : LDLIBS += $(TOOLS_LDLIBS)
$(TOOLDIR)/dummy_compositor : $(TOOLDIR)/dummy_compositor.o
$(TOOLDIR)/dummy_compositor : $(TOOLDIR)/dummy_compositor.o $(DBUS_GMAIN_DIR)/dbus-gmain.o

# ----------------------------------------------------------------------------
# UNIT TESTS
# ----------------------------------------------------------------------------

UTESTS_PKG_NAMES += check
UTESTS_PKG_NAMES += dbus-1
UTESTS_PKG_NAMES += dbus-glib-1
UTESTS_PKG_NAMES += glib-2.0
UTESTS_PKG_NAMES += gthread-2.0

Expand All @@ -427,6 +442,7 @@ $(UTESTDIR)/ut_display : LINK_STUBS += mce_write_string_to_file
$(UTESTDIR)/ut_display : datapipe.o
$(UTESTDIR)/ut_display : mce-lib.o
$(UTESTDIR)/ut_display : modetransition.o
$(UTESTDIR)/ut_display : $(DBUS_GMAIN_DIR)/dbus-gmain.o

# ----------------------------------------------------------------------------
# ACTIONS FOR TOP LEVEL TARGETS
Expand Down Expand Up @@ -538,10 +554,13 @@ fixme::
# AUTOMATIC HEADER DEPENDENCIES
# ----------------------------------------------------------------------------

# All sources, except ones from gmain git submodule
DEPEND_SOURCES = $(filter-out $(DBUS_GMAIN_DIR)/%.c, $(wildcard *.c */*.c */*/*.c))

.PHONY: depend
depend::
@echo "Updating .depend"
$(CC) -MM $(CPPFLAGS) $(MCE_CFLAGS) *.c */*.c */*/*.c |\
$(CC) -MM $(CPPFLAGS) $(MCE_CFLAGS) $(DEPEND_SOURCES) \
./depend_filter.py > .depend

ifneq ($(MAKECMDGOALS),depend) # not while: make depend
Expand Down
1 change: 1 addition & 0 deletions dbus-gmain
Submodule dbus-gmain added at d42176
4 changes: 2 additions & 2 deletions mce-dbus.c
Expand Up @@ -42,7 +42,7 @@
#include <grp.h>
#include <pwd.h>

#include <dbus/dbus-glib-lowlevel.h>
#include "dbus-gmain/dbus-gmain.h"

#include <mce/dbus-names.h>
#include <dsme/thermalmanager_dbus_if.h>
Expand Down Expand Up @@ -5238,7 +5238,7 @@ gboolean mce_dbus_init(const gboolean systembus)
mce_log(LL_DEBUG, "Connecting D-Bus to the mainloop");

/* Connect D-Bus to the mainloop */
dbus_connection_setup_with_g_main(dbus_connection, NULL);
dbus_gmain_set_up_connection(dbus_connection, NULL);

mce_log(LL_DEBUG, "Acquiring D-Bus service");

Expand Down
1 change: 0 additions & 1 deletion rpm/mce.spec
Expand Up @@ -15,7 +15,6 @@ Requires(postun): systemd
Conflicts: mce-plugin-libhybris < 1.3.0
Conflicts: lipstick-qt5 < 0.24.7
BuildRequires: pkgconfig(dbus-1) >= 1.0.2
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(dsme) >= 0.65.0
BuildRequires: pkgconfig(thermalmanager_dbus_if)
BuildRequires: pkgconfig(libiphb)
Expand Down
2 changes: 1 addition & 1 deletion tests/ut/ut_display.c
@@ -1,5 +1,5 @@
#include <check.h>
#include <dbus/dbus-glib-lowlevel.h> /* dbus_connection_setup_with_g_main */
#include <dbus-gmain.h> /* dbus_gmain_set_up_connection */
#include <glib.h>
#include <linux/input.h>
#include <stdbool.h>
Expand Down
4 changes: 2 additions & 2 deletions tools/dummy_compositor.c
Expand Up @@ -32,7 +32,7 @@
#include <glib.h>

#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "../dbus-gmain/dbus-gmain.h"

/* ========================================================================= *
* Constants
Expand Down Expand Up @@ -622,7 +622,7 @@ dc_dbus_connect(void)

dbus_connection_set_exit_on_disconnect(dc_dbus_con, false);

dbus_connection_setup_with_g_main(dc_dbus_con, 0);
dbus_gmain_set_up_connection(dc_dbus_con, 0);

EXIT:
dbus_error_free(&err);
Expand Down

0 comments on commit 70ef6b1

Please sign in to comment.