mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
Revert "Revert "libbsd: 0.9.1 -> 0.10.0 (#66948)""
This reverts commit 9e7582c74b
.
* Updates libbsd along with the darwin.patch.
* Upstream PR for darwin.patch can be found at
https://gitlab.freedesktop.org/libbsd/libbsd/merge_requests/3.
* musl.patch is removed.
This commit is contained in:
parent
23e417f218
commit
7d364b9400
@ -1,30 +1,26 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 55fcfe6..1e26c93 100644
|
||||
index 6e9496d..60b6e4c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -51,15 +51,19 @@ AS_CASE([$host_os],
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
|
||||
AC_SUBST([CLOCK_GETTIME_LIBS])
|
||||
LIBS="$saved_LIBS"
|
||||
+ AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
|
||||
],
|
||||
[*-musl*], [
|
||||
# Upstream refuses to define this, we will do it ourselves then.
|
||||
AC_DEFINE([__MUSL__], [1], [Define to 1 if we are building for musl])
|
||||
+ AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
|
||||
],
|
||||
-)
|
||||
+ [
|
||||
+ AM_CONDITIONAL([BUILD_LINK_VERSION_SCRIPT], [1])
|
||||
+ ])
|
||||
@@ -44,6 +44,8 @@ AC_SUBST([TESTU01_LIBS])
|
||||
AM_CONDITIONAL([HAVE_LIBTESTU01],
|
||||
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
|
||||
|
||||
+AX_CHECK_VSCRIPT
|
||||
+
|
||||
is_windows=no
|
||||
AS_CASE([$host_os],
|
||||
[*-gnu*], [
|
||||
@@ -68,7 +70,7 @@ AS_CASE([$host_os],
|
||||
AM_CONDITIONAL([OS_WINDOWS], [test "x$is_windows" = "xyes"])
|
||||
|
||||
# Checks for header files.
|
||||
-AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
|
||||
+AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h nlist.h])
|
||||
-AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h grp.h])
|
||||
+AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h grp.h nlist.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_INLINE
|
||||
@@ -143,7 +147,8 @@ AC_LINK_IFELSE(
|
||||
@@ -169,7 +171,8 @@ AC_LINK_IFELSE(
|
||||
|
||||
AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
|
||||
getauxval getentropy getexecname getline \
|
||||
@ -60,19 +56,171 @@ index f987fee..a1e17ed 100644
|
||||
|
||||
#if !defined(__GLIBC__) || \
|
||||
(defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
|
||||
diff --git a/m4/ax_check_vscript.m4 b/m4/ax_check_vscript.m4
|
||||
new file mode 100644
|
||||
index 0000000..9851f32
|
||||
--- /dev/null
|
||||
+++ b/m4/ax_check_vscript.m4
|
||||
@@ -0,0 +1,142 @@
|
||||
+# ===========================================================================
|
||||
+# https://www.gnu.org/software/autoconf-archive/ax_check_vscript.html
|
||||
+# ===========================================================================
|
||||
+#
|
||||
+# SYNOPSIS
|
||||
+#
|
||||
+# AX_CHECK_VSCRIPT
|
||||
+#
|
||||
+# DESCRIPTION
|
||||
+#
|
||||
+# Check whether the linker supports version scripts. Version scripts are
|
||||
+# used when building shared libraries to bind symbols to version nodes
|
||||
+# (helping to detect incompatibilities) or to limit the visibility of
|
||||
+# non-public symbols.
|
||||
+#
|
||||
+# Output:
|
||||
+#
|
||||
+# If version scripts are supported, VSCRIPT_LDFLAGS will contain the
|
||||
+# appropriate flag to pass to the linker. On GNU systems this would
|
||||
+# typically be "-Wl,--version-script", and on Solaris it would typically
|
||||
+# be "-Wl,-M".
|
||||
+#
|
||||
+# Two Automake conditionals are also set:
|
||||
+#
|
||||
+# HAVE_VSCRIPT is true if the linker supports version scripts with
|
||||
+# entries that use simple wildcards, like "local: *".
|
||||
+#
|
||||
+# HAVE_VSCRIPT_COMPLEX is true if the linker supports version scripts with
|
||||
+# pattern matching wildcards, like "global: Java_*".
|
||||
+#
|
||||
+# On systems that do not support symbol versioning, such as Mac OS X, both
|
||||
+# conditionals will be false. They will also be false if the user passes
|
||||
+# "--disable-symvers" on the configure command line.
|
||||
+#
|
||||
+# Example:
|
||||
+#
|
||||
+# configure.ac:
|
||||
+#
|
||||
+# AX_CHECK_VSCRIPT
|
||||
+#
|
||||
+# Makefile.am:
|
||||
+#
|
||||
+# if HAVE_VSCRIPT
|
||||
+# libfoo_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libfoo.map
|
||||
+# endif
|
||||
+#
|
||||
+# if HAVE_VSCRIPT_COMPLEX
|
||||
+# libbar_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libbar.map
|
||||
+# endif
|
||||
+#
|
||||
+# LICENSE
|
||||
+#
|
||||
+# Copyright (c) 2014 Kevin Cernekee <cernekee@gmail.com>
|
||||
+#
|
||||
+# Copying and distribution of this file, with or without modification, are
|
||||
+# permitted in any medium without royalty provided the copyright notice
|
||||
+# and this notice are preserved. This file is offered as-is, without any
|
||||
+# warranty.
|
||||
+
|
||||
+#serial 2
|
||||
+
|
||||
+# _AX_CHECK_VSCRIPT(flag, global-sym, action-if-link-succeeds, [junk-file=no])
|
||||
+AC_DEFUN([_AX_CHECK_VSCRIPT], [
|
||||
+ AC_LANG_PUSH([C])
|
||||
+ ax_check_vscript_save_flags="$LDFLAGS"
|
||||
+ echo "V1 { global: $2; local: *; };" > conftest.map
|
||||
+ AS_IF([test x$4 = xyes], [
|
||||
+ echo "{" >> conftest.map
|
||||
+ ])
|
||||
+ LDFLAGS="$LDFLAGS -Wl,$1,conftest.map"
|
||||
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[int show, hide;]], [])], [$3])
|
||||
+ LDFLAGS="$ax_check_vscript_save_flags"
|
||||
+ rm -f conftest.map
|
||||
+ AC_LANG_POP([C])
|
||||
+]) dnl _AX_CHECK_VSCRIPT
|
||||
+
|
||||
+AC_DEFUN([AX_CHECK_VSCRIPT], [
|
||||
+
|
||||
+ AC_ARG_ENABLE([symvers],
|
||||
+ AS_HELP_STRING([--disable-symvers],
|
||||
+ [disable library symbol versioning [default=auto]]),
|
||||
+ [want_symvers=$enableval],
|
||||
+ [want_symvers=yes]
|
||||
+ )
|
||||
+
|
||||
+ AS_IF([test x$want_symvers = xyes], [
|
||||
+
|
||||
+ dnl First test --version-script and -M with a simple wildcard.
|
||||
+
|
||||
+ AC_CACHE_CHECK([linker version script flag], ax_cv_check_vscript_flag, [
|
||||
+ ax_cv_check_vscript_flag=unsupported
|
||||
+ _AX_CHECK_VSCRIPT([--version-script], [show], [
|
||||
+ ax_cv_check_vscript_flag=--version-script
|
||||
+ ])
|
||||
+ AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
|
||||
+ _AX_CHECK_VSCRIPT([-M], [show], [ax_cv_check_vscript_flag=-M])
|
||||
+ ])
|
||||
+
|
||||
+ dnl The linker may interpret -M (no argument) as "produce a load map."
|
||||
+ dnl If "-M conftest.map" doesn't fail when conftest.map contains
|
||||
+ dnl obvious syntax errors, assume this is the case.
|
||||
+
|
||||
+ AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
|
||||
+ _AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [show],
|
||||
+ [ax_cv_check_vscript_flag=unsupported], [yes])
|
||||
+ ])
|
||||
+ ])
|
||||
+
|
||||
+ dnl If the simple wildcard worked, retest with a complex wildcard.
|
||||
+
|
||||
+ AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
|
||||
+ ax_check_vscript_flag=$ax_cv_check_vscript_flag
|
||||
+ AC_CACHE_CHECK([if version scripts can use complex wildcards],
|
||||
+ ax_cv_check_vscript_complex_wildcards, [
|
||||
+ ax_cv_check_vscript_complex_wildcards=no
|
||||
+ _AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [sh*], [
|
||||
+ ax_cv_check_vscript_complex_wildcards=yes])
|
||||
+ ])
|
||||
+ ax_check_vscript_complex_wildcards="$ax_cv_check_vscript_complex_wildcards"
|
||||
+ ], [
|
||||
+ ax_check_vscript_flag=
|
||||
+ ax_check_vscript_complex_wildcards=no
|
||||
+ ])
|
||||
+ ], [
|
||||
+ AC_MSG_CHECKING([linker version script flag])
|
||||
+ AC_MSG_RESULT([disabled])
|
||||
+
|
||||
+ ax_check_vscript_flag=
|
||||
+ ax_check_vscript_complex_wildcards=no
|
||||
+ ])
|
||||
+
|
||||
+ AS_IF([test x$ax_check_vscript_flag != x], [
|
||||
+ VSCRIPT_LDFLAGS="-Wl,$ax_check_vscript_flag"
|
||||
+ AC_SUBST([VSCRIPT_LDFLAGS])
|
||||
+ ])
|
||||
+
|
||||
+ AM_CONDITIONAL([HAVE_VSCRIPT],
|
||||
+ [test x$ax_check_vscript_flag != x])
|
||||
+ AM_CONDITIONAL([HAVE_VSCRIPT_COMPLEX],
|
||||
+ [test x$ax_check_vscript_complex_wildcards = xyes])
|
||||
+
|
||||
+]) dnl AX_CHECK_VSCRIPT
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index f3cc0fa..3aaecd4 100644
|
||||
index 8384b92..2ca6f1b 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -56,8 +56,10 @@ libbsd_la_DEPENDENCIES = \
|
||||
libbsd_la_LIBADD = \
|
||||
$(CLOCK_GETTIME_LIBS)
|
||||
@@ -65,8 +65,14 @@ libbsd_la_LIBADD = \
|
||||
$(ARC4RANDOM_ATFORK_LIBS) \
|
||||
$(nil)
|
||||
libbsd_la_LDFLAGS = \
|
||||
- -Wl,--version-script=$(srcdir)/libbsd.map \
|
||||
-version-number $(LIBBSD_ABI)
|
||||
+if BUILD_LINK_VERSION_SCRIPT
|
||||
+libbsd_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libbsd.map
|
||||
+if HAVE_VSCRIPT
|
||||
+libbsd_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libbsd.map
|
||||
+endif
|
||||
+if HAVE_VSCRIPT_COMPLEX
|
||||
+libbsd_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libbsd.map
|
||||
+endif
|
||||
+
|
||||
libbsd_la_SOURCES = \
|
||||
arc4random.c \
|
||||
arc4random.h \
|
||||
@ -175,23 +323,28 @@ index b3c8d5e..602f54e 100644
|
||||
|
||||
#include <string.h>
|
||||
diff --git a/src/local-link.h b/src/local-link.h
|
||||
index d518dcf..84694a2 100644
|
||||
index 0d4351a..fc520af 100644
|
||||
--- a/src/local-link.h
|
||||
+++ b/src/local-link.h
|
||||
@@ -27,7 +27,11 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
#ifndef LIBBSD_LOCAL_LINK_H
|
||||
#define LIBBSD_LOCAL_LINK_H
|
||||
|
||||
+#ifdef __MACH__
|
||||
+#define libbsd_link_warning(symbol, msg)
|
||||
+#define libbsd_symver_default(alias, symbol, version)
|
||||
+#define libbsd_symver_variant(alias, symbol, version)
|
||||
+#else
|
||||
#define libbsd_link_warning(symbol, msg) \
|
||||
static const char libbsd_emit_link_warning_##symbol[] \
|
||||
__attribute__((used,section(".gnu.warning." #symbol))) = msg;
|
||||
__attribute__((__used__,__section__(".gnu.warning." #symbol))) = msg;
|
||||
@@ -45,3 +50,4 @@
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+#endif
|
||||
diff --git a/src/nlist.c b/src/nlist.c
|
||||
index 0932f59..4502048 100644
|
||||
index 228c220..46c2d77 100644
|
||||
--- a/src/nlist.c
|
||||
+++ b/src/nlist.c
|
||||
@@ -41,6 +41,7 @@
|
||||
@ -202,7 +355,7 @@ index 0932f59..4502048 100644
|
||||
#include "local-elf.h"
|
||||
|
||||
#define SIZE_T_MAX 0xffffffffU
|
||||
@@ -265,3 +266,4 @@ nlist(const char *name, struct nlist *list)
|
||||
@@ -280,3 +281,4 @@ nlist(const char *name, struct nlist *list)
|
||||
(void)close(fd);
|
||||
return (n);
|
||||
}
|
||||
@ -227,12 +380,12 @@ index f9f6195..2bc5fb4 100644
|
||||
|
||||
static void handler(int);
|
||||
diff --git a/src/setproctitle.c b/src/setproctitle.c
|
||||
index 038ac7d..e9ee09c 100644
|
||||
index ff32aa3..51ed833 100644
|
||||
--- a/src/setproctitle.c
|
||||
+++ b/src/setproctitle.c
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <unistd.h>
|
||||
@@ -33,6 +33,10 @@
|
||||
#include <string.h>
|
||||
#include "local-link.h"
|
||||
|
||||
+#ifdef __MACH__
|
||||
+extern char **environ;
|
||||
@ -241,30 +394,16 @@ index 038ac7d..e9ee09c 100644
|
||||
static struct {
|
||||
/* Original value. */
|
||||
const char *arg0;
|
||||
@@ -280,16 +284,22 @@ setproctitle_impl(const char *fmt, ...)
|
||||
*++nul = '\0';
|
||||
}
|
||||
}
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver setproctitle_impl,setproctitle@@LIBBSD_0.5");
|
||||
+#endif
|
||||
|
||||
/* The original function introduced in 0.2 was a stub, it only got implemented
|
||||
@@ -287,7 +291,8 @@ libbsd_symver_default(setproctitle, setproctitle_impl, LIBBSD_0.5);
|
||||
* in 0.5, make the implementation available in the old version as an alias
|
||||
* for code linking against that version, and change the default to use the
|
||||
* new version, so that new code depends on the implemented version. */
|
||||
-#ifdef HAVE_TYPEOF
|
||||
+#ifdef __MACH__
|
||||
+void setproctitle_stub(const char *fmt, ...);
|
||||
+#elif HAVE_TYPEOF
|
||||
extern typeof(setproctitle_impl) setproctitle_stub __attribute__((alias("setproctitle_impl")));
|
||||
#else
|
||||
void setproctitle_stub(const char *fmt, ...)
|
||||
__attribute__((alias("setproctitle_impl")));
|
||||
#endif
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver setproctitle_stub,setproctitle@LIBBSD_0.2");
|
||||
+#endif
|
||||
+#elif defined(HAVE_TYPEOF)
|
||||
extern __typeof__(setproctitle_impl)
|
||||
setproctitle_stub
|
||||
__attribute__((__alias__("setproctitle_impl")));
|
||||
diff --git a/src/strlcat.c b/src/strlcat.c
|
||||
index 14c53a1..5961c17 100644
|
||||
--- a/src/strlcat.c
|
||||
@ -316,46 +455,3 @@ index e6afde5..da680c9 100644
|
||||
*p = '\0';
|
||||
}
|
||||
+#endif
|
||||
diff --git a/src/unvis.c b/src/unvis.c
|
||||
index 94e3e7a..fba4c66 100644
|
||||
--- a/src/unvis.c
|
||||
+++ b/src/unvis.c
|
||||
@@ -565,11 +565,15 @@ strnunvis_openbsd(char *dst, const char *src, size_t dlen)
|
||||
{
|
||||
return strnunvisx(dst, dlen, src, 0);
|
||||
}
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver strnunvis_openbsd,strnunvis@@LIBBSD_0.2");
|
||||
+#endif
|
||||
|
||||
int
|
||||
strnunvis_netbsd(char *dst, size_t dlen, const char *src)
|
||||
{
|
||||
return strnunvisx(dst, dlen, src, 0);
|
||||
}
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver strnunvis_netbsd,strnunvis@LIBBSD_0.9.1");
|
||||
+#endif
|
||||
diff --git a/src/vis.c b/src/vis.c
|
||||
index c2cd2d8..2d84330 100644
|
||||
--- a/src/vis.c
|
||||
+++ b/src/vis.c
|
||||
@@ -723,14 +723,18 @@ strnvis_openbsd(char *mbdst, const char *mbsrc, size_t dlen, int flags)
|
||||
{
|
||||
return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
|
||||
}
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver strnvis_openbsd,strnvis@@LIBBSD_0.2");
|
||||
+#endif
|
||||
|
||||
int
|
||||
strnvis_netbsd(char *mbdst, size_t dlen, const char *mbsrc, int flags)
|
||||
{
|
||||
return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
|
||||
}
|
||||
+#ifndef __MACH__
|
||||
__asm__(".symver strnvis_netbsd,strnvis@LIBBSD_0.9.1");
|
||||
+#endif
|
||||
|
||||
int
|
||||
stravis(char **mbdstp, const char *mbsrc, int flags)
|
||||
|
@ -2,20 +2,18 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libbsd";
|
||||
version = "0.9.1";
|
||||
version = "0.10.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://libbsd.freedesktop.org/releases/${pname}-${version}.tar.xz";
|
||||
sha256 = "1957w2wi7iqar978qlfsm220dwywnrh5m58nrnn9zmi74ds3bn2n";
|
||||
sha256 = "11x8q45jvjvf2dvgclds64mscyg10lva33qinf2hwgc84v3svf1l";
|
||||
};
|
||||
|
||||
# darwin changes configure.ac which means we need to regenerate
|
||||
# the configure scripts
|
||||
nativeBuildInputs = [ autoreconfHook ];
|
||||
|
||||
patches = stdenv.lib.optional stdenv.isDarwin ./darwin.patch
|
||||
# Suitable for all but limited to musl to avoid rebuild
|
||||
++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl.patch;
|
||||
patches = [ ./darwin.patch ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Common functions found on BSD systems";
|
||||
|
@ -1,14 +0,0 @@
|
||||
Source: maxice8
|
||||
Upstream: no
|
||||
Reason: fixes compilation
|
||||
|
||||
--- a/src/flopen.c
|
||||
+++ b/src/flopen.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#include <libutil.h>
|
||||
|
Loading…
Reference in New Issue
Block a user