From 292ce123d1a27bdf81470fff3ac54753ebb7a957 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 8 May 2015 11:52:54 +0200 Subject: [PATCH] libnl: portability fixes from Alpine. --- srcpkgs/libnl/patches/fix-includes.patch | 25 +++++++++++ srcpkgs/libnl/patches/fix-strerror_r.patch | 50 +++++++++++++++++++++ srcpkgs/libnl/patches/libnl-1.1-flags.patch | 11 +++++ srcpkgs/libnl/template | 2 +- 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/libnl/patches/fix-includes.patch create mode 100644 srcpkgs/libnl/patches/fix-strerror_r.patch create mode 100644 srcpkgs/libnl/patches/libnl-1.1-flags.patch diff --git a/srcpkgs/libnl/patches/fix-includes.patch b/srcpkgs/libnl/patches/fix-includes.patch new file mode 100644 index 00000000000..f898bf740b6 --- /dev/null +++ b/srcpkgs/libnl/patches/fix-includes.patch @@ -0,0 +1,25 @@ +--- lib/netfilter/log.c ++++ lib/netfilter/log.c +@@ -18,6 +18,7 @@ + * @{ + */ + ++#include + #include + #include + +--- include/netlink/netlink.h ++++ include/netlink/netlink.h +@@ -12,11 +12,11 @@ + #ifndef NETLINK_NETLINK_H_ + #define NETLINK_NETLINK_H_ + ++#include + #include + #include + #include + #include +-#include + #include + #include + #include diff --git a/srcpkgs/libnl/patches/fix-strerror_r.patch b/srcpkgs/libnl/patches/fix-strerror_r.patch new file mode 100644 index 00000000000..d088f1ee008 --- /dev/null +++ b/srcpkgs/libnl/patches/fix-strerror_r.patch @@ -0,0 +1,50 @@ +--- lib/fib_lookup/lookup.c ++++ lib/fib_lookup/lookup.c +@@ -124,7 +124,7 @@ + static int result_dump_brief(struct nl_object *obj, struct nl_dump_params *p) + { + struct flnl_result *res = (struct flnl_result *) obj; +- char buf[256]; ++ char buf[256], buf2[256]; + int line = 1; + + dp_dump(p, "table %s prefixlen %u next-hop-selector %u\n", +@@ -132,9 +132,10 @@ + res->fr_prefixlen, res->fr_nh_sel); + dp_dump_line(p, line++, "type %s ", + nl_rtntype2str(res->fr_type, buf, sizeof(buf))); ++ strerror_r(-res->fr_error, buf2, sizeof(buf2)); + dp_dump(p, "scope %s error %s (%d)\n", + rtnl_scope2str(res->fr_scope, buf, sizeof(buf)), +- strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error); ++ buf2, res->fr_error); + + return line; + } +--- lib/handlers.c ++++ lib/handlers.c +@@ -136,8 +136,8 @@ + FILE *ofd = arg ? arg : stderr; + char buf[256]; + +- fprintf(ofd, "-- Error received: %s\n-- Original message: ", +- strerror_r(-e->error, buf, sizeof(buf))); ++ strerror_r(-e->error, buf, sizeof(buf)); ++ fprintf(ofd, "-- Error received: %s\n-- Original message: ", buf); + print_header_content(ofd, &e->msg); + fprintf(ofd, "\n"); + +--- lib/msg.c ++++ lib/msg.c +@@ -961,9 +961,9 @@ + struct nlmsgerr *err = nlmsg_data(hdr); + char buf[256]; + ++ strerror_r(-err->error, buf, sizeof(buf)); + fprintf(ofd, " [ERRORMSG] %Zu octets\n", sizeof(*err)); +- fprintf(ofd, " .error = %d \"%s\"\n", err->error, +- strerror_r(-err->error, buf, sizeof(buf))); ++ fprintf(ofd, " .error = %d \"%s\"\n", err->error, buf); + fprintf(ofd, " [ORIGINAL MESSAGE] %Zu octets\n", sizeof(*hdr)); + + errmsg = nlmsg_inherit(&err->msg); diff --git a/srcpkgs/libnl/patches/libnl-1.1-flags.patch b/srcpkgs/libnl/patches/libnl-1.1-flags.patch new file mode 100644 index 00000000000..966aa11c957 --- /dev/null +++ b/srcpkgs/libnl/patches/libnl-1.1-flags.patch @@ -0,0 +1,11 @@ +--- lib/Makefile.orig 2008-01-14 16:48:45.000000000 +0100 ++++ lib/Makefile 2009-05-26 09:47:42.000000000 +0200 +@@ -48,7 +48,7 @@ + + $(OUT_SLIB): ../Makefile.opts $(OBJ) + @echo " LD $(OUT_SLIB)"; \ +- $(CC) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc ++ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libnl.so.1 -o $(OUT_SLIB) $(OBJ) $(LIBNL_LIB) -lc + @echo " LN $(OUT_SLIB) $(LN1_SLIB)"; \ + rm -f $(LN1_SLIB) ; $(LN) -s $(OUT_SLIB) $(LN1_SLIB) + @echo " LN $(LN1_SLIB) $(LN_SLIB)"; \ diff --git a/srcpkgs/libnl/template b/srcpkgs/libnl/template index 7e940ee3370..07bbfbf65c9 100644 --- a/srcpkgs/libnl/template +++ b/srcpkgs/libnl/template @@ -1,7 +1,7 @@ # Template file for 'libnl' pkgname=libnl version=1.1.4 -revision=2 +revision=3 build_style=gnu-configure short_desc="Library for applications dealing with netlink sockets" homepage="http://www.infradead.org/~tgr/libnl/"