Adapt to attr-2.4.48

This commit is contained in:
Petr Písař 2018-07-10 13:31:08 +02:00
parent 31134ab981
commit 442a36e306
2 changed files with 99 additions and 2 deletions

View File

@ -0,0 +1,88 @@
From ac53807938f9a2e43401ab5b1b1c7f4dd80ac620 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <petr.pisar@atlas.cz>
Date: Fri, 6 Jul 2018 20:53:54 +0200
Subject: [PATCH] Prefer fgetxattr() from <sys/xattr.h>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
attr-2.4.48 removed <attr/xattr.h> and everybody should use glibc's
<sys/xattr.h> now.
This patch changes configure to check for both of the headers and to
prefer <sys/xattr.h>.
Signed-off-by: Petr Písař <petr.pisar@atlas.cz>
---
INSTALL | 5 +++--
configure.ac | 16 ++++++++++++++--
src/io.c | 4 ++++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/INSTALL b/INSTALL
index 8528e74..80e9214 100644
--- a/INSTALL
+++ b/INSTALL
@@ -29,8 +29,9 @@ Additional configure options:
--disable-xattr
- Switch off extended attributes support. (Shigofumi can stores and load
- MIME types there.) Support is autodetected by default.
+ Switch off extended attributes support. (Shigofumi can store and load
+ MIME types there.) Support is autodetected by default. You need glibc
+ >= 2.3 or attr library for this feature.
--with-docbook-xsl-stylesheets=DIR
diff --git a/configure.ac b/configure.ac
index a875838..aa42aeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,12 +117,24 @@ AM_CONDITIONAL([BUILD_MANPO], [test "$HAVE_PO4A" = "yes"])
# Check for extended attributes
# XXX: AC_CHECK_HEADER() must be in top level scope
-AC_CHECK_HEADER([attr/xattr.h], [have_xattr=yes], [have_xattr=no])
+AC_CHECK_HEADER([sys/xattr.h],
+ [AC_DEFINE([HAVE_SYS_XATTR], [1], [Define if sys/xattr.h is available])
+ have_sys_xattr=yes],
+ [have_sys_xattr=no],
+ [#include <sys/types.h>
+ #include <sys/xattr.h>]
+)
+AC_CHECK_HEADER([attr/xattr.h],
+ [have_attr_xattr=yes],
+ [have_attr_xattr=no],
+ [#include <sys/types.h>
+ #include <attr/xattr.h>]
+)
AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
[Disable extended attribute support])])
AS_IF([test "$enable_xattr" = "no"],
AC_MSG_WARN([Extended attribute support disabled]),
- AS_IF([test "$have_xattr" = "yes"],
+ AS_IF([test "$have_sys_xattr" = "yes" -o "$have_attr_xattr" = "yes"],
AC_DEFINE([ENABLE_XATTR], [1],
[Define if you want support extended attributes]),
AS_IF([test "$enable_xattr" = "yes"],
diff --git a/src/io.c b/src/io.c
index 343f897..d2d7988 100644
--- a/src/io.c
+++ b/src/io.c
@@ -20,8 +20,12 @@
#include "shigofumi.h"
#if ENABLE_XATTR
+#if HAVE_SYS_XATTR
+#include <sys/xattr.h>
+#else
#include <attr/xattr.h>
#endif
+#endif
/* Guess MIME type of @file by content.
--
2.14.4

View File

@ -1,6 +1,6 @@
Name: shigofumi
Version: 0.8
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Command line client for accessing the Czech Data Boxes
# COPYING: GPLv3 text
# README: GPLv3+
@ -37,9 +37,13 @@ Summary: Command line client for accessing the Czech Data Boxes
License: GPLv3+ and GPLv2+
URL: http://xpisar.wz.cz/%{name}/
Source0: %{url}dist/%{name}-%{version}.tar.xz
# Adapt to attr-2.4.48, in upstream after 0.8
Patch0: shigofumi-0.8-Prefer-fgetxattr-from-sys-xattr.h.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: file-devel
BuildRequires: gettext-devel
BuildRequires: gcc
BuildRequires: libattr-devel
BuildRequires: libxml2-devel
BuildRequires: make
BuildRequires: pkgconfig(libconfuse)
@ -52,6 +56,8 @@ Information System) client.
%prep
%setup -q
%patch0 -p1
autoreconf -fi
%build
%configure \
@ -78,6 +84,9 @@ make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT
%{_mandir}/*/man5/*
%changelog
* Tue Jul 10 2018 Petr Pisar <ppisar@redhat.com> - 0.8-7
- Adapt to attr-2.4.48
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild