btrfs-progs: build on SLE11
Subsystems (2)
cover btrfs-progs: build on SLE11
From: Jeff Mahoney <[email protected]>
This patch set allows btrfs-progs to build without further patching on a stock SLE11 SP4 install. The major issues were:
- new dependencies on e2fsprogs 1.42
- use of -std=gnu90, which gcc 4.3.4 doesn't support
- use of m4_chomp, introduced in autoconf 2.64.
This patch set is also posted as a GitHub pull request:
https://github.com/kdave/btrfs-progs/pull/125
-Jeff
---
Jeff Mahoney (3):
btrfs-progs: convert: fix support for e2fsprogs < 1.42
btrfs-progs: build: detect whether -std=gnu90 is supported
btrfs-progs: build: use m4_flatten instead of m4_chomp
Makefile | 1 - Makefile.inc.in | 1 + configure.ac | 10 +++--- convert/source-ext2.h | 12 +++++++- m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 m4/ax_check_compile_flag.m4
Signature · 1 line
2.12.3
PATCH 1/3 btrfs-progs: convert: fix support for e2fsprogs < 1.42
From: Jeff Mahoney <[email protected]>
Commit 324d4c1857a (btrfs-progs: convert: Add larger device support) introduced new dependencies on the 64-bit API provided by e2fsprogs. That API was introduced in v1.42 (along with bigalloc).
This patch maps the following to their equivalents in e2fsprogs < 1.42.
- ext2fs_get_block_bitmap_range2
- ext2fs_inode_data_blocks2
- ext2fs_read_ext_attr2
Since we need to detect and define EXT2_FLAG_64BITS for compatibilty anyway, it makes sense to use that to detect the older e2fsprogs instead of defining a new flag ourselves.
--- configure.ac | 6 +----- convert/source-ext2.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-)
configure.ac +1 -5
@@ -140,11 +140,7 @@ BTRFSCONVERT_EXT2=0 BTRFSCONVERT_REISERFS=0 if test "x$enable_convert" = xyes; then if test "x$with_convert" = "xauto" || echo "$with_convert" | grep -q "ext2"; then - PKG_CHECK_MODULES(EXT2FS, [ext2fs >= 1.42],, - [PKG_CHECK_MODULES(EXT2FS, [ext2fs], - [AC_DEFINE([HAVE_OLD_E2FSPROGS], [1], - [E2fsprogs does not support BIGALLOC])] - )]) + PKG_CHECK_MODULES(EXT2FS, [ext2fs]) PKG_CHECK_MODULES(COM_ERR, [com_err]) convertfs="${convertfs:+$convertfs,}ext2" BTRFSCONVERT_EXT2=1
convert/source-ext2.h +11 -1
@@ -33,8 +33,18 @@* BIGALLOC. * Unlike normal RO compat flag, BIGALLOC affects how e2fsprogs check used * space, and btrfs-convert heavily relies on it. +* +* e2fsprogs 1.42 also introduced the 64-bit API. Any file system +* that requires it will have EXT4_FEATURE_INCOMPAT_64BIT set and +* will fail to open with earlier releases. We can map it to the +* older API without risk of corruption. */ -#ifdef HAVE_OLD_E2FSPROGS +#ifndef EXT2_FLAG_64BITS +#define EXT2_FLAG_64BITS (0) +#define ext2fs_get_block_bitmap_range2 ext2fs_get_block_bitmap_range +#define ext2fs_inode_data_blocks2 ext2fs_inode_data_blocks +#define ext2fs_read_ext_attr2 ext2fs_read_ext_attr +#define ext2fs_blocks_count (s) ((s)->s_blocks_count)#define EXT2FS_CLUSTER_RATIO (fs) (1)#define EXT2_CLUSTERS_PER_GROUP (s) (EXT2_BLOCKS_PER_GROUP(s))#define EXT2FS_B2C (fs, blk) (blk)
Signature · 1 line
2.12.3
PATCH 2/3 btrfs-progs: build: detect whether -std=gnu90 is supported
In reply to [email protected]From: Jeff Mahoney <[email protected]>
Older versions of gcc don't support -std=gnu90 so btrfs-progs won't build at all on older distros. We can detect whether the compiler supports -std=gnu90 and fall back to -std=gnu89 if it doesn't.
--- Makefile | 1 - Makefile.inc.in | 1 + configure.ac | 2 ++ m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 m4/ax_check_compile_flag.m4
Makefile +0 -1
@@ -63,7 +63,6 @@ ABSTOPDIR = $(shell pwd) TOPDIR := . # Common build flags -CSTD = -std=gnu90 CFLAGS = $(SUBST_CFLAGS) \ $(CSTD) \ -include config.h \
Makefile.inc.in +1 -0
@@ -4,6 +4,7 @@ export CC = @CC@ +CSTD = @CSTD@ LN_S = @LN_S@ AR = @AR@ RM = @RM@
configure.ac +2 -0
@@ -30,6 +30,8 @@ AC_CANONICAL_HOST AC_C_CONST AC_C_VOLATILE AC_C_BIGENDIAN +AX_CHECK_COMPILE_FLAG([-std=gnu90],[CSTD=-std=gnu90],[CSTD=-std=gnu89]) +AC_SUBST([CSTD]) AC_SYS_LARGEFILE
m4/ax_check_compile_flag.m4 new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.12.3
PATCH 3/3 btrfs-progs: build: use m4_flatten instead of m4_chomp
In reply to [email protected]From: Jeff Mahoney <[email protected]>
Commit 2e1932e6a38 (btrfs-progs: build: simplify version tracking) started m4_chomp to strip the newlines from the version file. m4_chomp was introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63. For purposes of just stripping the newline, m4_flatten is sufficient.
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -1,5 +1,5 @@ AC_INIT([btrfs-progs], - m4_chomp(m4_include([VERSION])), + m4_flatten(m4_include([VERSION])), [[email protected]],, [http://btrfs.wiki.kernel.org])
Signature · 1 line
2.12.3
Re: [PATCH 3/3] btrfs-progs: build: use m4_flatten instead of m4_chomp
Quoted 6 lines · On 4/27/18 2:56 PM, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
Commit
2e1932e6a38(btrfs-progs: build: simplify version tracking) startedm4_chompto strip the newlines from the version file.m4_chompwas introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63. For purposes of just stripping the newline,m4_flattenis sufficient.
Scratch that. The previous patch also requires autoconf 2.64.
-Jeff
Quoted 17 lines
Signed-off-by Jeff Mahoney <[email protected]>--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure.ac +1
-1@@ -1,5 +1,5 @@ AC_INIT([btrfs-progs], - m4_chomp(m4_include([VERSION])), + m4_flatten(m4_include([VERSION])), [[email protected]],, [http://btrfs.wiki.kernel.org])
Signature · 2 lines
Jeff Mahoney SUSE Labs
Re: [PATCH 3/3] btrfs-progs: build: use m4_flatten instead of m4_chomp
Quoted 9 lines · Jeff Mahoney
Quoted 6 lines · On 4/27/18 2:56 PM, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
Commit
2e1932e6a38(btrfs-progs: build: simplify version tracking) startedm4_chompto strip the newlines from the version file.m4_chompwas introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63. For purposes of just stripping the newline,m4_flattenis sufficient.Scratch that. The previous patch also requires autoconf 2.64.
I wanted to avoid shell tricks, but this should work everywhere:
m4_esyscmd([echo -n $(cat VERSION)])
Re: [PATCH 3/3] btrfs-progs: build: use m4_flatten instead of m4_chomp
Quoted 9 lines · David Sterba
Quoted 8 lines · Jeff Mahoney
Quoted 6 lines · On 4/27/18 2:56 PM, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
Commit
2e1932e6a38(btrfs-progs: build: simplify version tracking) startedm4_chompto strip the newlines from the version file.m4_chompwas introduced in autoconf 2.64 but SLE11 ships with autoconf 2.63. For purposes of just stripping the newline,m4_flattenis sufficient.
Quoted 6 lines
Quoted 1 line
Scratch that. The previous patch also requires autoconf 2.64.
I wanted to avoid shell tricks, but this should work everywhere:
m4_esyscmd([echo -n $(cat VERSION)])
m4_flatten should work everywhere. It's the AX_CHECK_COMPILE_FLAGS that depends on autoconf 2.64.
I can fix the dependency, but it ends up looking like:
m4_version_prereq([2.64], [
AX_CHECK_COMPILE_FLAG([-std=gnu90],[CSTD=-std=gnu90],[CSTD=-std=gnu89])
], [
AX_GCC_VERSION([4], [5], [0], [CSTD=-std=gnu90],[CSTD=-std=gnu89]) ])AC_SUBST([CSTD])
AX_GCC_VERSION is deprecated, but works with earlier autoconf versions. I'm not thrilled about it, but keying off the autoconf version and using the newer way for newer versions means it'll be easier to drop it later when we drop support for earlier autoconf.
Alternatively, I can just put this patch in the OBS project.
-Jeff
Signature · 2 lines
Jeff Mahoney SUSE Labs