libbsd: Update to 0.8.7
Update libbsd to 0.8.7 Remove glibc dependency Clean up InstallDev and install entries Use /usr path for consistency Cherry pick patches from upstream to fix musl compilation Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
This commit is contained in:
		
				
					committed by
					
						
						Hauke Mehrtens
					
				
			
			
				
	
			
			
			
						parent
						
							6cda4f6861
						
					
				
				
					commit
					e341f45913
				
			@@ -1,12 +1,12 @@
 | 
			
		||||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=libbsd
 | 
			
		||||
PKG_VERSION:=0.3.0
 | 
			
		||||
PKG_VERSION:=0.8.7
 | 
			
		||||
PKG_RELEASE:=1
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 | 
			
		||||
PKG_HASH:=fbf36ed40443e1d0d795adbae8d461952509e610c3ccf0866ae160b723f7fe38
 | 
			
		||||
PKG_SOURCE_URL:=http://libbsd.freedesktop.org/releases
 | 
			
		||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 | 
			
		||||
PKG_HASH:=f548f10e5af5a08b1e22889ce84315b1ebe41505b015c9596bad03fd13a12b31
 | 
			
		||||
PKG_SOURCE_URL:=https://libbsd.freedesktop.org/releases
 | 
			
		||||
 | 
			
		||||
PKG_LICENSE:=BSD-4-Clause
 | 
			
		||||
PKG_LICENSE_FILES:=COPYING
 | 
			
		||||
@@ -18,7 +18,6 @@ PKG_INSTALL:=1
 | 
			
		||||
define Package/libbsd
 | 
			
		||||
  SECTION:=libs
 | 
			
		||||
  CATEGORY:=Libraries
 | 
			
		||||
  DEPENDS:=@USE_GLIBC
 | 
			
		||||
  TITLE:=common BSD library
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
@@ -27,30 +26,17 @@ define Package/libbsd/description
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Build/InstallDev
 | 
			
		||||
	$(INSTALL_DIR) \
 | 
			
		||||
		$(1)/lib \
 | 
			
		||||
		$(1)/usr/include
 | 
			
		||||
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/lib/libbsd.so* \
 | 
			
		||||
		$(1)/lib/
 | 
			
		||||
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/usr/include/* \
 | 
			
		||||
		$(1)/usr/include/
 | 
			
		||||
 | 
			
		||||
	( cd $(1)/lib ; $(LN) libbsd.so.$(PKG_VERSION) libbsd.so )
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/include
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbsd.{la,so*} $(1)/usr/lib/
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libbsd*.pc $(1)/usr/lib/pkgconfig/
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/libbsd/install
 | 
			
		||||
	$(INSTALL_DIR) \
 | 
			
		||||
		$(1)/lib
 | 
			
		||||
 | 
			
		||||
	$(CP) \
 | 
			
		||||
		$(PKG_INSTALL_DIR)/lib/libbsd.so* \
 | 
			
		||||
		$(1)/lib/
 | 
			
		||||
 | 
			
		||||
	( cd $(1)/lib ; $(LN) libbsd.so.$(PKG_VERSION) libbsd.so )
 | 
			
		||||
	$(INSTALL_DIR) $(1)/usr/lib
 | 
			
		||||
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbsd.so* $(1)/usr/lib/
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
$(eval $(call BuildPackage,libbsd))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
--- a/src/local-elf.h
 | 
			
		||||
+++ b/src/local-elf.h
 | 
			
		||||
@@ -165,6 +165,16 @@
 | 
			
		||||
 #endif
 | 
			
		||||
 #define ELF_TARG_DATA	ELFDATA2MSB
 | 
			
		||||
 
 | 
			
		||||
+#elif defined(__aarch64__)
 | 
			
		||||
+
 | 
			
		||||
+#define ELF_TARG_MACH	EM_AARCH64
 | 
			
		||||
+#define ELF_TARG_CLASS	ELFCLASS64
 | 
			
		||||
+#ifdef __AARCH64EB__
 | 
			
		||||
+#define ELF_TARG_DATA	ELFDATA2MSB
 | 
			
		||||
+#else
 | 
			
		||||
+#define ELF_TARG_DATA	ELFDATA2LSB
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 #else
 | 
			
		||||
 
 | 
			
		||||
 #error Unknown ELF machine type
 | 
			
		||||
@@ -0,0 +1,195 @@
 | 
			
		||||
From 11ec8f1e5dfa1c10e0c9fb94879b6f5b96ba52dd Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Guillem Jover <guillem@hadrons.org>
 | 
			
		||||
Date: Tue, 6 Mar 2018 01:41:35 +0100
 | 
			
		||||
Subject: Handle systems missing <sys/cdefs.h>
 | 
			
		||||
 | 
			
		||||
This is a non-portable header, and we cannot expect it to be provided by
 | 
			
		||||
the system libc (e.g. musl). We just need and rely on declaration that
 | 
			
		||||
we have defined ourselves in our own <bsd/sys/cdefs.h>. So we switch to
 | 
			
		||||
only ever assume that.
 | 
			
		||||
 | 
			
		||||
Fixes: https://bugs.freedesktop.org/105281
 | 
			
		||||
---
 | 
			
		||||
 include/bsd/libutil.h        | 4 ++++
 | 
			
		||||
 include/bsd/md5.h            | 4 ++++
 | 
			
		||||
 include/bsd/nlist.h          | 4 ++++
 | 
			
		||||
 include/bsd/readpassphrase.h | 4 ++++
 | 
			
		||||
 include/bsd/stdlib.h         | 4 ++++
 | 
			
		||||
 include/bsd/string.h         | 4 ++++
 | 
			
		||||
 include/bsd/stringlist.h     | 5 +++++
 | 
			
		||||
 include/bsd/sys/queue.h      | 4 ++++
 | 
			
		||||
 include/bsd/sys/tree.h       | 4 ++++
 | 
			
		||||
 include/bsd/timeconv.h       | 4 ++++
 | 
			
		||||
 include/bsd/vis.h            | 4 ++++
 | 
			
		||||
 include/bsd/wchar.h          | 4 ++++
 | 
			
		||||
 12 files changed, 49 insertions(+)
 | 
			
		||||
 | 
			
		||||
--- a/include/bsd/libutil.h
 | 
			
		||||
+++ b/include/bsd/libutil.h
 | 
			
		||||
@@ -40,7 +40,11 @@
 | 
			
		||||
 #define LIBBSD_LIBUTIL_H
 | 
			
		||||
 
 | 
			
		||||
 #include <features.h>
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 #include <stdint.h>
 | 
			
		||||
 #include <stdio.h>
 | 
			
		||||
--- a/include/bsd/md5.h
 | 
			
		||||
+++ b/include/bsd/md5.h
 | 
			
		||||
@@ -27,7 +27,11 @@ typedef struct MD5Context {
 | 
			
		||||
 	uint8_t buffer[MD5_BLOCK_LENGTH];	/* input buffer */
 | 
			
		||||
 } MD5_CTX;
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 
 | 
			
		||||
 __BEGIN_DECLS
 | 
			
		||||
--- a/include/bsd/nlist.h
 | 
			
		||||
+++ b/include/bsd/nlist.h
 | 
			
		||||
@@ -27,7 +27,11 @@
 | 
			
		||||
 #ifndef LIBBSD_NLIST_H
 | 
			
		||||
 #define LIBBSD_NLIST_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 struct nlist {
 | 
			
		||||
 	union {
 | 
			
		||||
--- a/include/bsd/readpassphrase.h
 | 
			
		||||
+++ b/include/bsd/readpassphrase.h
 | 
			
		||||
@@ -31,7 +31,11 @@
 | 
			
		||||
 #define RPP_SEVENBIT    0x10		/* Strip the high bit from input. */
 | 
			
		||||
 #define RPP_STDIN       0x20		/* Read from stdin, not /dev/tty */
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 
 | 
			
		||||
 __BEGIN_DECLS
 | 
			
		||||
--- a/include/bsd/stdlib.h
 | 
			
		||||
+++ b/include/bsd/stdlib.h
 | 
			
		||||
@@ -42,7 +42,11 @@
 | 
			
		||||
 #ifndef LIBBSD_STDLIB_H
 | 
			
		||||
 #define LIBBSD_STDLIB_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/stat.h>
 | 
			
		||||
 #include <stdint.h>
 | 
			
		||||
 
 | 
			
		||||
--- a/include/bsd/string.h
 | 
			
		||||
+++ b/include/bsd/string.h
 | 
			
		||||
@@ -33,7 +33,11 @@
 | 
			
		||||
 #ifndef LIBBSD_STRING_H
 | 
			
		||||
 #define LIBBSD_STRING_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 
 | 
			
		||||
 __BEGIN_DECLS
 | 
			
		||||
--- a/include/bsd/stringlist.h
 | 
			
		||||
+++ b/include/bsd/stringlist.h
 | 
			
		||||
@@ -31,7 +31,12 @@
 | 
			
		||||
 
 | 
			
		||||
 #ifndef LIBBSD_STRINGLIST_H
 | 
			
		||||
 #define LIBBSD_STRINGLIST_H
 | 
			
		||||
+
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
--- a/include/bsd/sys/queue.h
 | 
			
		||||
+++ b/include/bsd/sys/queue.h
 | 
			
		||||
@@ -33,7 +33,11 @@
 | 
			
		||||
 #ifndef LIBBSD_SYS_QUEUE_H
 | 
			
		||||
 #define LIBBSD_SYS_QUEUE_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * This file defines four types of data structures: singly-linked lists,
 | 
			
		||||
--- a/include/bsd/sys/tree.h
 | 
			
		||||
+++ b/include/bsd/sys/tree.h
 | 
			
		||||
@@ -30,7 +30,11 @@
 | 
			
		||||
 #ifndef LIBBSD_SYS_TREE_H
 | 
			
		||||
 #define LIBBSD_SYS_TREE_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
  * This file defines data structures for different types of trees:
 | 
			
		||||
--- a/include/bsd/timeconv.h
 | 
			
		||||
+++ b/include/bsd/timeconv.h
 | 
			
		||||
@@ -41,7 +41,11 @@
 | 
			
		||||
 #ifndef LIBBSD_TIMECONV_H
 | 
			
		||||
 #define LIBBSD_TIMECONV_H
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <stdint.h>
 | 
			
		||||
 #include <time.h>
 | 
			
		||||
 
 | 
			
		||||
--- a/include/bsd/vis.h
 | 
			
		||||
+++ b/include/bsd/vis.h
 | 
			
		||||
@@ -72,7 +72,11 @@
 | 
			
		||||
  */
 | 
			
		||||
 #define	UNVIS_END	1	/* no more characters */
 | 
			
		||||
 
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 
 | 
			
		||||
 __BEGIN_DECLS
 | 
			
		||||
 char	*vis(char *, int, int, int);
 | 
			
		||||
--- a/include/bsd/wchar.h
 | 
			
		||||
+++ b/include/bsd/wchar.h
 | 
			
		||||
@@ -40,7 +40,11 @@
 | 
			
		||||
 #define LIBBSD_WCHAR_H
 | 
			
		||||
 
 | 
			
		||||
 #include <stddef.h>
 | 
			
		||||
+#ifdef LIBBSD_OVERLAY
 | 
			
		||||
 #include <sys/cdefs.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <bsd/sys/cdefs.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include <sys/types.h>
 | 
			
		||||
 
 | 
			
		||||
 __BEGIN_DECLS
 | 
			
		||||
@@ -0,0 +1,65 @@
 | 
			
		||||
From 1f8a3f7bccfc84b195218ad0086ebd57049c3490 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Guillem Jover <guillem@hadrons.org>
 | 
			
		||||
Date: Tue, 6 Mar 2018 01:39:45 +0100
 | 
			
		||||
Subject: Fix function declaration protection for glibc already providing them
 | 
			
		||||
MIME-Version: 1.0
 | 
			
		||||
Content-Type: text/plain; charset=UTF-8
 | 
			
		||||
Content-Transfer-Encoding: 8bit
 | 
			
		||||
 | 
			
		||||
On non-glibc based systems we cannot unconditionally use the
 | 
			
		||||
__GLIBC_PREREQ macro as it gets expanded before evaluation. Instead,
 | 
			
		||||
if it is undefined, define it to 0.
 | 
			
		||||
 | 
			
		||||
We should also always declare these functions on non-glibc based
 | 
			
		||||
systems. And on systems with a new enough glibc, which provides these
 | 
			
		||||
functions, we should still provide the declarations if _GNU_SOURCE
 | 
			
		||||
is *not* defined.
 | 
			
		||||
 | 
			
		||||
Reported-by: Jörg Krause <joerg.krause@embedded.rocks>
 | 
			
		||||
---
 | 
			
		||||
 include/bsd/stdlib.h    | 3 ++-
 | 
			
		||||
 include/bsd/string.h    | 3 ++-
 | 
			
		||||
 include/bsd/sys/cdefs.h | 8 ++++++++
 | 
			
		||||
 3 files changed, 12 insertions(+), 2 deletions(-)
 | 
			
		||||
 | 
			
		||||
--- a/include/bsd/stdlib.h
 | 
			
		||||
+++ b/include/bsd/stdlib.h
 | 
			
		||||
@@ -71,7 +71,8 @@ int sradixsort(const unsigned char **bas
 | 
			
		||||
                const unsigned char *table, unsigned endbyte);
 | 
			
		||||
 
 | 
			
		||||
 void *reallocf(void *ptr, size_t size);
 | 
			
		||||
-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26)
 | 
			
		||||
+#if !defined(__GLIBC__) || \
 | 
			
		||||
+    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 26) || !defined(_GNU_SOURCE)))
 | 
			
		||||
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
--- a/include/bsd/string.h
 | 
			
		||||
+++ b/include/bsd/string.h
 | 
			
		||||
@@ -46,7 +46,8 @@ size_t strlcat(char *dst, const char *sr
 | 
			
		||||
 char *strnstr(const char *str, const char *find, size_t str_len);
 | 
			
		||||
 void strmode(mode_t mode, char *str);
 | 
			
		||||
 
 | 
			
		||||
-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25)
 | 
			
		||||
+#if !defined(__GLIBC__) || \
 | 
			
		||||
+    (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
 | 
			
		||||
 void explicit_bzero(void *buf, size_t len);
 | 
			
		||||
 #endif
 | 
			
		||||
 __END_DECLS
 | 
			
		||||
--- a/include/bsd/sys/cdefs.h
 | 
			
		||||
+++ b/include/bsd/sys/cdefs.h
 | 
			
		||||
@@ -59,6 +59,14 @@
 | 
			
		||||
 #endif
 | 
			
		||||
 
 | 
			
		||||
 /*
 | 
			
		||||
+ * On non-glibc based systems, we cannot unconditionally use the
 | 
			
		||||
+ * __GLIBC_PREREQ macro as it gets expanded before evaluation.
 | 
			
		||||
+ */
 | 
			
		||||
+#ifndef __GLIBC_PREREQ
 | 
			
		||||
+#define __GLIBC_PREREQ(maj, min) 0
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
+/*
 | 
			
		||||
  * Some kFreeBSD headers expect those macros to be set for sanity checks.
 | 
			
		||||
  */
 | 
			
		||||
 #ifndef _SYS_CDEFS_H_
 | 
			
		||||
		Reference in New Issue
	
	Block a user