btrfs-prog: improve build-system by autoconf
Subsystems (2)
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
The Makefile targets and rules are no changed, things like V=1 (verbose), C=1 (sparse) static builds, etc. still work as expected. All the changes are mostly about $LIBS, $CFLAGS and proper libraries (uuid, blkid, lzo2, ..) detection.
Note that there is also strange unused btrfs_convert_libs, btrfs_image_libs and btrfs_fragments_libs variables with things like "-lgd -lpng -ljpeg -lfreetype". I guess it's some legacy, right? I didn't touch these variables as I have no clue about sense of this stuff.
[PATCH 01/10] btrfs-progs: add ./configure script [PATCH 02/10] btrfs-progs: use config.h
[PATCH 03/10] btrfs-progs: use standard PACKAGE_* macros [PATCH 04/10] btrfs-progs: use ./configure to generate version.h [PATCH 05/10] btrfs-progs: check for build programs in ./configure [PATCH 06/10] btrfs-progs: use paths and $*_LIBS from ./configure [PATCH 07/10] btrfs-progs: cleanup compilation flags usage [PATCH 08/10] btrfs-progs: clean generated files, make version.h [PATCH 09/10] btrfs-progs: add --disable-backtrace [PATCH 10/10] btrfs-progs: add --disable-documentation
The next possible step is automake, but I'd like merge ./configure stuff first.
Karel
PATCH 1/10 btrfs-progs: add ./configure script
Add ./autogen.sh script, you have to use it after "git clone/clean" to generate ./configure from configure.ac.
Modify version.sh to be usable from the configure script.
The patch also renames Makefile to Makefile.in, but does NOT change anything in the file.
--- .gitignore | 28 ++++++ Makefile | 87 +++++++++-------- Makefile.in | 314 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ autogen.sh | 58 +++++++++++ configure.ac | 102 +++++++++++++++++++ version.sh | 7 ++ 6 files changed, 557 insertions(+), 39 deletions(-) create mode 100644 Makefile.in create mode 100755 autogen.sh create mode 100644 configure.ac mode change 100644 => 100755 version.sh
.gitignore +28 -0
@@ -39,3 +39,31 @@ libbtrfs.so.0 libbtrfs.so.0.1 library-test library-test-static + + +aclocal.m4 +autom4te.cache +compile +config.cache +config.guess +config.h +config.h.in +config.log +config.rpath +config.status +config.sub +config/ltmain.sh +config/py-compile +config/test-driver +configure +cscope.out +depcomp +install-sh +libtool +m4/*.m4 +Makefile +missing +mkinstalldirs +stamp-h +stamp-h.in +stamp-h1
Makefile +48 -39
190 lines not on this page · raw message
Makefile.in new file +314 -0
314 lines not on this page · raw message
autogen.sh new file +58 -0
58 lines not on this page · raw message
configure.ac new file +102 -0
102 lines not on this page · raw message
version.sh +7 -0
@@ -8,6 +8,7 @@ v="v3.17.3" +opt=$1 lib_major=0 lib_minor=1 lib_patchlevel=1
@@ -28,6 +29,12 @@ if [ $? == 0 -a -d .git ]; then fi fi +if [ "$opt" = "--configure" ]; then + # Omit the trailing newline, so that m4_esyscmd can use the result directly. + echo "$v" | tr -d '\n' + exit 0 +fi + echo "/* NOTE: this file is autogenerated by version.sh, do not edit */" > .build-version.h echo "#ifndef __BUILD_VERSION" >> .build-version.h echo >> .build-version.h
Signature · 1 line
1.9.3
PATCH 2/10 btrfs-progs: use config.h
In reply to Karel Zak- the header file is generated by ./configure, the standard autotools way is to use -include config.h on compiler command line rather than include the file directly from code
- remove _GNU_SOURCE from code, the macros is already defined in config.h by AC_USE_SYSTEM_EXTENSIONS autoconf macro
--- Makefile.in | 4 +++- btrfs-calc-size.c | 1 - btrfs-convert.c | 1 - btrfs-corrupt-block.c | 2 +- btrfs-find-root.c | 2 +- btrfs-fragments.c | 1 - btrfs-image.c | 2 +- btrfs-list.c | 1 - btrfs-map-logical.c | 2 +- btrfs-select-super.c | 2 +- btrfs-show-super.c | 2 +- btrfs-zero-log.c | 2 +- btrfs.c | 1 - btrfstune.c | 2 +- chunk-recover.c | 1 - cmds-check.c | 2 +- cmds-receive.c | 1 - cmds-restore.c | 1 - cmds-send.c | 2 -- disk-io.c | 2 +- mkfs.c | 1 - send-test.c | 2 -- super-recover.c | 1 - utils-lib.c | 2 -- utils.c | 2 +- 25 files changed, 14 insertions(+), 28 deletions(-)
Makefile.in +3 -1
@@ -4,7 +4,9 @@ export CC = gcc LN = ln AR = ar -AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES -fno-strict-aliasing -fPIC +AM_CFLAGS = -include config.h -Wall \ + -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES \ + -fno-strict-aliasing -fPIC CFLAGS = -g -O1 -fno-strict-aliasing -rdynamic objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
btrfs-calc-size.c +0 -1
@@ -17,7 +17,6 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1#include <ctype.h> #include <stdio.h> #include <stdlib.h>
btrfs-convert.c +0 -1
@@ -17,7 +17,6 @@*/ #define _XOPEN_SOURCE 600 -#define _GNU_SOURCE 1#include "kerncompat.h"
btrfs-corrupt-block.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <fcntl.h>
btrfs-find-root.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <unistd.h>
btrfs-fragments.c +0 -1
@@ -14,7 +14,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <string.h>
btrfs-image.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <pthread.h> #include <stdio.h> #include <stdlib.h>
btrfs-list.c +0 -1
@@ -16,7 +16,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE#include <sys/ioctl.h> #include <sys/mount.h> #include "ioctl.h"
btrfs-map-logical.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <fcntl.h>
btrfs-select-super.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <unistd.h>
btrfs-show-super.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <unistd.h>
btrfs-zero-log.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <unistd.h>
btrfs.c +0 -1
@@ -14,7 +14,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <string.h>
btrfstune.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <sys/types.h>
chunk-recover.c +0 -1
@@ -16,7 +16,6 @@* Boston, MA 021110-1307, USA. */ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE#include <stdio.h> #include <stdio_ext.h>
cmds-check.c +1 -1
@@ -17,7 +17,7 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <unistd.h>
cmds-receive.c +0 -1
@@ -16,7 +16,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE#define _POSIX_C_SOURCE 200809#define _XOPEN_SOURCE 700#define _BSD_SOURCE
cmds-restore.c +0 -1
@@ -17,7 +17,6 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1#include "kerncompat.h"
cmds-send.c +0 -2
@@ -16,8 +16,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE -#include "kerncompat.h" #include <unistd.h>
disk-io.c +1 -1
@@ -18,7 +18,7 @@#define _XOPEN_SOURCE 600#define __USE_XOPEN2K -#define _GNU_SOURCE 1 +#include <stdio.h> #include <stdlib.h> #include <sys/types.h>
mkfs.c +0 -1
@@ -17,7 +17,6 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE#include "kerncompat.h"
send-test.c +0 -2
@@ -21,8 +21,6 @@* Boston, MA 021110-1307, USA. */ -#define _GNU_SOURCE -#include <unistd.h> #include <stdint.h> #include <dirent.h>
super-recover.c +0 -1
@@ -17,7 +17,6 @@*/ #define _XOPEN_SOURCE 500 -#define _GNU_SOURCE 1#include <stdio.h> #include <stdlib.h>
utils-lib.c +0 -2
@@ -1,5 +1,3 @@ -#define _GNU_SOURCE -#include "kerncompat.h" #include <unistd.h> #include <stdlib.h>
utils.c +1 -1
@@ -20,7 +20,7 @@#define _XOPEN_SOURCE 700#define __USE_XOPEN2K8#define __XOPEN2K8/* due to an error in dirent.h, to get dirfd() */ -#define _GNU_SOURCE/* O_NOATIME */ +#include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 1 line
1.9.3
PATCH 3/10 btrfs-progs: use standard PACKAGE_* macros
In reply to Karel Zak- use standard PACKAGE_{NAME,VERSION,STRING,URL,...} autoconf macros rather than homemade BTRFS_BUILD_VERSION
- don't #include version.h, now the file is necessary for library API only
Note that "btrfs version" returns "btrfs-progs <version>" instead of the original confusing "btrfs <version>".
--- btrfs-calc-size.c | 1 - btrfs-corrupt-block.c | 1 - btrfs-debug-tree.c | 5 ++--- btrfs-find-root.c | 1 - btrfs-image.c | 1 - btrfs-map-logical.c | 1 - btrfs-select-super.c | 3 +-- btrfs-show-super.c | 3 +-- btrfs-zero-log.c | 3 +-- btrfs.c | 3 +-- btrfstune.c | 1 - chunk-recover.c | 1 - cmds-check.c | 3 +-- cmds-filesystem.c | 5 ++--- cmds-restore.c | 1 - library-test.c | 1 - mkfs.c | 9 ++++----- 17 files changed, 13 insertions(+), 30 deletions(-)
btrfs-calc-size.c +0 -1
@@ -32,7 +32,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "volumes.h" #include "utils.h"
btrfs-corrupt-block.c +0 -1
@@ -30,7 +30,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "utils.h" #define FIELD_BUF_LEN 80
btrfs-debug-tree.c +2 -3
@@ -26,7 +26,6 @@#include "disk-io.h" #include "print-tree.h" #include "transaction.h" -#include "version.h" #include "utils.h" static int print_usage (void )
@@ -43,7 +42,7 @@ static int print_usage(void) " only\n");fprintf (stderr,"\t-t tree_id : print only the tree with the given id\n" ); -fprintf (stderr,"%s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"%s\n" ,PACKAGE_STRING );exit (1 ); }
@@ -406,7 +405,7 @@ no_node: uuidbuf[BTRFS_UUID_UNPARSED_SIZE -1 ] ='\0' ;uuid_unparse (info->super_copy->fsid, uuidbuf);printf ("uuid %s\n" , uuidbuf); -printf ("%s\n" ,BTRFS_BUILD_VERSION ); +printf ("%s\n" ,PACKAGE_STRING ); close_root:return close_ctree (root); }
btrfs-find-root.c +0 -1
@@ -30,7 +30,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "volumes.h" #include "utils.h" #include "crc32c.h"
btrfs-image.c +0 -1
@@ -33,7 +33,6 @@#include "disk-io.h" #include "transaction.h" #include "utils.h" -#include "version.h" #include "volumes.h" #include "extent_io.h"
btrfs-map-logical.c +0 -1
@@ -30,7 +30,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "utils.h" /* we write the mirror info to stdout unless they are dumping the data
btrfs-select-super.c +1 -2
@@ -29,13 +29,12 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "utils.h" static void print_usage (void ) {fprintf (stderr,"usage: btrfs-select-super -s number dev\n" ); -fprintf (stderr,"%s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"%s\n" ,PACKAGE_STRING );exit (1 ); }
btrfs-show-super.c +1 -2
@@ -33,7 +33,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "utils.h" #include "crc32c.h"
@@ -51,7 +50,7 @@ static void print_usage(void)fprintf (stderr,"\t-a : print information of all superblocks\n" );fprintf (stderr,"\t-i <super_mirror> : specify which mirror to print out\n" );fprintf (stderr,"\t-F : attempt to dump superblocks with bad magic\n" ); -fprintf (stderr,"%s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"%s\n" ,PACKAGE_STRING ); }int main (int argc,char **argv)
btrfs-zero-log.c +1 -2
@@ -29,14 +29,13 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "utils.h" static void print_usage (void ) __attribute__((noreturn));static void print_usage (void ) {fprintf (stderr,"usage: btrfs-zero-log dev\n" ); -fprintf (stderr,"%s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"%s\n" ,PACKAGE_STRING );exit (1 ); }
btrfs.c +1 -2
@@ -20,7 +20,6 @@#include "crc32c.h" #include "commands.h" -#include "version.h" #include "utils.h" static const char *const btrfs_cmd_group_usage[] = {
@@ -168,7 +167,7 @@ static const char * const cmd_version_usage[] = {static int cmd_version (int argc,char **argv) { -printf ("%s\n" ,BTRFS_BUILD_VERSION ); +printf ("%s\n" ,PACKAGE_STRING );return 0 ; }
btrfstune.c +0 -1
@@ -30,7 +30,6 @@#include "disk-io.h" #include "transaction.h" #include "utils.h" -#include "version.h" static char *device;
chunk-recover.c +0 -1
@@ -37,7 +37,6 @@#include "transaction.h" #include "crc32c.h" #include "utils.h" -#include "version.h" #include "btrfsck.h" #include "commands.h"
cmds-check.c +1 -2
@@ -33,7 +33,6 @@#include "disk-io.h" #include "print-tree.h" #include "transaction.h" -#include "version.h" #include "utils.h" #include "commands.h" #include "free-space-cache.h"
@@ -7986,7 +7985,7 @@ out:printf ("file data blocks allocated: %llu\n referenced %llu\n" , (unsigned long long )data_bytes_allocated, (unsigned long long )data_bytes_referenced); -printf ("%s\n" ,BTRFS_BUILD_VERSION ); +printf ("%s\n" ,PACKAGE_STRING );free_root_recs_tree (&root_cache); close_out:
cmds-filesystem.c +2 -3
@@ -34,7 +34,6 @@#include "ioctl.h" #include "utils.h" #include "volumes.h" -#include "version.h" #include "commands.h" #include "list_sort.h" #include "disk-io.h"
@@ -989,7 +988,7 @@ devs_only:free_fs_devices (fs_devices); } out: -printf ("%s\n" ,BTRFS_BUILD_VERSION ); +printf ("%s\n" ,PACKAGE_STRING );free_seen_fsid ();return ret; }
@@ -1245,7 +1244,7 @@ static int cmd_defrag(int argc, char **argv) } }if (defrag_global_verbose) -printf ("%s\n" ,BTRFS_BUILD_VERSION ); +printf ("%s\n" ,PACKAGE_STRING );if (defrag_global_errors)fprintf (stderr,"total %d failures\n" , defrag_global_errors);
cmds-restore.c +0 -1
@@ -40,7 +40,6 @@#include "print-tree.h" #include "transaction.h" #include "list.h" -#include "version.h" #include "volumes.h" #include "utils.h" #include "commands.h"
library-test.c +0 -1
@@ -17,7 +17,6 @@*/ #include "kerncompat.h" -#include "version.h" #include "send-stream.h" /*
mkfs.c +4 -5
@@ -41,7 +41,6 @@#include "volumes.h" #include "transaction.h" #include "utils.h" -#include "version.h" static u64 index_cnt =2 ;
@@ -289,14 +288,14 @@ static void print_usage(void)fprintf (stderr,"\t -O --features comma separated list of filesystem features\n" );fprintf (stderr,"\t -U --uuid specify the filesystem UUID\n" );fprintf (stderr,"\t -V --version print the mkfs.btrfs version and exit\n" ); -fprintf (stderr,"%s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"%s\n" ,PACKAGE_STRING );exit (1 ); }static void print_version (void ) __attribute__((noreturn));static void print_version (void ) { -fprintf (stderr,"mkfs.btrfs, part of %s\n" ,BTRFS_BUILD_VERSION ); +fprintf (stderr,"mkfs.btrfs, part of %s\n" ,PACKAGE_STRING );exit (0 ); }
@@ -1488,8 +1487,8 @@ int main(int ac, char **av) }/* if we are here that means all devs are good to btrfsify */ -printf ("%s\n" ,BTRFS_BUILD_VERSION ); -printf ("See http://btrfs.wiki.kernel.org for more information.\n\n" ); +printf ("%s\n" ,PACKAGE_STRING ); +printf ("See %s for more information.\n\n" ,PACKAGE_URL ); dev_cnt--;
Signature · 1 line
1.9.3
PATCH 4/10 btrfs-progs: use ./configure to generate version.h
In reply to Karel ZakThe original homemade solution is unnecessary, autotools provides better infrastructure to generate files.
--- Makefile.in | 4 ---- configure.ac | 9 +++++++++ version.h.in | 11 +++++++++++ version.sh | 30 +++--------------------------- 4 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 version.h.in
Makefile.in +0 -4
@@ -154,10 +154,6 @@ test: # static: $(progs_static) -version.h: - @echo " [SH] $@" - $(Q)bash version.sh - $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(lib_LIBS) \
configure.ac +9 -0
@@ -3,6 +3,10 @@ AC_INIT([btrfs-progs], [[email protected]],, [http://btrfs.wiki.kernel.org]) +dnl library version +LIBBTRFS_MAJOR=0 +LIBBTRFS_MINOR=1 +LIBBTRFS_PATCHLEVEL=1 AC_PREREQ([2.60])
@@ -74,11 +78,16 @@ AC_SUBST([LZO2_LIBS_STATIC]) AC_SUBST([LZO2_CFLAGS]) +dnl library stuff +AC_SUBST([LIBBTRFS_MAJOR]) +AC_SUBST([LIBBTRFS_MINOR]) +AC_SUBST([LIBBTRFS_PATCHLEVEL]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile +version.h ]) AC_OUTPUT
version.h.in new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __LIBBTRFS_VERSION_H__ +#define __LIBBTRFS_VERSION_H__ + +#define BTRFS_LIB_MAJOR @LIBBTRFS_MAJOR@ +#define BTRFS_LIB_MINOR @LIBBTRFS_MINOR@ +#define BTRFS_LIB_PATCHLEVEL @LIBBTRFS_PATCHLEVEL@ + +#define BTRFS_LIB_VERSION ( BTRFS_LIB_MAJOR * 10000 + \ + BTRFS_LIB_MINOR * 100 + \ + BTRFS_LIB_PATCHLEVEL ) +#endif
version.sh +3 -27
@@ -9,9 +9,6 @@ v="v3.17.3" opt=$1 -lib_major=0 -lib_minor=1 -lib_patchlevel=1 which git &> /dev/null if [ $? == 0 -a -d .git ]; then
@@ -32,30 +29,9 @@ fi if [ "$opt" = "--configure" ]; then # Omit the trailing newline, so that m4_esyscmd can use the result directly. echo "$v" | tr -d '\n' - exit 0 +else + echo "$v" fi -echo "/* NOTE: this file is autogenerated by version.sh, do not edit */" > .build-version.h -echo "#ifndef __BUILD_VERSION" >> .build-version.h -echo >> .build-version.h -echo "#define __BUILD_VERSION" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_LIB_MAJOR $lib_major" >> .build-version.h -echo "#define BTRFS_LIB_MINOR $lib_minor" >> .build-version.h -echo "#define BTRFS_LIB_PATCHLEVEL $lib_patchlevel" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_LIB_VERSION ( BTRFS_LIB_MAJOR * 10000 + \\" >> .build-version.h -echo " BTRFS_LIB_MINOR * 100 + \\" >> .build-version.h -echo " BTRFS_LIB_PATCHLEVEL )" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h -echo "#endif" >> .build-version.h +exit 0 -diff -q version.h .build-version.h >& /dev/null - -if [ $? == 0 ]; then - rm .build-version.h - exit 0 -fi - -mv .build-version.h version.h
Signature · 1 line
1.9.3
PATCH 5/10 btrfs-progs: check for build programs in ./configure
In reply to Karel Zak--- Makefile.in | 12 ++++++------ configure.ac | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-)
Makefile.in +6 -6
@@ -1,9 +1,9 @@ # Export all variables to sub-makes by default export -CC = gcc -LN = ln -AR = ar +CC = @CC@ +LN_S = @LN_S@ +AR = @AR@ AM_CFLAGS = -include config.h -Wall \ -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES \ -fno-strict-aliasing -fPIC
@@ -25,7 +25,7 @@ libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ extent_io.h ioctl.h ctree.h btrfsck.h version.h TESTS = fsck-tests.sh convert-tests.sh -INSTALL = install +INSTALL = @INSTALL@ prefix ?= /usr/local bindir = $(prefix)/bin lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
@@ -165,8 +165,8 @@ $(libs_static): $(libbtrfs_objects) $(lib_links): @echo " [LN] $@" - $(Q)$(LN) -sf libbtrfs.so.0.1 libbtrfs.so.0 - $(Q)$(LN) -sf libbtrfs.so.0.1 libbtrfs.so + $(Q)$(LN_S) -f libbtrfs.so.0.1 libbtrfs.so.0 + $(Q)$(LN_S) -f libbtrfs.so.0.1 libbtrfs.so # keep intermediate files from the below implicit rules around .PRECIOUS: $(addsuffix .o,$(progs))
configure.ac +2 -0
@@ -27,6 +27,8 @@ AC_C_BIGENDIAN AC_SYS_LARGEFILE AC_PROG_INSTALL +AC_PROG_LN_S +AC_PATH_PROG([AR], [ar]) AC_CHECK_FUNCS([openat], [], [AC_MSG_ERROR([cannot find openat() function])])
Signature · 1 line
1.9.3
PATCH 6/10 btrfs-progs: use paths and $*_LIBS from ./configure
In reply to Karel Zak--- Makefile.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile.in +5 -5
@@ -26,11 +26,11 @@ libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ TESTS = fsck-tests.sh convert-tests.sh INSTALL = @INSTALL@ -prefix ?= /usr/local -bindir = $(prefix)/bin -lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L. -libdir ?= $(prefix)/lib -incdir = $(prefix)/include/btrfs +prefix ?= @prefix@ +bindir = @bindir@ +lib_LIBS = @UUID_LIBS@ @BLKID_LIBS@ @ZLIB_LIBS@ @LZO2_LIBS@ -m -L. +libdir ?= @libdir@ +incdir = @includedir@/btrfs LIBS = $(lib_LIBS) $(libs_static) ifeq ("$(origin V)", "command line")
Signature · 1 line
1.9.3
PATCH 7/10 btrfs-progs: cleanup compilation flags usage
In reply to Karel Zak- define basic default CFLAGS in configure.ac, because:
* autoconf default is -g -O2, but btrfs uses -g -O1
* it's better to follow autoconf; standard way to modify CFLAGS is to call: CFLAGS="foo bar" ./configure
- move all flags to one place in Makefile.in
- don't use AM_CFLAGS, the CFLAGS and STATIC_CFLAGS are enough
- don't mix objects and flags in $LIBS, it's more readable to add $(libs) to make rules
--- Makefile.in | 67 +++++++++++++++++++++++++++++++++++------------------------- configure.ac | 2 ++ 2 files changed, 41 insertions(+), 28 deletions(-)
Makefile.in +39 -28
@@ -4,10 +4,27 @@ export CC = @CC@ LN_S = @LN_S@ AR = @AR@ -AM_CFLAGS = -include config.h -Wall \ - -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES \ - -fno-strict-aliasing -fPIC -CFLAGS = -g -O1 -fno-strict-aliasing -rdynamic +INSTALL = @INSTALL@ + +# Non-static compilation flags +CFLAGS = @CFLAGS@ \ + -include config.h -Wall \ + -D_FILE_OFFSET_BITS=64 -DBTRFS_FLAT_INCLUDES \ + -fno-strict-aliasing -fPIC \ + -rdynamic + +LDFLAGS = @LDFLAGS@ + +LIBS = @UUID_LIBS@ @BLKID_LIBS@ @ZLIB_LIBS@ @LZO2_LIBS@ -lm -L. +LIBBTRFS_LIBS = $(LIBS) + +# Static compilation flags +STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections +STATIC_LDFLAGS = -static -Wl,--gc-sections +STATIC_LIBS = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ \ + @ZLIB_LIBS_STATIC@ @LZO2_LIBS_STATIC@ -lpthread + + objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \ root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \ extent-cache.o extent_io.o volumes.o utils.o repair.o \
@@ -25,13 +42,10 @@ libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ extent_io.h ioctl.h ctree.h btrfsck.h version.h TESTS = fsck-tests.sh convert-tests.sh -INSTALL = @INSTALL@ prefix ?= @prefix@ bindir = @bindir@ -lib_LIBS = @UUID_LIBS@ @BLKID_LIBS@ @ZLIB_LIBS@ @LZO2_LIBS@ -m -L. libdir ?= @libdir@ incdir = @includedir@/btrfs -LIBS = $(lib_LIBS) $(libs_static) ifeq ("$(origin V)", "command line") BUILD_VERBOSE = $(V)
@@ -69,7 +83,7 @@ INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS)) CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS)) ifeq ($(DISABLE_BACKTRACE),1) -AM_CFLAGS += -DBTRFS_DISABLE_BACKTRACE +CFLAGS += -DBTRFS_DISABLE_BACKTRACE endif ifneq ($(DISABLE_DOCUMENTATION),1)
@@ -89,10 +103,6 @@ static_objects = $(patsubst %.o, %.static.o, $(objects)) static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects)) static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects)) -# Define static compilation flags -STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections -STATIC_LDFLAGS = -static -Wl,--gc-sections -STATIC_LIBS = $(lib_LIBS) -lpthread libs_shared = libbtrfs.so.0.1 libs_static = libbtrfs.a
@@ -120,7 +130,7 @@ ifdef C else check = true check_echo = true - AM_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 + CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 endif %.o.d: %.c
@@ -128,13 +138,13 @@ endif .c.o: @$(check_echo) " [SP] $<" - $(Q)$(check) $(AM_CFLAGS) $(CFLAGS) $< + $(Q)$(check) $(CFLAGS) $< @echo " [CC] $@" - $(Q)$(CC) $(AM_CFLAGS) $(CFLAGS) -c $< + $(Q)$(CC) $(CFLAGS) -c $< %.static.o: %.c @echo " [CC] $@" - $(Q)$(CC) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@ + $(Q)$(CC) $(STATIC_CFLAGS) -c $< -o $@ all: $(progs) $(BUILDDIRS) $(SUBDIRS): $(BUILDDIRS)
@@ -156,7 +166,7 @@ static: $(progs_static) $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(lib_LIBS) \ + $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(LIBBTRFS_LIBS) \ -shared -Wl,-soname,libbtrfs.so.0 -o libbtrfs.so.0.1 $(libs_static): $(libbtrfs_objects)
@@ -186,12 +196,13 @@ btrfs-%.static: $(static_objects) btrfs-%.static.o $(static_libbtrfs_objects) btrfs-%: $(objects) $(libs) btrfs-%.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o $@ $(objects) [email protected] $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs)) + $(Q)$(CC) $(CFLAGS) -o $@ $(objects) [email protected] $(libs) \ + $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs)) btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs) @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \ - $(objects) $(LDFLAGS) $(LIBS) -lpthread + $(objects) $(libs) $(LDFLAGS) $(LIBS) -lpthread btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects) @echo " [LD] $@"
@@ -201,15 +212,15 @@ btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objec # For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck' btrfsck: btrfs @echo " [LN] $@" - $(Q)$(LN) -f btrfs btrfsck + $(Q)$(LN_S) -f btrfs btrfsck btrfsck.static: btrfs.static @echo " [LN] $@" - $(Q)$(LN) -f $^ $@ + $(Q)$(LN_S) -f $^ $@ mkfs.btrfs: $(objects) $(libs) mkfs.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS) + $(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) $(libs) mkfs.o $(LDFLAGS) $(LIBS) mkfs.btrfs.static: $(static_objects) mkfs.static.o $(static_libbtrfs_objects) @echo " [LD] $@"
@@ -218,7 +229,7 @@ mkfs.btrfs.static: $(static_objects) mkfs.static.o $(static_libbtrfs_objects) btrfstune: $(objects) $(libs) btrfstune.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS) + $(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) $(libs) btrfstune.o $(LDFLAGS) $(LIBS) btrfstune.static: $(static_objects) btrfstune.static.o $(static_libbtrfs_objects) @echo " [LD] $@"
@@ -227,19 +238,19 @@ btrfstune.static: $(static_objects) btrfstune.static.o $(static_libbtrfs_objects dir-test: $(objects) $(libs) dir-test.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS) + $(Q)$(CC) $(CFLAGS) -o dir-test $(objects) $(libs) dir-test.o $(LDFLAGS) $(LIBS) quick-test: $(objects) $(libs) quick-test.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS) + $(Q)$(CC) $(CFLAGS) -o quick-test $(objects) $(libs) quick-test.o $(LDFLAGS) $(LIBS) ioctl-test: $(objects) $(libs) ioctl-test.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o ioctl-test $(objects) ioctl-test.o $(LDFLAGS) $(LIBS) + $(Q)$(CC) $(CFLAGS) -o ioctl-test $(objects) $(libs) ioctl-test.o $(LDFLAGS) $(LIBS) send-test: $(objects) $(libs) send-test.o @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) -o send-test $(objects) send-test.o $(LDFLAGS) $(LIBS) -lpthread + $(Q)$(CC) $(CFLAGS) -o send-test $(objects) $(libs) send-test.o $(LDFLAGS) $(LIBS) -lpthread library-test: $(libs_shared) library-test.o @echo " [LD] $@"
@@ -284,7 +295,7 @@ install: $(libs) $(progs) $(INSTALLDIRS) $(INSTALL) $(progs) $(DESTDIR)$(bindir) $(INSTALL) fsck.btrfs $(DESTDIR)$(bindir) # btrfsck is a link to btrfs in the src tree, make it so for installed file as well - $(LN) -f $(DESTDIR)$(bindir)/btrfs $(DESTDIR)$(bindir)/btrfsck + $(LN_S) -f $(DESTDIR)$(bindir)/btrfs $(DESTDIR)$(bindir)/btrfsck $(INSTALL) -m755 -d $(DESTDIR)$(libdir) $(INSTALL) $(libs) $(DESTDIR)$(libdir) cp -a $(lib_links) $(DESTDIR)$(libdir)
configure.ac +2 -0
@@ -8,6 +8,8 @@ LIBBTRFS_MAJOR=0 LIBBTRFS_MINOR=1 LIBBTRFS_PATCHLEVEL=1 +CFLAGS="-g -O1" + AC_PREREQ([2.60]) AC_CONFIG_AUX_DIR([config])
Signature · 1 line
1.9.3
PATCH 8/10 btrfs-progs: clean generated files, make version.h stuff more robust
In reply to Karel Zak- add rule to generated version.h when any relevant stuff changed
- add rule to clean generated files on "make clean-all"
--- Makefile.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Makefile.in +12 -2
@@ -164,6 +164,10 @@ test: # static: $(progs_static) +version.h: version.sh version.h.in configure.ac + @echo " [SH] $@" + $(Q)bash ./config.status --silent $@ + $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(LIBBTRFS_LIBS) \
@@ -271,14 +275,15 @@ test-build: manpages: $(Q)$(MAKE) $(MAKEOPTS) -C Documentation -clean-all: clean-doc clean + +clean-all: clean clean-doc clean-gen clean: $(CLEANDIRS) @echo "Cleaning" $(Q)rm -f $(progs) cscope.out *.o *.o.d \ dir-test ioctl-test quick-test send-test library-test library-test-static \ btrfs.static mkfs.btrfs.static \ - version.h $(check_defs) \ + $(check_defs) \ $(libs) $(lib_links) \ $(progs_static) $(progs_extra)
@@ -286,6 +291,11 @@ clean-doc: @echo "Cleaning Documentation" $(Q)$(MAKE) $(MAKEOPTS) -C Documentation clean +clean-gen: + @echo "Cleaning Generated Files" + $(Q)rm -f version.h config.status config.cache connfig.log \ + configure.lineno config.status.lineno Makefile + $(CLEANDIRS): @echo "Cleaning $(patsubst clean-%,%,$@)" $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst clean-%,%,$@) clean
Signature · 1 line
1.9.3
PATCH 9/10 btrfs-progs: add --disable-backtrace
In reply to Karel ZakIt's better to use ./configure than manually edit Makefile.
--- Makefile.in | 4 ---- configure.ac | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-)
Makefile.in +0 -4
@@ -82,10 +82,6 @@ BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS)) INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS)) CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS)) -ifeq ($(DISABLE_BACKTRACE),1) -CFLAGS += -DBTRFS_DISABLE_BACKTRACE -endif - ifneq ($(DISABLE_DOCUMENTATION),1) BUILDDIRS += build-Documentation INSTALLDIRS += install-Documentation
configure.ac +10 -0
@@ -56,6 +56,16 @@ AC_DEFUN([PKG_STATIC], [ fi ]) + +AC_ARG_ENABLE([backtrace], + AS_HELP_STRING([--disable-backtrace], [disable btrfs backtrace]), + [], [enable_backtrace=yes] +) + +AS_IF([test "x$enable_backtrace" = xno], [ + AC_DEFINE([BTRFS_DISABLE_BACKTRACE], [1], [disable backtrace stuff in kerncompat.h ]) +]) + dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config dnl dnl The default PKG_CHECK_MODULES() action-if-not-found is end the
Signature · 1 line
1.9.3
PATCH 10/10 btrfs-progs: add --disable-documentation
In reply to Karel Zak--- Makefile.in | 1 + configure.ac | 9 +++++++++ 2 files changed, 10 insertions(+)
Makefile.in +1 -0
@@ -5,6 +5,7 @@ CC = @CC@ LN_S = @LN_S@ AR = @AR@ INSTALL = @INSTALL@ +DISABLE_DOCUMENTATION = @DISABLE_DOCUMENTATION@ # Non-static compilation flags CFLAGS = @CFLAGS@ \
configure.ac +9 -0
@@ -66,6 +66,15 @@ AS_IF([test "x$enable_backtrace" = xno], [ AC_DEFINE([BTRFS_DISABLE_BACKTRACE], [1], [disable backtrace stuff in kerncompat.h ]) ]) + +AC_ARG_ENABLE([documentation], + AS_HELP_STRING([--disable-documentation], [do not build domumentation]), + [], [enable_documentation=yes] +) +AS_IF([test "x$enable_documentation" = xyes], [DISABLE_DOCUMENTATION=0], [DISABLE_DOCUMENTATION=1]) +AC_SUBST([DISABLE_DOCUMENTATION]) + + dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config dnl dnl The default PKG_CHECK_MODULES() action-if-not-found is end the
Signature · 1 line
1.9.3
Quoted 3 lines · Karel Zak
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Quoted 4 lines
Note that there is also strange unused
btrfs_convert_libs,btrfs_image_libsandbtrfs_fragments_libsvariables with things like "-lgd -lpng -ljpeg -lfreetype". I guess it's some legacy, right? I didn't touch these variables as I have no clue about sense of this stuff.
No, it's part of the macro magic. There are pattern rules that accept any source in the form btrfs-something.c and also pick the libraries for that from variable btrfs_something_libs:
btrfs-%: $(objects) $(libs) btrfs-%.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o $@ $(objects) [email protected] $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))This is for convenience, if this turns out to be hard to do with in combination with autotools, I don't insist on keeping it but it has simplified the Makefile significantly.
Quoted 9 lines · David Sterba
Quoted 3 lines · Karel Zak
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Cool, I'll try to prepare next set of patches with automake.
BTW, I have good experience with build-system changes -- downstream distributions (maintainers) are usually pretty flexible :-)
Quoted 9 lines
Quoted 4 lines
Note that there is also strange unused
btrfs_convert_libs,btrfs_image_libsandbtrfs_fragments_libsvariables with things like "-lgd -lpng -ljpeg -lfreetype". I guess it's some legacy, right? I didn't touch these variables as I have no clue about sense of this stuff.No, it's part of the macro magic. There are pattern rules that accept any source in the form
btrfs-something.cand also pick the libraries for that from variablebtrfs_something_libs:
Quoted 7 lines
btrfs-%: $(objects) $(libs) btrfs-%.o
@echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o $@ $(objects) [email protected] $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))This is for convenience, if this turns out to be hard to do with in combination with autotools, I don't insist on keeping it but it has simplified the
Makefilesignificantly.
OK, so -ljpeg in the Makefile is just example, right?
Anyway, for these things is better to introduce extra autoconf AC_ARG_VAR() variables, keep is empty by default and use it in Makefile. The advantage is that the variables are documented and visible by ./configure --help.
For example in util-linux we have many {SUID,DAEMON,SOLIB,...}_CFLAGS and LDFLAGS for distributions that require extensions like -fPIE, -Wl,-z,relro etc. The same is possible to do with $LIBS.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 11 lines · Karel Zak
Quoted 9 lines · David Sterba
Quoted 3 lines · Karel Zak
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Quoted 21 lines
Cool, I'll try to prepare next set of patches with automake.
BTW, I have good experience with build-system changes -- downstream distributions (maintainers) are usually pretty flexible :-)
Quoted 16 lines
Quoted 4 lines
Note that there is also strange unused
btrfs_convert_libs,btrfs_image_libsandbtrfs_fragments_libsvariables with things like "-lgd -lpng -ljpeg -lfreetype". I guess it's some legacy, right? I didn't touch these variables as I have no clue about sense of this stuff.No, it's part of the macro magic. There are pattern rules that accept any source in the form
btrfs-something.cand also pick the libraries for that from variablebtrfs_something_libs:btrfs-%: $(objects) $(libs) btrfs-%.o
@echo " [LD] $@" $(Q)$(CC) $(CFLAGS) -o $@ $(objects) [email protected] $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))This is for convenience, if this turns out to be hard to do with in combination with autotools, I don't insist on keeping it but it has simplified the
Makefilesignificantly.
Yeah, I did those long ago IIRC. It obfuscates things a bit, but cut down on tons of cut and paste in the Makefile...
Quoted 1 line
OK, so -ljpeg in the
Makefileis just example, right?
It's been specified for the btrfs-framgnets tool since .. forever.
commit 6d37fbfc1f83c34f00df7c9d8e5b60e49d9db48d
Author: Arne Jansen <[email protected]> Date: Mon Nov 28 17:12:30 2011 +0100
Btrfs-progs: tool to visualize fragmentation
...
+btrfs-fragments: $(objects) $(libs) fragments.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o btrfs-fragments $(objects) fragments.o $(LDFLAGS) $(LIBS) -lgd -lpng -ljpeg -lfreetype
but the code only does:
gdImagePng(im, pngout);
so it's probably not needed...
Quoted 9 lines
Anyway, for these things is better to introduce extra autoconf
AC_ARG_VAR()variables, keep is empty by default and use it inMakefile. The advantage is that the variables are documented and visible by ./configure --help.For example in util-linux we have many {SUID,DAEMON,SOLIB,...}_CFLAGS and LDFLAGS for distributions that require extensions like -fPIE, -Wl,-z,relro etc. The same is possible to do with $LIBS.
Once auto$FOO is implemented, I am sure there are better ways to do it than what I did. :)
Thanks,
-Eric
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Karel Zak schreef op 18-12-14 14:31:
Quoted 11 lines · David Sterba
Quoted 9 lines · Karel Zak
Quoted 3 lines
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Quoted 4 lines
Cool, I'll try to prepare next set of patches with automake.
BTW, I have good experience with build-system changes -- downstream distributions (maintainers) are usually pretty flexible :-)
Especially when switching from homegrown makefiles to autofoo!
regards,
Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org
iD8DBQFUmBLqMkyGM64RGpERApjpAJ9Agir/DDJiFYUR8qPDcNmx7pnLnQCgoKsD 1HuCreKom9ZYzZevIbqWz08=
=g1VP
-----END PGP SIGNATURE-----
Quoted 9 lines · David Sterba
Quoted 3 lines · Karel Zak
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Note that I have rebased the autoconf patches and fixed some issues, the latest version is available at
https://github.com/karelzak/btrfs-progs/commits/autoconf
you can merge it (now or later) on command line by:
git pull --log [email protected]:karelzak/btrfs-progs.git autoconf
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 6 lines · Karel Zak
Quoted 5 lines · David Sterba
Quoted 3 lines · Karel Zak
This is first step to make btrfs-progs build system more conventional for userspace users and developers. All is implemented by small incremental patches to keep things review-able.
Quoted 6 lines
Quoted 4 lines
Thanks. I went through the patches and haven't found major problems. The changes are affecting build system and this will need a longer period before all distros have a chance to adapt to that, so I'm postponing it to 3.19.
Note that I have rebased the autoconf patches and fixed some issues,
Rebased on 3.18.3, fixed some minor conflicts.
* I'm a bit surprised that automake is required for the config.{guess,sub} and install-sh files
* my oldish testbox' automake does not support the --print-libdir option (automake-1.11), enterprise distros ship automake of similar age
* library build test fails, but this may be because I've mismerged something, I'll check again
Otherwise looks ok and I'll merge it, plus a few fixups to make it build for me.
Quoted 5 lines
https://github.com/karelzak/btrfs-progs/commits/autoconf
you can merge it (now or later) on command line by:
git pull --log [email protected]:karelzak/btrfs-progs.git autoconf
git-pulls are not (yet) established workflow, mailinglist is preferred, but it does not hurt to publish branches along.
I've noticed the 'automake' branch that switches to automake. Looking at the amount of changes and the result, I'm not quite happy and don't see the benefit of automake. An extra layer that only obfuscates the build. We're not using any advanced build features. Just a bunch of independent binaries built from the same sources. The shared library is an exception and it works.
Quoted 4 lines · David Sterba
Rebased on 3.18.3, fixed some minor conflicts.
* I'm a bit surprised that automake is required for the config.{guess,sub} and install-sh files
well, it's not required, but autoconf does not provide the scripts. You have to maintain the scripts in git three (IMHO not elegant solution) or use the scripts from automake.
This problem does not exist if you have fully "autotoolized" project, because automake provides automatically all the scripts.
Quoted 9 lines
* my oldish testbox' automake does not support the --print-libdir option (automake-1.11), enterprise distros ship automake of similar age
* library build test fails, but this may be because I've mismerged something, I'll check again
Otherwise looks ok and I'll merge it, plus a few fixups to make it build for me.
Quoted 8 lines
Quoted 5 lines
https://github.com/karelzak/btrfs-progs/commits/autoconf
you can merge it (now or later) on command line by:
git pull --log [email protected]:karelzak/btrfs-progs.git autoconfgit-pulls are not (yet) established workflow, mailinglist is preferred, but it does not hurt to publish branches along.
OK.
Quoted 3 lines
I've noticed the 'automake' branch that switches to automake. Looking at the amount of changes and the result, I'm not quite happy and don't see the benefit of automake. An extra layer that only obfuscates the build.
I don't think the set of changes is so huge, all the changes are mostly Makefile.am.
Anyway, why automake:
- it's way how to standardize build-system, the automake rules are really easy to read, the Makefile.am files are almost the same in all projects.
- automake+autoconf provides AM_CONDITIONAL(), so you can keep your makefiles pretty simple and maintain all if-then logic in ./configure script where you have available shell and huge number of tests.
For example in util-linux we have many internal and external dependencies, but in makefiles we have only "if BUILD_UTILNAME", all logic is strictly in ./configure.ac
- provides large set of targets
- provides more portable environment
(for example: if you want to distribute man pages, then dist_man_MANS += foo.8 is enough, you don't have to care about target directories for the man page section, etc.)
- forces maintainer to generate better tarballs, after successful "make diskcheck" you can be sure that your tarballs are really usable (for example -- do you know how many header files are missing in the current btrfs-progs Makefile? Do you have a way how to check it?)
- manually write and maintain smart build-system is difficult and result is almost always very complex stuff
There is only one disadvantage, developers have to learn something new. Yes, people hate this thing :-)
I guess we will see more and more stuff in btrfs-progs, so it's better to the change now than later.
See e2fsprogs (sorry Ted), it's result of "automake only obfuscates", many Makefile.in files, '@' everywhere, nightmare.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com