aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralpine-mips-patches <info@mobile-stream.com>2018-11-17 20:29:33 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2019-01-04 10:23:08 +0000
commitb0c083a319da3cd9268c630b9b4b662e1d01b5c5 (patch)
tree5e7ab7532786108b3c0a6f31fd92327b7efdb250
parent64a969f0cd8a0df31772a84d6b0d9f264c4a337e (diff)
main/xfsprogs: fix build on mips* and ppc64le
musl-1.1.20 implements support (or lack thereof) for the MAP_SYNC flag by #define'ing it uncoditionally in generic <sys/mman.h> then #undef'ining optionally in arch-specific <bits/mman.h> (e.g. for mips* and powerpc*). So io/mmap.c fails to compile since it includes <sys/mman.h> (which undefines MAP_SYNC on mips* and powerpc*) after "linux.h" (which either defines fallback MAP_SYNC values or pulls <asm-generic/mman{-common.h}>). The proposes patch also fixes the flawed MAP_SYNC detection logic in the configure script because io/mmap.c always uses the MAP_SYNC definition (either real one or zero fallback). Otherwise xfsprogs wrongly detects the MAP_SYNC presence on mips* and ppc64le and the code does not define MAP_SYNC fallback so io/mmap.c still fails to compile. Note the last (2018-07-11) successful xfsprogs build for ppc64le was against musl-1.1.19 (without any support for MAP_SYNC). The problem with MAP_SYNC detection is as follows. The configure script checks only <asm-generic/mman{-common}.h> headers for the MAP_SYNC definition instead of using the arch-specific <asm/mman.h>. But some architectures (mips, powerpc, parisc) do not support the MAP_SYNC feature at all, do not use the <asm-generic/mman{-common.h}> files and do not define the flag in the corresponding <asm/mman.h> header.
-rw-r--r--main/xfsprogs/APKBUILD6
-rw-r--r--main/xfsprogs/musl-MAP_SYNC-fix.patch53
2 files changed, 57 insertions, 2 deletions
diff --git a/main/xfsprogs/APKBUILD b/main/xfsprogs/APKBUILD
index 4cf39e8f36b..3ca33f33187 100644
--- a/main/xfsprogs/APKBUILD
+++ b/main/xfsprogs/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xfsprogs
pkgver=4.19.0
-pkgrel=0
+pkgrel=1
pkgdesc="XFS filesystem utilities"
url="http://xfs.org/index.php/Main_Page"
arch="all"
@@ -12,6 +12,7 @@ options="!check" # no test suite
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-extra"
source="https://www.kernel.org/pub/linux/utils/fs/xfs/$pkgname/$pkgname-$pkgver.tar.gz
fix-mmap.patch
+ musl-MAP_SYNC-fix.patch
"
builddir="$srcdir/$pkgname-$pkgver"
@@ -51,4 +52,5 @@ extra() {
}
sha512sums="48ffcdb60a3bd332d5a5837824eb629759ec2d9015b94ac7ee7eef1dab507b2663f3223efc7885cbbe6ef6d721521953d32327688abd7d01f00c66ac5f5c9d29 xfsprogs-4.19.0.tar.gz
-080161b211e20277e44f714961b36064536bb5cce72a6f93fef4996e296a3953d33c1a066ef371ccd5551622357105f9be9086ef917386f5d43f6a211b0bd7c9 fix-mmap.patch"
+080161b211e20277e44f714961b36064536bb5cce72a6f93fef4996e296a3953d33c1a066ef371ccd5551622357105f9be9086ef917386f5d43f6a211b0bd7c9 fix-mmap.patch
+bc7971207a296d8112f8993f6a266533135aae59a4438bb511f472931c37b8ce3033c597d67abbd3664f4405317aeb049e747c1811c9495c1a24d98935f799cc musl-MAP_SYNC-fix.patch"
diff --git a/main/xfsprogs/musl-MAP_SYNC-fix.patch b/main/xfsprogs/musl-MAP_SYNC-fix.patch
new file mode 100644
index 00000000000..09e41ca26f9
--- /dev/null
+++ b/main/xfsprogs/musl-MAP_SYNC-fix.patch
@@ -0,0 +1,53 @@
+--- a/configure
++++ b/configure
+@@ -14507,8 +14507,7 @@
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+-#include <asm-generic/mman.h>
+-#include <asm-generic/mman-common.h>
++#include <asm/mman.h>
+
+ int
+ main ()
+--- a/include/linux.h
++++ b/include/linux.h
+@@ -327,12 +327,4 @@
+ #define HAVE_GETFSMAP
+ #endif /* HAVE_GETFSMAP */
+
+-#ifndef HAVE_MAP_SYNC
+-#define MAP_SYNC 0
+-#define MAP_SHARED_VALIDATE 0
+-#else
+-#include <asm-generic/mman.h>
+-#include <asm-generic/mman-common.h>
+-#endif /* HAVE_MAP_SYNC */
+-
+ #endif /* __XFS_LINUX_H__ */
+--- a/io/mmap.c
++++ b/io/mmap.c
+@@ -23,6 +23,11 @@
+ #include "init.h"
+ #include "io.h"
+
++#ifndef HAVE_MAP_SYNC
++#define MAP_SYNC 0
++#define MAP_SHARED_VALIDATE 0
++#endif
++
+ static cmdinfo_t mmap_cmd;
+ static cmdinfo_t mread_cmd;
+ static cmdinfo_t msync_cmd;
+--- a/m4/package_libcdev.m4
++++ b/m4/package_libcdev.m4
+@@ -335,8 +335,7 @@
+ AC_DEFUN([AC_HAVE_MAP_SYNC],
+ [ AC_MSG_CHECKING([for MAP_SYNC])
+ AC_TRY_COMPILE([
+-#include <asm-generic/mman.h>
+-#include <asm-generic/mman-common.h>
++#include <asm/mman.h>
+ ], [
+ int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+ ], have_map_sync=yes