wok-next rev 19408

fusecloop/create_compressed_fs: add zopfli support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 20 10:46:56 2016 +0200 (2016-09-20)
parents 6c436b58038a
children cb01d1d24314
files fusecloop/receipt fusecloop/stuff/fusecloop.u
line diff
     1.1 --- a/fusecloop/receipt	Sat Sep 17 23:08:45 2016 +0200
     1.2 +++ b/fusecloop/receipt	Tue Sep 20 10:46:56 2016 +0200
     1.3 @@ -9,7 +9,7 @@
     1.4  TARBALL="$PACKAGE-$VERSION.tar.gz"
     1.5  WEB_SITE="http://fusecloop.sourceforge.net/"
     1.6  WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
     1.7 -ADVANCECOMP_VERSION="1.15"
     1.8 +ADVANCECOMP_VERSION="1.20"
     1.9  ADVANCECOMP_TARBALL="advancecomp-$ADVANCECOMP_VERSION.tar.gz"
    1.10  ADVANCECOMP_URL="$SF_MIRROR/advancemame/$ADVANCECOMP_TARBALL"
    1.11  EXTRA_SOURCE_FILES="$ADVANCECOMP_TARBALL"
    1.12 @@ -21,7 +21,6 @@
    1.13  # Rules to configure and make the package.
    1.14  compile_rules()
    1.15  {
    1.16 -	cd $src
    1.17  	[ -s $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL ] ||
    1.18  		wget -P $SOURCES_REPOSITORY $ADVANCECOMP_URL
    1.19  	tar xzf $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL
     2.1 --- a/fusecloop/stuff/fusecloop.u	Sat Sep 17 23:08:45 2016 +0200
     2.2 +++ b/fusecloop/stuff/fusecloop.u	Tue Sep 20 10:46:56 2016 +0200
     2.3 @@ -620,13 +620,15 @@
     2.4  +}
     2.5  --- create_compressed_fs.c
     2.6  +++ create_compressed_fs.c
     2.7 -@@ -0,0 +1,203 @@
     2.8 +@@ -0,0 +1,223 @@
     2.9  +#ifdef FIND_BEST_COMPRESSION
    2.10  +#include <compress.h>
    2.11  +extern "C" {
    2.12  +#include <stdlib.h>
    2.13  +#include <string.h>
    2.14  +
    2.15 ++static shrink_t level;
    2.16 ++static int pass, iter;
    2.17  +static int best_compress(unsigned char *compressed,
    2.18  +			 unsigned long *compressed_len,
    2.19  +			 unsigned char *uncompressed,
    2.20 @@ -646,13 +648,14 @@
    2.21  +	}
    2.22  +	buf[0] = compressed;
    2.23  +	buf[1] = buffer;
    2.24 -+	for (i = j = 0; i <= 10; i++) {
    2.25 ++	for (i = j = 0; i <= 11 && (pass == 0 || i < pass); i++) {
    2.26  +		llen = len = *compressed_len;
    2.27 -+		if (i == 10) 
    2.28 -+			err = (compress_zlib(shrink_extreme, buf[j],
    2.29 ++		if (i >= 10) {
    2.30 ++			level.level = (i == 10) ? shrink_extra : shrink_insane;
    2.31 ++			err = (compress_zlib(level, buf[j],
    2.32  +		     		len, uncompressed,
    2.33  +		     		uncompressed_len)) ? Z_OK : Z_DATA_ERROR;
    2.34 -+		else {
    2.35 ++		} else {
    2.36  +			err = compress2(buf[j], &llen, uncompressed,
    2.37  +				     uncompressed_len, i);
    2.38  +			len = llen;
    2.39 @@ -744,9 +747,26 @@
    2.40  +	md5hash *hash;
    2.41  +#endif
    2.42  +	
    2.43 ++#ifdef FIND_BEST_COMPRESSION
    2.44 ++	while (argc > 1) {
    2.45 ++		if (argv[1][0] == '-') {
    2.46 ++			int *p = &pass;
    2.47 ++			switch (argv[1][1]) {
    2.48 ++			case 'i' : p = &iter;
    2.49 ++			case 'n' : *p = atoi(argv[2]);
    2.50 ++				argc -= 2;
    2.51 ++				argv += 2;
    2.52 ++				continue;
    2.53 ++			}
    2.54 ++		}
    2.55 ++		argc--;
    2.56 ++		if (argv[1][0] < '0' || argv[1][0] > '9')
    2.57 ++			quit("Usage : create_compressed_fs [-n <pass>][ -i <iter>] [block size] < input > output");
    2.58 ++#else
    2.59  +	if (argc > 1) {
    2.60  +		if (argv[1][0] < '0' || argv[1][0] > '9')
    2.61  +			quit("Usage : create_compressed_fs [block size] < input > output");
    2.62 ++#endif
    2.63  +		block_size = atoi(argv[1]);
    2.64  +	}
    2.65  +	if (block_size < 4096)