From 7ce924b1f5ab24a0f16293047c67d24c6376d375 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Sat, 11 Jan 2014 11:50:34 +0100
Subject: systemd is glibc specific, disable upower/polkit for uclibc/musl for
 now

---
 package/mozjs/Makefile                             |  1 +
 package/polkit/Makefile                            |  6 ++--
 package/polkit/patches/patch-configure_ac          | 11 ++++++-
 ...lkitbackend_polkitbackendinteractiveauthority_c | 31 ++++++++++++++++++
 ...ch-src_polkitbackend_polkitbackendjsauthority_c | 38 ++++++++++++++++++++++
 package/upower/Makefile                            |  2 ++
 6 files changed, 86 insertions(+), 3 deletions(-)
 create mode 100644 package/polkit/patches/patch-src_polkitbackend_polkitbackendinteractiveauthority_c
 create mode 100644 package/polkit/patches/patch-src_polkitbackend_polkitbackendjsauthority_c

diff --git a/package/mozjs/Makefile b/package/mozjs/Makefile
index e7c7a0034..3d08b64cf 100644
--- a/package/mozjs/Makefile
+++ b/package/mozjs/Makefile
@@ -22,6 +22,7 @@ include $(TOPDIR)/mk/package.mk
 $(eval $(call PKG_template,MOZJS,mozjs,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
 CONFIGURE_ENV+=		HOST_CC="${CC_FOR_BUILD}" HOST_CFLAGS="${CFLAGS_FOR_BUILD}"
+CONFIGURE_ENV+=		HOST_LDFLAGS="${LDFLAGS_FOR_BUILD}"
 CONFIGURE_ENV+=		HOST_CXXFLAGS="${CXXFLAGS_FOR_BUILD}" HOST_CXX="${CXX_FOR_BUILD}"
 CONFIGURE_ARGS+=	--disable-optimize \
 			--with-system-nspr
diff --git a/package/polkit/Makefile b/package/polkit/Makefile
index 3470d2737..0fbfcb439 100644
--- a/package/polkit/Makefile
+++ b/package/polkit/Makefile
@@ -6,15 +6,17 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=		polkit
 PKG_VERSION:=		0.112
 PKG_RELEASE:=		2
-PKG_MD5SUM:=		9fa7a28633b028681163466da898b008
+PKG_MD5SUM:=		23973dcfd8b92ab2b7db3a925642b76d
 PKG_DESCR:=		application-level toolkit
 PKG_SECTION:=		libs
 PKG_BUILDDEP:=		autotool mozjs
 PKG_DEPENDS:=		mozjs
 PKG_URL:=		http://www.freedesktop.org/wiki/Software/polkit/
-PKG_SITES:=		http://cgit.freedesktop.org/polkit/snapshot/
+PKG_SITES:=		http://openadk.org/distfiles/
 PKG_OPTS:=		dev
 
+PKG_LIBC_DEPENDS:=	eglibc glibc
+
 include $(TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,POLKIT,polkit,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
diff --git a/package/polkit/patches/patch-configure_ac b/package/polkit/patches/patch-configure_ac
index 3b258e7f4..65681615d 100644
--- a/package/polkit/patches/patch-configure_ac
+++ b/package/polkit/patches/patch-configure_ac
@@ -1,5 +1,5 @@
 --- polkit-0.112.orig/configure.ac	2013-09-18 18:55:09.000000000 +0200
-+++ polkit-0.112/configure.ac	2014-01-09 21:28:57.000000000 +0100
++++ polkit-0.112/configure.ac	2014-01-11 11:22:30.000000000 +0100
 @@ -8,9 +8,6 @@ AM_MAINTAINER_MODE
  
  m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -19,6 +19,15 @@
  #### gcc warning flags
  
  if test "x$GCC" = "xyes"; then
+@@ -158,7 +153,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXP
+ 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
+ AC_SUBST(EXPAT_LIBS)
+ 
+-AC_CHECK_FUNCS(clearenv)
++AC_CHECK_FUNCS(clearenv getnetgrent innetgr)
+ 
+ if test "x$GCC" = "xyes"; then
+   LDFLAGS="-Wl,--as-needed $LDFLAGS"
 @@ -476,8 +471,6 @@ case "$host_os" in
  	;;
  esac
diff --git a/package/polkit/patches/patch-src_polkitbackend_polkitbackendinteractiveauthority_c b/package/polkit/patches/patch-src_polkitbackend_polkitbackendinteractiveauthority_c
new file mode 100644
index 000000000..64608f5b5
--- /dev/null
+++ b/package/polkit/patches/patch-src_polkitbackend_polkitbackendinteractiveauthority_c
@@ -0,0 +1,31 @@
+--- polkit-0.112.orig/src/polkitbackend/polkitbackendinteractiveauthority.c	2013-09-18 18:55:09.000000000 +0200
++++ polkit-0.112/src/polkitbackend/polkitbackendinteractiveauthority.c	2014-01-11 11:22:30.000000000 +0100
+@@ -2103,6 +2103,7 @@ get_users_in_group (PolkitIdentity
+   return ret;
+ }
+ 
++#if defined(HAVE_GETNETGRENT)
+ static GList *
+ get_users_in_net_group (PolkitIdentity                    *group,
+                         gboolean                           include_root)
+@@ -2154,6 +2155,7 @@ get_users_in_net_group (PolkitIdentity
+   endnetgrent ();
+   return ret;
+ }
++#endif
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+@@ -2243,10 +2245,12 @@ authentication_agent_initiate_challenge
+         {
+           user_identities = g_list_concat (user_identities, get_users_in_group (identity, FALSE));
+         }
++#if defined(HAVE_GETNETGRENT)
+       else if (POLKIT_IS_UNIX_NETGROUP (identity))
+         {
+           user_identities =  g_list_concat (user_identities, get_users_in_net_group (identity, FALSE));
+         }
++#endif
+       else
+         {
+           g_warning ("Unsupported identity");
diff --git a/package/polkit/patches/patch-src_polkitbackend_polkitbackendjsauthority_c b/package/polkit/patches/patch-src_polkitbackend_polkitbackendjsauthority_c
new file mode 100644
index 000000000..14a702dda
--- /dev/null
+++ b/package/polkit/patches/patch-src_polkitbackend_polkitbackendjsauthority_c
@@ -0,0 +1,38 @@
+--- polkit-0.112.orig/src/polkitbackend/polkitbackendjsauthority.c	2013-09-18 18:55:09.000000000 +0200
++++ polkit-0.112/src/polkitbackend/polkitbackendjsauthority.c	2014-01-11 11:27:02.000000000 +0100
+@@ -29,6 +29,7 @@
+ #include <glib/gstdio.h>
+ #include <locale.h>
+ #include <glib/gi18n-lib.h>
++#include <sys/wait.h>
+ 
+ #include <polkit/polkit.h>
+ #include "polkitbackendjsauthority.h"
+@@ -1450,13 +1451,16 @@ js_polkit_user_is_in_netgroup (JSContext
+   JSBool ret = JS_FALSE;
+   JSString *user_str;
+   JSString *netgroup_str;
+-  char *user;
+-  char *netgroup;
+   JSBool is_in_netgroup = JS_FALSE;
+ 
+   if (!JS_ConvertArguments (cx, argc, JS_ARGV (cx, vp), "SS", &user_str, &netgroup_str))
+     goto out;
+ 
++#if defined(HAVE_INNETGR)
++  {
++  char *user;
++  char *netgroup;
++
+   user = JS_EncodeString (cx, user_str);
+   netgroup = JS_EncodeString (cx, netgroup_str);
+ 
+@@ -1470,6 +1474,8 @@ js_polkit_user_is_in_netgroup (JSContext
+ 
+   JS_free (cx, netgroup);
+   JS_free (cx, user);
++  }
++#endif
+ 
+   ret = JS_TRUE;
+ 
diff --git a/package/upower/Makefile b/package/upower/Makefile
index c62878716..adf317802 100644
--- a/package/upower/Makefile
+++ b/package/upower/Makefile
@@ -14,6 +14,8 @@ PKG_DEPENDS:=		glib dbus-glib polkit libgudev
 PKG_URL:=		http://upower.freedesktop.org/
 PKG_SITES:=		http://upower.freedesktop.org/releases/
 
+PKG_LIBC_DEPENDS:=	eglibc glibc
+
 DISTFILES:=             ${PKG_NAME}-${PKG_VERSION}.tar.xz
 
 include $(TOPDIR)/mk/package.mk
-- 
cgit v1.2.3