Changeset 97255


Ignore:
Timestamp:
Sep 1, 2012, 11:28:47 AM (7 years ago)
Author:
mww@…
Message:

gzip: version 1.5

Location:
trunk/dports/archivers/gzip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/archivers/gzip/Portfile

    r96499 r97255  
    44
    55name            gzip
    6 version         1.4
     6version         1.5
    77categories      archivers
    88license         GPL-3+
     
    1919master_sites    gnu
    2020
    21 checksums           rmd160  a74f782960387e3f05373acc258becb564eda82d \
    22                     sha256  d166cfd3da380da1bd535633e8890bfb5664f9e68870a611d1dc01a3e9f711ee
     21checksums           rmd160  641a4a095a44174e924569c051a089c86081c7ac \
     22                    sha256  b5d56e8ffc9918e8c941fab56e04121194f9870adeeb859e09c09eac264035a3
    2323
    2424depends_build       port:texinfo
  • trunk/dports/archivers/gzip/files/patch-gzip-rsyncable.diff

    r39748 r97255  
    1 diff -u -r ../gzip-1.3.12.orig/deflate.c ./deflate.c
    2 --- ../gzip-1.3.12.orig/deflate.c       2006-12-07 17:53:00.000000000 -0600
    3 +++ ./deflate.c 2008-09-01 20:49:37.000000000 -0500
    4 @@ -135,6 +135,14 @@
     1diff -u -r deflate.c gzip/deflate.c
     2--- deflate.c   2012-04-24 10:25:28.000000000 -0600
     3+++ gzip/deflate.c      2012-06-19 14:01:41.885498670 -0600
     4@@ -131,6 +131,14 @@
    55 #endif
    66 /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
    77 
    88+#ifndef RSYNC_WIN
    9 +#  define RSYNC_WIN 4096
     9+#  define RSYNC_WIN 8192
    1010+#endif
    1111+/* Size of rsync window, must be < MAX_DIST */
    1212+
    13 +#define RSYNC_SUM_MATCH(sum) ((sum) % RSYNC_WIN == 0)
     13+#define RSYNC_SUM_MATCH(sum) (((sum) & (RSYNC_WIN - 1)) == 0)
    1414+/* Whether window sum matches magic value */
    1515+
     
    1717  * Local data used by the "longest match" routines.
    1818  */
    19 @@ -216,6 +224,8 @@
    20  unsigned near good_match;
     19@@ -212,6 +220,8 @@
     20 unsigned good_match;
    2121 /* Use a faster search when the previous match is longer than this */
    2222 
     
    3737      */
    3838     max_lazy_match   = configuration_table[pack_level].max_lazy;
    39 @@ -550,6 +564,8 @@
     39@@ -331,6 +345,7 @@
     40 
     41     strstart = 0;
     42     block_start = 0L;
     43+    rsync_chunk_end = 0xFFFFFFFFUL;
     44 #ifdef ASMV
     45     match_init(); /* initialize the asm code */
     46 #endif
     47@@ -550,6 +565,8 @@
    4048         memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
    4149         match_start -= WSIZE;
     
    4654         block_start -= (long) WSIZE;
    4755 
    48 @@ -577,13 +593,46 @@
     56@@ -579,6 +596,39 @@
    4957     }
    5058 }
     
    8694  * Flush the current block, with given end-of-file flag.
    8795  * IN assertion: strstart is set to the end of the current match.
    88   */
    89  #define FLUSH_BLOCK(eof) \
    90     flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \
    91 -                (char*)NULL, (long)strstart - block_start, (eof))
    92 +                (char*)NULL, (long)strstart - block_start, flush-1, (eof))
    93  
    94  /* ===========================================================================
    95   * Processes a new input file and return its compressed length. This
    96 @@ -594,7 +643,7 @@
    97  local off_t deflate_fast()
    98  {
    99      IPos hash_head; /* head of the hash chain */
    100 -    int flush;      /* set if current block must be flushed */
    101 +    int flush;      /* set if current block must be flushed, 2=>and padded  */
    102      unsigned match_length = 0;  /* length of best match */
    103  
    104      prev_length = MIN_MATCH-1;
    105 @@ -624,6 +673,7 @@
     96@@ -626,7 +676,8 @@
    10697 
    10798             lookahead -= match_length;
    10899 
     100-            /* Insert new strings in the hash table only if the match length
    109101+           RSYNC_ROLL(strstart, match_length);
    110             /* Insert new strings in the hash table only if the match length
     102+           /* Insert new strings in the hash table only if the match length
    111103              * is not too large. This saves time but degrades compression.
    112104              */
    113 @@ -652,9 +702,14 @@
     105             if (match_length <= max_insert_length) {
     106@@ -654,9 +705,18 @@
    114107             /* No match, output a literal byte */
    115108             Tracevv((stderr,"%c",window[strstart]));
    116109             flush = ct_tally (0, window[strstart]);
    117 +            RSYNC_ROLL(strstart, 1);
     110+           RSYNC_ROLL(strstart, 1);
    118111             lookahead--;
    119             strstart++;
     112             strstart++;
    120113         }
    121114+        if (rsync && strstart > rsync_chunk_end) {
     115+            ush  attr = 0;          /* ascii/binary flag */
     116+
     117+            flush = 1;
     118+            /* Reset huffman tree */
     119+            ct_init(&attr, &method);
    122120+            rsync_chunk_end = 0xFFFFFFFFUL;
    123 +            flush = 2;
    124121+        }
    125122         if (flush) FLUSH_BLOCK(0), block_start = strstart;
    126123 
    127124         /* Make sure that we always have enough lookahead, except
    128 @@ -728,6 +783,7 @@
     125@@ -730,6 +790,7 @@
    129126              */
    130127             lookahead -= prev_length-1;
     
    134131                 strstart++;
    135132                 INSERT_STRING(strstart, hash_head);
    136 @@ -740,24 +796,39 @@
     133@@ -742,24 +803,51 @@
    137134             match_available = 0;
    138135             match_length = MIN_MATCH-1;
     
    141138 
    142139+           if (rsync && strstart > rsync_chunk_end) {
     140+               ush  attr = 0;          /* ascii/binary flag */
     141+
     142+               /* Reset huffman tree */
     143+               ct_init(&attr, &method);
    143144+               rsync_chunk_end = 0xFFFFFFFFUL;
    144 +               flush = 2;
     145+               flush = 1;
    145146+           }
    146147+            if (flush) FLUSH_BLOCK(0), block_start = strstart;
     
    156157+           flush = ct_tally (0, window[strstart-1]);
    157158+           if (rsync && strstart > rsync_chunk_end) {
     159+               ush  attr = 0;          /* ascii/binary flag */
     160+
     161+               /* Reset huffman tree */
     162+               ct_init(&attr, &method);
    158163+               rsync_chunk_end = 0xFFFFFFFFUL;
    159 +               flush = 2;
     164+
     165+               flush = 1;
    160166+           }
    161167+            if (flush) FLUSH_BLOCK(0), block_start = strstart;
     
    168174              */
    169175+           if (rsync && strstart > rsync_chunk_end) {
     176+               ush  attr = 0;          /* ascii/binary flag */
     177+
    170178+               /* Reset huffman tree */
     179+               ct_init(&attr, &method);
    171180+               rsync_chunk_end = 0xFFFFFFFFUL;
    172 +               flush = 2;
     181+
    173182+               FLUSH_BLOCK(0), block_start = strstart;
    174183+           }
     
    178187             lookahead--;
    179188         }
    180 diff -u -r ../gzip-1.3.12.orig/doc/gzip.texi ./doc/gzip.texi
    181 --- ../gzip-1.3.12.orig/doc/gzip.texi   2007-02-05 17:29:04.000000000 -0600
    182 +++ ./doc/gzip.texi     2008-09-01 20:55:58.000000000 -0500
    183 @@ -350,6 +350,14 @@
     189diff -u -r doc/gzip.texi gzip/doc/gzip.texi
     190--- doc/gzip.texi       2012-01-01 01:53:58.000000000 -0700
     191+++ gzip/doc/gzip.texi  2012-06-19 14:09:36.041559612 -0600
     192@@ -207,6 +207,7 @@
     193   -V, --version     display version number
     194   -1, --fast        compress faster
     195   -9, --best        compress better
     196+    --rsyncable   Make rsync-friendly archive
     197 
     198 With no FILE, or when FILE is -, read standard input.
     199 
     200@@ -353,6 +354,30 @@
    184201 into the directory and compress all the files it finds there (or
    185202 decompress them in the case of @command{gunzip}).
     
    187204+@item --rsyncable
    188205+While compressing, synchronize the output occasionally based on the
    189 +input.  This reduces compression by about 1 percent most cases, but
    190 +means that the @command{rsync} program can take advantage of similarities
     206+input.  This can reduce the compression slightly in some cases, but
     207+means that the @code{rsync} program can take advantage of similarities
    191208+in the uncompressed input when syncronizing two files compressed with
    192 +this flag.  @command{gunzip} cannot tell the difference between a
     209+this flag.  @code{gunzip} cannot tell the difference between a
     210+compressed file created with this option, and one created without it.
     211+
     212+@item --rsyncable
     213+While compressing, synchronize the output occasionally based on
     214+the input.  This increases size by less than 1 percent most
     215+cases, but means that the @command{rsync} program can much more efficiently
     216+synchronize files compressed with this flag.  @command{gunzip}
     217+cannot tell the difference between a compressed file created
     218+with this option, and one created without it.
     219+
     220+@item --rsyncable
     221+While compressing, synchronize the output occasionally based on the
     222+input.  This can reduce the compression slightly in some cases, but
     223+means that the @code{rsync} program can take advantage of similarities
     224+in the uncompressed input when syncronizing two files compressed with
     225+this flag.  @code{gunzip} cannot tell the difference between a
    193226+compressed file created with this option, and one created without it.
    194227+
     
    196229 @itemx -S @var{suf}
    197230 Use suffix @var{suf} instead of @samp{.gz}.  Any suffix can be
    198 diff -u -r ../gzip-1.3.12.orig/gzip.c ./gzip.c
    199 --- ../gzip-1.3.12.orig/gzip.c  2007-03-20 00:09:51.000000000 -0500
    200 +++ ./gzip.c    2008-09-01 20:45:28.000000000 -0500
    201 @@ -231,6 +231,7 @@
     231--- gzip.c      2012-04-24 10:25:28.000000000 -0600
     232+++ gzip/gzip.c 2012-06-19 14:00:43.283873180 -0600
     233@@ -213,6 +213,7 @@
    202234 unsigned insize;           /* valid bytes in inbuf */
    203235 unsigned inptr;            /* index of next byte to be processed in inbuf */
     
    205237+int rsync = 0;             /* make ryncable chunks */
    206238 
    207  struct option longopts[] =
    208  {
    209 @@ -260,6 +261,7 @@
     239 static int handled_sig[] =
     240   {
     241@@ -270,7 +271,7 @@
    210242     {"best",       0, 0, '9'}, /* compress better */
    211243     {"lzw",        0, 0, 'Z'}, /* make output compatible with old compress */
    212244     {"bits",       1, 0, 'b'}, /* max number of bits per code (implies -Z) */
     245-
    213246+    {"rsyncable",  0, 0, 'R'}, /* make rsync-friendly archive */
    214247     { 0, 0, 0, 0 }
    215248 };
    216249 
    217 @@ -341,6 +343,7 @@
     250@@ -353,6 +354,7 @@
    218251  "  -Z, --lzw         produce output compatible with old compress",
    219252  "  -b, --bits=BITS   max number of bits per code (implies -Z)",
    220253 #endif
    221 + "      --rsyncable   Make rsync-friendly archive",
     254+ "  --rsyncable       Make rsync-friendly archive",
    222255  "",
    223256  "With no FILE, or when FILE is -, read standard input.",
    224257  "",
    225 @@ -469,6 +472,8 @@
    226             recursive = 1;
    227  #endif
    228             break;
    229 +       case 'R':
     258@@ -481,8 +483,11 @@
     259 #else
     260             recursive = 1;
     261 #endif
     262-            break;
     263-        case 'S':
     264+           break;
     265+        case 'R':
    230266+           rsync = 1; break;
    231         case 'S':
     267+
     268+       case 'S':
    232269 #ifdef NO_MULTIPLE_DOTS
    233270             if (*optarg == '.') optarg++;
    234 diff -u -r ../gzip-1.3.12.orig/gzip.h ./gzip.h
    235 --- ../gzip-1.3.12.orig/gzip.h  2007-03-20 00:09:51.000000000 -0500
    236 +++ ./gzip.h    2008-09-01 20:43:35.000000000 -0500
    237 @@ -158,6 +158,7 @@
     271 #endif
     272diff -u -r gzip.h gzip/gzip.h
     273--- gzip.h      2012-01-01 01:53:58.000000000 -0700
     274+++ gzip/gzip.h 2012-06-19 13:57:36.833883093 -0600
     275@@ -140,6 +140,7 @@
    238276 extern unsigned insize; /* valid bytes in inbuf */
    239277 extern unsigned inptr;  /* index of next byte to be processed in inbuf */
     
    243281 extern off_t bytes_in;   /* number of input bytes */
    244282 extern off_t bytes_out;  /* number of output bytes */
    245 @@ -306,7 +307,7 @@
    246          /* in trees.c */
    247  void ct_init     OF((ush *attr, int *method));
    248  int  ct_tally    OF((int dist, int lc));
    249 -off_t flush_block OF((char *buf, ulg stored_len, int eof));
    250 +off_t flush_block OF((char *buf, ulg stored_len, int pad, int eof));
    251  
    252          /* in bits.c */
    253  void     bi_init    OF((file_t zipfile));
    254 diff -u -r ../gzip-1.3.12.orig/trees.c ./trees.c
    255 --- ../gzip-1.3.12.orig/trees.c 2006-11-20 02:40:33.000000000 -0600
    256 +++ ./trees.c   2008-09-01 20:53:37.000000000 -0500
    257 @@ -860,9 +860,10 @@
    258   * trees or store, and output the encoded block to the zip file. This function
    259   * returns the total compressed length for the file so far.
    260   */
    261 -off_t flush_block(buf, stored_len, eof)
    262 +off_t flush_block(buf, stored_len, pad, eof)
    263      char *buf;        /* input block, or NULL if too old */
    264      ulg stored_len;   /* length of input block */
    265 +    int pad;          /* pad output to byte boundary */
    266      int eof;          /* true if this is the last block for a file */
    267  {
    268      ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
    269 @@ -955,6 +956,10 @@
    270          Assert (input_len == bytes_in, "bad input size");
    271          bi_windup();
    272          compressed_len += 7;  /* align on byte boundary */
    273 +    } else if (pad && (compressed_len % 8) != 0) {
    274 +        send_bits((STORED_BLOCK<<1)+eof, 3);  /* send block type */
    275 +        compressed_len = (compressed_len + 3 + 7) & ~7L;
    276 +        copy_block(buf, 0, 1); /* with header */
    277      }
    278  
    279      return compressed_len >> 3;
Note: See TracChangeset for help on using the changeset viewer.