diff options
author | Bernard Cafarelli <voyageur@gentoo.org> | 2012-07-06 13:00:15 +0000 |
---|---|---|
committer | Bernard Cafarelli <voyageur@gentoo.org> | 2012-07-06 13:00:15 +0000 |
commit | 0e4abd8ffb950770b19d23410327ee97f75033d3 (patch) | |
tree | dafedf16d6a3ce0ffeef65f2aa64c5b516f07905 /x11-misc/google-gadgets | |
parent | Link to upstream bug. (diff) | |
download | gentoo-2-0e4abd8ffb950770b19d23410327ee97f75033d3.tar.gz gentoo-2-0e4abd8ffb950770b19d23410327ee97f75033d3.tar.bz2 gentoo-2-0e4abd8ffb950770b19d23410327ee97f75033d3.zip |
Fix networkmanager detection, add support for 0.9, clean ebuild a bit. Fixes bug #425024
(Portage version: 2.2.0_alpha116/cvs/Linux x86_64)
Diffstat (limited to 'x11-misc/google-gadgets')
4 files changed, 247 insertions, 19 deletions
diff --git a/x11-misc/google-gadgets/ChangeLog b/x11-misc/google-gadgets/ChangeLog index bf512cc88955..a3b1c7d71404 100644 --- a/x11-misc/google-gadgets/ChangeLog +++ b/x11-misc/google-gadgets/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for x11-misc/google-gadgets # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-misc/google-gadgets/ChangeLog,v 1.47 2012/06/27 09:48:43 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-misc/google-gadgets/ChangeLog,v 1.48 2012/07/06 13:00:15 voyageur Exp $ + + 06 Jul 2012; Bernard Cafarelli <voyageur@gentoo.org> + google-gadgets-0.11.2.ebuild, + +files/google-gadgets-0.11.2-configure_ggl_nm.patch, + +files/google-gadgets-0.11.2-networkmanager-0.9.patch: + Fix networkmanager detection, add support for 0.9, clean ebuild a bit. Fixes + bug #425024 27 Jun 2012; Bernard Cafarelli <voyageur@gentoo.org> google-gadgets-0.11.2.ebuild, +files/google-gadgets-0.11.2-gcc-4.7.patch: diff --git a/x11-misc/google-gadgets/files/google-gadgets-0.11.2-configure_ggl_nm.patch b/x11-misc/google-gadgets/files/google-gadgets-0.11.2-configure_ggl_nm.patch new file mode 100644 index 000000000000..9f183e7d155a --- /dev/null +++ b/x11-misc/google-gadgets/files/google-gadgets-0.11.2-configure_ggl_nm.patch @@ -0,0 +1,28 @@ +--- configure.ac.orig 2012-07-06 14:19:29.834778487 +0200 ++++ configure.ac 2012-07-06 14:22:12.174921371 +0200 +@@ -433,7 +433,7 @@ + ########################################################### + GGL_MODULE_DIR=$libdir/$GGL_BASE_DIR/modules + GGL_INCLUDE_DIR=$includedir/$GGL_BASE_DIR +-GGL_SYSDEPS_INCLUDE_DIR=$libdir/$GGL_BASE_DIR/include ++GGL_SYSDEPS_INCLUDE_DIR=$GGL_INCLUDE_DIR + GGL_LIBEXEC_DIR=$libdir/$GGL_BASE_DIR + GGL_RESOURCE_DIR=$datadir/$GGL_BASE_DIR + +@@ -895,11 +895,15 @@ + + # Check NetworkManager + has_network_manager=no +-PKG_CHECK_MODULES(NETWORK_MANAGER, ++AC_ARG_WITH([networkmanager], AS_HELP_STRING([--without-networkmanager], [Build without networkmanager support (default: test)])) ++ ++AS_IF([test "x$with_networkmanager" != "xno"], [ ++ PKG_CHECK_MODULES(NETWORK_MANAGER, + [NetworkManager >= 0.7], [has_network_manager=yes], + [PKG_CHECK_MODULES(NETWORK_MANAGER, + [NetworkManager >= 0.6], [has_network_manager=old], + [has_network_manager=no])]) ++]) + + if test x$has_network_manager != xno; then + PREDEFINED_MACROS="$PREDEFINED_MACROS -DHAVE_NETWORK_MANAGER" diff --git a/x11-misc/google-gadgets/files/google-gadgets-0.11.2-networkmanager-0.9.patch b/x11-misc/google-gadgets/files/google-gadgets-0.11.2-networkmanager-0.9.patch new file mode 100644 index 000000000000..45b3a27a05f3 --- /dev/null +++ b/x11-misc/google-gadgets/files/google-gadgets-0.11.2-networkmanager-0.9.patch @@ -0,0 +1,204 @@ +Description: Update for NetworkManager 0.9 API changes + This patch updates the code for a few NM 0.9 API changes. + It builds, but I have not extensively tested the functionality. + NM 0.9 has added a few new connection and device states, and renumbered the + existing ones. + This means it's possible to keep compatibility with both old and new versions + of NM since the state numbers don't conflict. + The patch does this by removing some usage of defines from NetworkManager.h. + . + Furthermore, the device enums aren't going to get renumbered so I added them + to the code instead of using the defines. They've been the same since the + beginning. +Author: danielcbwilliams@gmail.com +Bug: http://code.google.com/p/google-gadgets-for-linux/issues/detail?id=377 + +diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc +--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc.nm09 2009-03-14 23:12:42.000000000 -0500 ++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.cc 2011-03-25 10:58:29.022771149 -0500 +@@ -23,19 +23,21 @@ namespace ggadget { + namespace framework { + namespace linux_system { + +-#ifdef NM_DEVICE_TYPE_WIFI +-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI; +-#else +-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS; +-#endif +- +-#ifdef NM_DEVICE_TYPE_ETHERNET +-static const int kDeviceTypeEthernet = NM_DEVICE_TYPE_ETHERNET; +-#else +-static const int kDeviceTypeEthernet = DEVICE_TYPE_802_3_ETHERNET; +-#endif +- + static const int kDeviceTypeUnknown = 0; ++static const int kDeviceTypeEthernet = 1; ++static const int kDeviceTypeWifi = 2; ++ ++// 0.6, 0.7, and 0.8 connected state ++static const int kOldConnected = 3; ++// New 0.9 connected states ++static const int kConnectedLocal = 50; ++static const int kConnectedSite = 60; ++static const int kConnectedGlobal = 70; ++ ++// 0.6, 0.7, and 0.8 activated device state ++static const int kOldDeviceStateActivated = 8; ++// New 0.9 activated device state ++static const int kDeviceStateActivated = 100; + + Network::Network() + : is_new_api_(false), +@@ -59,14 +61,14 @@ Network::Network() + is_new_api_ = true; + int state; + if (network_manager_->GetProperty("State").v().ConvertToInt(&state)) { +- is_online_ = (state == NM_STATE_CONNECTED); ++ is_online_ = IsOnlineState(state); + } + } else { + DLOG("network manager 0.6.x might be used."); + DBusIntReceiver result; + if (network_manager_->CallMethod("state", true, kDefaultDBusTimeout, + result.NewSlot(), MESSAGE_TYPE_INVALID)) { +- is_online_ = (result.GetValue() == NM_STATE_CONNECTED); ++ is_online_ = IsOnlineState(result.GetValue()); + } + } + +@@ -87,14 +89,21 @@ Network::~Network() { + delete network_manager_; + } + ++bool Network::IsOnlineState(int state) { ++ return (state == kOldConnected || ++ state == kConnectedLocal || ++ state == kConnectedSite || ++ state == kConnectedGlobal); ++} ++ + void Network::OnSignal(const std::string &name, int argc, const Variant *argv) { + DLOG("Got signal from network manager: %s", name.c_str()); + bool need_update = false; +- // nm 0.6.x uses "StateChange", 0.7.x uses "StateChanged". ++ // nm 0.6.x uses "StateChange", 0.7.x and later use "StateChanged". + if (name == "StateChange" || name == "StateChanged") { + int state; + if (argc >= 1 && argv[0].ConvertToInt(&state)) { +- is_online_ = (state == NM_STATE_CONNECTED); ++ is_online_ = IsOnlineState(state); + DLOG("Network is %s.", is_online_ ? "connected" : "disconnected"); + if (is_online_) { + need_update = true; +@@ -133,7 +142,8 @@ void Network::Update() { + if (is_new_api_) { + int state; + if (dev->GetProperty("State").v().ConvertToInt(&state)) +- active = (state == 8); // NM_DEVICE_STATE_ACTIVATED ++ active = (state == kOldDeviceStateActivated || ++ state == kDeviceStateActivated); + } else { + DBusBooleanReceiver result; + if (dev->CallMethod("getLinkActive", true, kDefaultDBusTimeout, +diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h +--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h.nm09 2011-03-25 10:51:31.120995640 -0500 ++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/network.h 2011-03-25 10:52:03.881586075 -0500 +@@ -55,6 +55,7 @@ class Network : public NetworkInterface + private: + void OnSignal(const std::string &name, int argc, const Variant *argv); + void Update(); ++ bool IsOnlineState(int state); + + private: + // true if using nm 0.7 or above, false if using nm 0.6.x +diff -up google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc +--- google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc.nm09 2011-03-25 10:53:42.462353647 -0500 ++++ google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/wireless.cc 2011-03-25 11:01:53.707212241 -0500 +@@ -28,11 +28,10 @@ + #include <ggadget/string_utils.h> + #include <ggadget/slot.h> + +-// defined in <linux/wireless.h>, but we don't want to introduce such +-// dependency. +-#define IW_MODE_AUTO 0 +-#define IW_MODE_ADHOC 1 +-#define IW_MODE_INFRA 2 ++// Define them anyway for all versions of NM ++static const int kNmWifiModeUnknown = 0; ++static const int kNmWifiModeAdhoc = 1; ++static const int kNmWifiModeInfra = 2; + + #if !defined(NM_DBUS_SERVICE) || !defined(NM_DBUS_PATH) || \ + !defined(NM_DBUS_INTERFACE) +@@ -77,15 +76,15 @@ namespace linux_system { + + using namespace ggadget::dbus; + +-#ifdef NM_DEVICE_TYPE_WIFI +-static const int kDeviceTypeWifi = NM_DEVICE_TYPE_WIFI; +-#else +-static const int kDeviceTypeWifi = DEVICE_TYPE_802_11_WIRELESS; +-#endif ++static const int kDeviceTypeWifi = 2; + + // Defined in nm 0.7 +-static const int kDeviceStateActivated = 8; +-static const int kDeviceStateFailed = 9; ++static const int kOldDeviceStateActivated = 8; ++static const int kOldDeviceStateFailed = 9; ++// New 0.9 activated device state ++static const int kDeviceStateActivated = 100; ++static const int kDeviceStateDeactivating = 110; ++static const int kDeviceStateFailed = 120; + + class Wireless::Impl { + class WirelessAccessPoint : public WirelessAccessPointInterface { +@@ -191,7 +190,7 @@ class Wireless::Impl { + + void UpdateInfo() { + if (ap_) { +- int mode = IW_MODE_AUTO; ++ int mode = kNmWifiModeUnknown; + if (new_api_) { // nm 0.7.x + ResultVariant prop = ap_->GetProperty("Ssid"); + if (prop.v().type() == Variant::TYPE_SCRIPTABLE) { +@@ -223,9 +222,9 @@ class Wireless::Impl { + } + } + +- if (mode == IW_MODE_ADHOC) ++ if (mode == kNmWifiModeAdhoc) + type_ = WIRELESS_TYPE_INDEPENDENT; +- else if (mode == IW_MODE_INFRA) ++ else if (mode == kNmWifiModeInfra) + type_ = WIRELESS_TYPE_INFRASTRUCTURE; + else + type_ = WIRELESS_TYPE_ANY; +@@ -404,9 +403,13 @@ class Wireless::Impl { + } else if (signal == "StateChanged") { // nm 0.7.x + int new_state; + if (argc >= 1 && argv[0].ConvertToInt(&new_state)) { +- connected_ = (new_state == kDeviceStateActivated); ++ connected_ = (new_state == kDeviceStateActivated || ++ new_state == kOldDeviceStateActivated); + connect_performed = (new_state == kDeviceStateActivated || +- new_state == kDeviceStateFailed); ++ new_state == kDeviceStateDeactivating || ++ new_state == kDeviceStateFailed || ++ new_state == kOldDeviceStateActivated || ++ new_state == kOldDeviceStateFailed); + } + } else if (signal == "AccessPointAdded") { // nm 0.7.x + std::string ap_path; +@@ -441,7 +444,9 @@ class Wireless::Impl { + if (new_api_ && dev_ && dev_wireless_) { + ResultVariant prop = dev_->GetProperty("State"); + if (prop.v().type() == Variant::TYPE_INT64) { +- connected_ = (VariantValue<int>()(prop.v()) == kDeviceStateActivated); ++ int state = VariantValue<int>()(prop.v()); ++ connected_ = (state == kDeviceStateActivated || ++ state == kOldDeviceStateActivated); + } + } else if (!new_api_ && dev_) { + DBusBooleanReceiver bool_receiver; diff --git a/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild b/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild index e9e39c538f70..c58b3ce6e1e8 100644 --- a/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild +++ b/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild,v 1.17 2012/06/27 09:48:43 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-misc/google-gadgets/google-gadgets-0.11.2.ebuild,v 1.18 2012/07/06 13:00:15 voyageur Exp $ EAPI=4 inherit autotools eutils fdo-mime multilib @@ -16,6 +16,7 @@ LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~alpha amd64 ~ia64 ppc ppc64 x86" IUSE="+dbus debug +gtk +qt4 +gstreamer networkmanager soup startup-notification webkit" +REQUIRED_USE="|| ( gtk qt4 )" # Weird things happen when we start mix-n-matching, so for the time being # I've just locked the deps to the versions I had as of Summer 2008. With any @@ -51,11 +52,9 @@ RDEPEND=" ) soup? ( >=net-libs/libsoup-2.26:2.4 ) startup-notification? ( x11-libs/startup-notification ) - webkit? ( >=net-libs/webkit-gtk-1.0.3:2 ) -" + webkit? ( >=net-libs/webkit-gtk-1.0.3:2 )" DEPEND="${RDEPEND} - virtual/pkgconfig -" + virtual/pkgconfig" S=${WORKDIR}/${MY_P} @@ -64,15 +63,6 @@ RESTRICT="test" DOCS="ChangeLog README" pkg_setup() { - # If a non-google, non-qt4 and non-gtk host system for google-gadgets is ever developed, - # I'll consider changing the error below. - if ! use gtk && ! use qt4; then - eerror "You must choose which toolkit to build for. Either qt4 or gtk can be" - eerror "chosen. For qt4, see also above. To enable \$toolkit, do:" - eerror "echo \"${CATEGORY}/${PN} \$toolkit\" >> /etc/portage/package.use" - die "You need to choose a toolkit" - fi - if ! use gstreamer; then ewarn "Disabling gstreamer disables the multimedia functions of ${PN}." ewarn "This is not recommended. To enable gstreamer, do:" @@ -81,12 +71,10 @@ pkg_setup() { } src_prepare() { + epatch "${FILESDIR}"/${P}-configure_ggl_nm.patch epatch "${FILESDIR}"/${P}-glib-2.31.patch epatch "${FILESDIR}"/${P}-gcc-4.7.patch - - sed -i -r \ - -e '/^GGL_SYSDEPS_INCLUDE_DIR/ c\GGL_SYSDEPS_INCLUDE_DIR=$GGL_INCLUDE_DIR' \ - configure.ac || die + epatch "${FILESDIR}"/${P}-networkmanager-0.9.patch # zlib-1.2.5.1-r1 renames the OF macro in zconf.h, bug 385477. has_version '>=sys-libs/zlib-1.2.5.1-r1' && sed -i -e \ @@ -108,6 +96,7 @@ src_configure() { $(use_enable dbus libggadget-dbus) \ $(use_enable gstreamer gst-audio-framework) \ $(use_enable gstreamer gst-video-element) \ + $(use_with networkmanager) \ $(use_enable soup soup-xml-http-request) \ $(use_enable webkit webkit-script-runtime) \ $(use_enable webkit gtkwebkit-browser-element) \ |