lol

gnutar: patch to build on darwin

+118 -1
+4 -1
pkgs/tools/archivers/gnutar/default.nix
··· 1 - { stdenv, fetchurl }: 1 + { stdenv, fetchurl, autoreconfHook }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 name = "gnutar-${version}"; ··· 8 8 url = "mirror://gnu/tar/tar-${version}.tar.bz2"; 9 9 sha256 = "0qkm2k9w8z91hwj8rffpjj9v1vhpiriwz4cdj36k9vrgc3hbzr30"; 10 10 }; 11 + 12 + patches = stdenv.lib.optional stdenv.isDarwin ./gnutar-1.28-darwin.patch; 13 + buildInputs = stdenv.lib.optional stdenv.isDarwin autoreconfHook; 11 14 12 15 # May have some issues with root compilation because the bootstrap tool 13 16 # cannot be used as a login shell for now.
+114
pkgs/tools/archivers/gnutar/gnutar-1.28-darwin.patch
··· 1 + >From 7d1d3d38cb66b02c062de77847e3c0ecd842366c Mon Sep 17 00:00:00 2001 2 + From: Pavel Raiskup <address@hidden> 3 + Date: Mon, 4 Aug 2014 13:19:49 +0200 4 + Subject: [PATCH] xattrs: fix bug in configure 5 + 6 + Be careful to define HAVE_XATTRS when not all needed xattr-related 7 + functions are properly defined either in libc or libattr. 8 + 9 + Reported independently by Denis Excoffier and Dominyk Tille. 10 + 11 + * acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Check for each xattr 12 + function separately. Don't AC_CHECK_LIB (LIBS is filled by 13 + AC_SEARCH_LIBS when necessary). 14 + * lib/xattr-at.c: Do not build when HAVE_XATTRS is not defined. 15 + * src/Makefile.am: The LDADD -lattr was redundant. 16 + --- 17 + acinclude.m4 | 42 ++++++++++++++---------------------------- 18 + lib/xattr-at.c | 7 +++++++ 19 + src/Makefile.am | 4 ---- 20 + 3 files changed, 21 insertions(+), 32 deletions(-) 21 + 22 + diff --git a/acinclude.m4 b/acinclude.m4 23 + index 3b28b3b..db0bbc7 100644 24 + --- a/acinclude.m4 25 + +++ b/acinclude.m4 26 + @@ -40,37 +40,23 @@ AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H], 27 + # First check for <sys/xattr.h> 28 + AC_CHECK_HEADERS([sys/xattr.h]) 29 + AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_sys_xattr_h" = yes]) 30 + - AM_CONDITIONAL([TAR_LIB_ATTR],[false]) 31 + - if test "$ac_cv_header_sys_xattr_h" = yes; then 32 + - AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \ 33 + - setxattr fsetxattr lsetxattr \ 34 + - listxattr flistxattr llistxattr, 35 + - # only when functions are present 36 + - AC_DEFINE([HAVE_SYS_XATTR_H], [1], 37 + - [define to 1 if we have <sys/xattr.h> header]) 38 + - if test "$with_xattrs" != no; then 39 + - AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) 40 + - fi 41 + - ) 42 + - fi 43 + - 44 + - # If <sys/xattr.h> is not found, then check for <attr/xattr.h> 45 + if test "$ac_cv_header_sys_xattr_h" != yes; then 46 + AC_CHECK_HEADERS([attr/xattr.h]) 47 + AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes]) 48 + - AC_CHECK_LIB([attr],[fgetxattr]) 49 + - AM_CONDITIONAL([TAR_LIB_ATTR],[test "$ac_cv_lib_attr_fgetxattr" = yes]) 50 + - if test "$ac_cv_header_attr_xattr_h" = yes; then 51 + - AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \ 52 + - setxattr fsetxattr lsetxattr \ 53 + - listxattr flistxattr llistxattr, 54 + - # only when functions are present 55 + - AC_DEFINE([HAVE_ATTR_XATTR_H], [1], 56 + - [define to 1 if we have <attr/xattr.h> header]) 57 + - if test "$with_xattrs" != no; then 58 + - AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) 59 + - fi 60 + - ) 61 + + fi 62 + + 63 + + if test "$with_xattrs" != no; then 64 + + for i in getxattr fgetxattr lgetxattr \ 65 + + setxattr fsetxattr lsetxattr \ 66 + + listxattr flistxattr llistxattr 67 + + do 68 + + AC_SEARCH_LIBS($i, attr) 69 + + eval found=\$ac_cv_search_$i 70 + + test "$found" = "no" && break 71 + + done 72 + + 73 + + if test "$found" != no; then 74 + + AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) 75 + fi 76 + fi 77 + ]) 78 + diff --git a/lib/xattr-at.c b/lib/xattr-at.c 79 + index 443ccae..009bde5 100644 80 + --- a/lib/xattr-at.c 81 + +++ b/lib/xattr-at.c 82 + @@ -18,6 +18,11 @@ 83 + 84 + #include <config.h> 85 + 86 + +/* Temporarily don't build. We are unable to build on (probably not only) 87 + + darwin due to lack of l*xattr callbacks (XATTR_NOFOLLOW is alternative) and 88 + + different function definitions. */ 89 + +#ifdef HAVE_XATTRS 90 + + 91 + #include "xattr-at.h" 92 + #include "openat.h" 93 + 94 + @@ -108,3 +113,5 @@ 95 + #undef AT_FUNC_RESULT 96 + #undef AT_FUNC_POST_FILE_PARAM_DECLS 97 + #undef AT_FUNC_POST_FILE_ARGS 98 + + 99 + +#endif 100 + diff --git a/src/Makefile.am b/src/Makefile.am 101 + index 82b2d46..42daaef 100644 102 + --- a/src/Makefile.am 103 + +++ b/src/Makefile.am 104 + @@ -52,7 +52,3 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) 105 + LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV) 106 + 107 + tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX) 108 + - 109 + -if TAR_LIB_ATTR 110 + -tar_LDADD += -lattr 111 + -endif 112 + -- 113 + 1.9.3 114 +