From b3c3ccc10ad4db5ac704161a00cf36ee682c8ee0 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 18 Jun 2015 00:28:37 +0200 Subject: [PATCH] vpnc: fix musl compatibility - Add missing `sys/ttydefaults.h` include to `config.c` - Restrict usage of `error.h` to glibc and uclibc only - Avoid including `linux/if_tun.h` on non-glibc/uclibc to prevent musl kernel/libc header conflicts Signed-off-by: Jo-Philipp Wich --- net/vpnc/Makefile | 2 +- net/vpnc/patches/001-cross.patch | 6 ++-- net/vpnc/patches/100-musl-compat.patch | 42 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 net/vpnc/patches/100-musl-compat.patch diff --git a/net/vpnc/Makefile b/net/vpnc/Makefile index 16a45a4b4..95995e10c 100644 --- a/net/vpnc/Makefile +++ b/net/vpnc/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=vpnc PKG_REV:=550 PKG_VERSION:=0.5.3.r$(PKG_REV) -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://svn.unix-ag.uni-kl.de/vpnc/trunk/ diff --git a/net/vpnc/patches/001-cross.patch b/net/vpnc/patches/001-cross.patch index 94b382c3d..33bcfee3b 100644 --- a/net/vpnc/patches/001-cross.patch +++ b/net/vpnc/patches/001-cross.patch @@ -1,7 +1,7 @@ --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ - # $Id$ + # $Id: Makefile 539 2013-12-04 13:41:04Z Antonio Borneo $ DESTDIR= -PREFIX=/usr/local @@ -9,7 +9,7 @@ ETCDIR=/etc/vpnc BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin -@@ -57,18 +57,15 @@ +@@ -57,18 +57,15 @@ OBJS = $(addsuffix .o,$(basename $(SRCS) CRYPTO_OBJS = $(addsuffix .o,$(basename $(CRYPTO_SRCS))) BINOBJS = $(addsuffix .o,$(BINS)) BINSRCS = $(addsuffix .c,$(BINS)) @@ -31,7 +31,7 @@ LIBS += -lnsl -lresolv -lsocket endif ifneq (,$(findstring Apple,$(shell $(CC) --version))) -@@ -82,7 +79,7 @@ +@@ -82,7 +79,7 @@ vpnc : $(OBJS) vpnc.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) vpnc.8 : vpnc.8.template makeman.pl vpnc diff --git a/net/vpnc/patches/100-musl-compat.patch b/net/vpnc/patches/100-musl-compat.patch new file mode 100644 index 000000000..1186428af --- /dev/null +++ b/net/vpnc/patches/100-musl-compat.patch @@ -0,0 +1,42 @@ +--- a/sysdep.h ++++ b/sysdep.h +@@ -37,12 +37,14 @@ int tun_read(int fd, unsigned char *buf, + int tun_get_hwaddr(int fd, char *dev, uint8_t *hwaddr); + + /***************************************************************************/ +-#if defined(__linux__) || defined(__GLIBC__) ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #include ++#define HAVE_ERROR 1 ++#endif + ++#if defined(__linux__) || defined(__GLIBC__) + #define HAVE_VASPRINTF 1 + #define HAVE_ASPRINTF 1 +-#define HAVE_ERROR 1 + #define HAVE_UNSETENV 1 + #define HAVE_SETENV 1 + #endif +--- a/sysdep.c ++++ b/sysdep.c +@@ -59,7 +59,9 @@ + #if defined(__DragonFly__) + #include + #elif defined(__linux__) +-#include ++# if defined(__GLIBC__) || defined(__UCLIBC__) ++# include ++# endif + #elif defined(__APPLE__) + /* no header for tun */ + #elif defined(__CYGWIN__) +--- a/config.c ++++ b/config.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + #include + #include