Control: retitle -1 Switch from network-manager-dev to libnm-dev

Hi Ari

Am 11.03.2018 um 22:16 schrieb Ari Pollak:
> On Sun, Mar 11, 2018 at 5:15 PM Ari Pollak <a...@debian.org
> <mailto:a...@debian.org>> wrote:
> 
>     On Sun, Mar 11, 2018 at 5:00 PM Michael Biebl <bi...@debian.org
>     <mailto:bi...@debian.org>> wrote:
> 
>         By that I mean: If you don't have a runtime requirement, do you
>         only use
>         the D-Bus API? If so, why is network-manager-dev required as build
>         dependency at all?
> 
> 
>     Right, it's just using the D-Bus API during runtime, but still uses
>     the headers during compilation for state constants.
> 
> 
> Oops, meant to include a link too:
> https://anonscm.debian.org/cgit/collab-maint/pidgin.git/tree/libpurple/network.c

Thanks for the additional information. Seems I mistitled the bug report,
so fixing that. As I didn't see a runtime dependency on either
libnm-glib or libnm-util, I wrongly concluded, that network-manager-dev
was a left-over build depdendency.

So, back to the issue:

The successor of libnm-glib/libnm-util is libnm.

If you are only interested in NM state constants, you should be able to
simply use NetworkManager.h which is also provided by libnm-dev.
While the APIs of libnm and libnm-glib/libnm-util are not completely the
same, I think in your case it might be sufficiently compatible:

> michael@pluto:~$ grep NM_STATE /usr/include/libnm/*
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_UNKNOWN: Networking state 
> is unknown. This indicates a daemon error
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_ASLEEP: Networking is not 
> enabled, the system is being suspended or
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_DISCONNECTED: There is no 
> active network connection.
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_DISCONNECTING: Network 
> connections are being cleaned up.
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_CONNECTING: A network 
> connection is being started
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_CONNECTED_LOCAL: There is 
> only local IPv4 and/or IPv6 connectivity,
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_CONNECTED_SITE: There is 
> only site-wide IPv4 and/or IPv6 connectivity.
> /usr/include/libnm/nm-dbus-interface.h: * @NM_STATE_CONNECTED_GLOBAL: There 
> is global IPv4 and/or IPv6 Internet connectivity
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_UNKNOWN          = 0,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_ASLEEP           = 10,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_DISCONNECTED     = 20,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_DISCONNECTING    = 30,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_CONNECTING       = 40,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_CONNECTED_LOCAL  = 50,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_CONNECTED_SITE   = 60,
> /usr/include/libnm/nm-dbus-interface.h:       NM_STATE_CONNECTED_GLOBAL = 70,

nm-dbus-interface.h is included by /usr/include/libnm/NetworkManager.h

> michael@pluto:~$ grep NM_STATE /usr/include/NetworkManager/*
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_UNKNOWN: networking 
> state is unknown
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_ASLEEP: networking 
> is not enabled
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_DISCONNECTED: there 
> is no active network connection
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_DISCONNECTING: 
> network connections are being cleaned up
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_CONNECTING: a 
> network connection is being started
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_CONNECTED_LOCAL: 
> there is only local IPv4 and/or IPv6 connectivity
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_CONNECTED_SITE: 
> there is only site-wide IPv4 and/or IPv6 connectivity
> /usr/include/NetworkManager/NetworkManager.h: * @NM_STATE_CONNECTED_GLOBAL: 
> there is global IPv4 and/or IPv6 Internet connectivity
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_UNKNOWN          = 0,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_ASLEEP           = 10,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_DISCONNECTED     = 20,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_DISCONNECTING    = 30,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_CONNECTING       = 40,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_CONNECTED_LOCAL  = 50,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_CONNECTED_SITE   = 60,
> /usr/include/NetworkManager/NetworkManager.h: NM_STATE_CONNECTED_GLOBAL = 70,
> /usr/include/NetworkManager/NetworkManager.h:#define NM_STATE_CONNECTED 
> NM_STATE_CONNECTED_GLOBAL


The only tricky part in  libpurple/network.c is

> if (prev != NM_STATE_CONNECTED && prev != NM_STATE_UNKNOWN)

NM_STATE_CONNECTED is not defined, so you probably need to just use
NM_STATE_CONNECTED_GLOBAL there.
Then, it should be as simple as updating configure.ac like this

> --- pidgin-2.12.0.orig/configure.ac
> +++ pidgin-2.12.0/configure.ac
> @@ -1428,7 +1428,7 @@ fi
>  dnl Check for NetworkManager.h; if we don't have it, oh well
>  if test "x$enable_dbus" = "xyes" ; then
>       if test "x$enable_nm" = "xyes" ; then
> -             PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [
> +             PKG_CHECK_MODULES(NETWORKMANAGER, [libnm], [
>                       AC_SUBST(NETWORKMANAGER_CFLAGS)
>                       AC_SUBST(NETWORKMANAGER_LIBS)
>                       AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have 
> NetworkManager.])


And changing the Build-Depends from network-manager-dev to libnm-dev

Regards,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to