dhcpcd-dbus: unbreak musl

This commit is contained in:
Jürgen Buchmüller 2015-10-11 10:03:35 +02:00
parent 4ae28a2836
commit e5ae28681d
3 changed files with 101 additions and 1 deletions

View file

@ -0,0 +1,88 @@
The type ssize_t is required in the header, thus move
the include statements for system headers into dchpcd.h
Both glibc and musl libc have strverscmp(3) and the
static version would conflict with the musl libc one.
--- dhcpcd.h 2014-07-14 22:56:47.000000000 +0200
+++ dhcpcd.h 2015-10-11 09:57:47.605604457 +0200
@@ -28,6 +28,22 @@
#ifndef DHCPCD_H
#define DHCPCD_H
+// For strverscmp(3)
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <syslog.h>
+#include <unistd.h>
+
extern char *dhcpcd_version;
extern const char *dhcpcd_status;
--- dhcpcd.c 2014-07-14 22:56:47.000000000 +0200
+++ dhcpcd.c 2015-10-11 09:57:11.545607270 +0200
@@ -24,22 +24,6 @@
* SUCH DAMAGE.
*/
-// For strverscmp(3)
-#define _GNU_SOURCE
-
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-
#include "defs.h"
#include "dhcpcd.h"
#include "dhcpcd-dbus.h"
@@ -648,31 +648,6 @@
return list;
}
-#ifndef __GLIBC__
-/* Good enough for our needs */
-static int
-strverscmp(const char *s1, const char *s2)
-{
- int s1maj, s1min, s1part;
- int s2maj, s2min, s2part;
- int r;
-
- s1min = s1part = 0;
- if (sscanf(s1, "%d.%d.%d", &s1maj, &s1min, &s1part) < 1)
- return -1;
- s2min = s2part = 0;
- if (sscanf(s2, "%d.%d.%d", &s2maj, &s2min, &s2part) < 1)
- return -1;
- r = s1maj - s2maj;
- if (r != 0)
- return r;
- r = s1min - s2min;
- if (r != 0)
- return r;
- return s1part - s2part;
-}
-#endif
-
void
dhcpcd_init(_unused void *data)
{

View file

@ -0,0 +1,12 @@
The struct timeval is defined in sys/time.h
--- eloop.h 2014-07-14 22:56:47.000000000 +0200
+++ eloop.h 2015-10-11 09:49:29.563643314 +0200
@@ -29,6 +29,7 @@
#define ELOOP_H
#include <time.h>
+#include <sys/time.h>
int add_event(int, void (*)(void *), void *);
int add_event_flags(int, short, void (*)(int, void *), void *);

View file

@ -1,7 +1,7 @@
# Template file for 'dhcpcd-dbus'
pkgname=dhcpcd-dbus
version=0.6.1
revision=1
revision=2
build_style=configure
configure_args="--prefix=/usr --sysconfdir=/etc --rundir=/run"
hostmakedepends="pkg-config"