# HG changeset patch # User Pascal Bellard # Date 1474361216 -7200 # Node ID 1e6252d9731734ed3f3adbfd39875585b1e0c705 # Parent 6c436b58038aaca0e271c4a1a330fbdc3667c364 fusecloop/create_compressed_fs: add zopfli support diff -r 6c436b58038a -r 1e6252d97317 fusecloop/receipt --- a/fusecloop/receipt Sat Sep 17 23:08:45 2016 +0200 +++ b/fusecloop/receipt Tue Sep 20 10:46:56 2016 +0200 @@ -9,7 +9,7 @@ TARBALL="$PACKAGE-$VERSION.tar.gz" WEB_SITE="http://fusecloop.sourceforge.net/" WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" -ADVANCECOMP_VERSION="1.15" +ADVANCECOMP_VERSION="1.20" ADVANCECOMP_TARBALL="advancecomp-$ADVANCECOMP_VERSION.tar.gz" ADVANCECOMP_URL="$SF_MIRROR/advancemame/$ADVANCECOMP_TARBALL" EXTRA_SOURCE_FILES="$ADVANCECOMP_TARBALL" @@ -21,7 +21,6 @@ # Rules to configure and make the package. compile_rules() { - cd $src [ -s $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL ] || wget -P $SOURCES_REPOSITORY $ADVANCECOMP_URL tar xzf $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL diff -r 6c436b58038a -r 1e6252d97317 fusecloop/stuff/fusecloop.u --- a/fusecloop/stuff/fusecloop.u Sat Sep 17 23:08:45 2016 +0200 +++ b/fusecloop/stuff/fusecloop.u Tue Sep 20 10:46:56 2016 +0200 @@ -620,13 +620,15 @@ +} --- create_compressed_fs.c +++ create_compressed_fs.c -@@ -0,0 +1,203 @@ +@@ -0,0 +1,223 @@ +#ifdef FIND_BEST_COMPRESSION +#include +extern "C" { +#include +#include + ++static shrink_t level; ++static int pass, iter; +static int best_compress(unsigned char *compressed, + unsigned long *compressed_len, + unsigned char *uncompressed, @@ -646,13 +648,14 @@ + } + buf[0] = compressed; + buf[1] = buffer; -+ for (i = j = 0; i <= 10; i++) { ++ for (i = j = 0; i <= 11 && (pass == 0 || i < pass); i++) { + llen = len = *compressed_len; -+ if (i == 10) -+ err = (compress_zlib(shrink_extreme, buf[j], ++ if (i >= 10) { ++ level.level = (i == 10) ? shrink_extra : shrink_insane; ++ err = (compress_zlib(level, buf[j], + len, uncompressed, + uncompressed_len)) ? Z_OK : Z_DATA_ERROR; -+ else { ++ } else { + err = compress2(buf[j], &llen, uncompressed, + uncompressed_len, i); + len = llen; @@ -744,9 +747,26 @@ + md5hash *hash; +#endif + ++#ifdef FIND_BEST_COMPRESSION ++ while (argc > 1) { ++ if (argv[1][0] == '-') { ++ int *p = &pass; ++ switch (argv[1][1]) { ++ case 'i' : p = &iter; ++ case 'n' : *p = atoi(argv[2]); ++ argc -= 2; ++ argv += 2; ++ continue; ++ } ++ } ++ argc--; ++ if (argv[1][0] < '0' || argv[1][0] > '9') ++ quit("Usage : create_compressed_fs [-n ][ -i ] [block size] < input > output"); ++#else + if (argc > 1) { + if (argv[1][0] < '0' || argv[1][0] > '9') + quit("Usage : create_compressed_fs [block size] < input > output"); ++#endif + block_size = atoi(argv[1]); + } + if (block_size < 4096)