On Nov 11, 2021, at 7:22 PM, Stuart Henderson <s...@spacehopper.org> wrote:
> 
> On 2021/11/11 15:31, k...@openbsd.org wrote:
>> http://build-failures.rhaalovely.net/sparc64/2021-11-09/sysutils/polkit.log
> 
> I don't see how to fix it properly in meson.build, but here is the problem,
> this is detected incorrectly with ports-gcc,
> 
> Checking if "setnetgrent return support" : compiles: YES 
> 
> Should be NO.
> 
> Looking in meson.build
> 
> 150 
> 151 # Check whether setnetgrent has a return value
> 152 config_h.set('HAVE_NETGROUP_H', cc.has_header('netgroup.h'))
> 153 
> 
> this is detecting netgroup.h and is setting it in config.h, but it is
> *not* defining HAVE_NETGROUP_H when it compiles the following test
> 
> 154 setnetgrent_return_src = '''
> 155   #include <stddef.h>
> 156   #ifdef HAVE_NETGROUP_H
> 157   #include <netgroup.h>
> 158   #else
> 159   #include <netdb.h>
> 160   #endif
> 161   int main() {
> 162       int r = setnetgrent (NULL);
> 163   };
> 164 '''
> 165 
> 166 config_h.set('HAVE_SETNETGRENT_RETURN', 
> cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support'))
> 
> The difference between the compilers is that gcc returns
> 
> warning: implicit declaration of function 'setnetgrent'; did you mean 
> 'setnetent'? [-Wimplicit-function-declaration]
> 
> whereas clang gives
> 
> error: implicit declaration of function 'setnetgrent' is invalid in C99 
> [-Werror,-Wimplicit-function-declaration]
> 
> so the test compile is giving wrong results, so it takes the wrong
> ifdef path resulting in the build failure
> 
> ../polkit-0.120/src/polkitbackend/polkitbackendinteractiveauthority.c:2239:7: 
> error: void value not ignored as it ought to be
> 
> Bodging it with
> 
> 166 config_h.set('HAVE_SETNETGRENT_RETURN', 
> cc.compiles(setnetgrent_return_src, name: 'setnetgrent return support', args: 
> '-DHAVE_NETGROUP_H'))
> 
> does work well enough for OpenBSD but obviously not correct ..
> 

Here’s a cleaner version then the one I previously sent. Okay?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/polkit/Makefile,v
retrieving revision 1.88
diff -u -p -u -r1.88 Makefile
--- Makefile    30 Oct 2021 14:26:23 -0000      1.88
+++ Makefile    12 Nov 2021 17:56:16 -0000
@@ -3,6 +3,7 @@
 COMMENT=               framework for granting privileged operations to users
 
 DISTNAME=              polkit-0.120
+REVISION=              0
 
 SHARED_LIBS += polkit-gobject-1          2.0 # 0.0.0
 SHARED_LIBS += polkit-agent-1            2.0 # 0.0.0
Index: patches/patch-meson_build
===================================================================
RCS file: patches/patch-meson_build
diff -N patches/patch-meson_build
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-meson_build   12 Nov 2021 17:56:16 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Fix check for whether setnetgrent has a return value
+
+Index: meson.build
+--- meson.build.orig
++++ meson.build
+@@ -163,8 +163,11 @@ setnetgrent_return_src = '''
+   };
+ '''
+ 
+-config_h.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, 
name: 'setnetgrent return support'))
+-
++if config_h.get('HAVE_NETGROUP_H')
++  config_h.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, 
name: 'setnetgrent return support', args: '-DHAVE_NETGROUP_H'))
++else
++  config_h.set('HAVE_SETNETGRENT_RETURN', cc.compiles(setnetgrent_return_src, 
name: 'setnetgrent return support'))
++endif
+ # Select wether to use libsystemd-login, libelogind or ConsoleKit for session 
tracking
+ session_tracking = get_option('session_tracking')
+ enable_logind = (session_tracking != 'ConsoleKit’)

Attachment: polkit.setnetgrent.diff
Description: Binary data


Reply via email to