xdelta3 - A modern equivalent to SAS/C scompare/spatch
DESCRIPTION:
This is a quick OS4 port of the very latest beta of xdelta3 from
http://xdelta.org or http://xdelta.googlecode.com
It extracts the differences between two versions of a file and saves it to a
.delta file which can then be used to recreates the new version.
It is most useful for online distribution of updates to very large files, such
as ISO images or programs archives adding up to dozens or hundreds of megabytes
because only the (compressed) difference need to be downloaded rather than the
whole archive/file.
I didn't plan on doing this but that's what I get for telling J&ouml;rg Strohmayer
that it would be nice to have a working native scompare/spatch combo :-P
He mentionned xdelta, one thing lead to another, and with his guidance I was
able to compile it while he also provided a miniature version of decoder-only
version of xdelta3 (xdelta3-decoder) which is small enough to be distributed
along with .delta updates like "spatch" would be with .pch files.
The only feature which isn't enabled in this port is the external compression,
due to its reliance on fork() and a few other functions which would require
some replacement to be hard-coded.
It doesn't reduce the functionality of the program though.
64bit support (files larger than 4GB) hasn't been tested so beware.
Some advantages over spatch are:
- speed, xdelta3 is at least 5x faster,
- size, the .delta file produced is significantly smaller than a .pch file,
- cross-platform, .delta files can be read/written on Win/Linux/OSX
EXAMPLES:
Say you have FileA, made some changes and saved it as FileB.
Now if you want to send only the changes to someone, you can generate a delta
file with the following command:
xdelta3 -s FileA FileB FileAB.delta
Then you could send xdelta3-decoder along with FileAB.delta to that someone
and he would use the following command:
xdelta3-decoder -s FileA FileAB.delta
which would recreate FileB (the original filename is stored in the delta file).
To recreate FileB with a different filename:
xdelta3-decoder -s FileA FileAB.delta FileXYZ
COMPILING:
Get the sources from http://xdelta.googlecode.com/files/xdelta3.0t.tar.gz
Normally it should be enough to use 'gmake xdelta3-noext' but with my
SDK with gcc 3.4.4 that doesn't work so I had to use:
gcc -mcrt=newlib -Os -msdata -mmultiple -Wall -Wshadow xdelta3.c
-DXD3_ENCODER=1-DXD3_MAIN=1 -DSECONDARY_FGK=1 -DSECONDARY_DJW=1
-DXD3_STDIO=1 -DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=1 -o R:xdelta3
Thanks to J&ouml;erg for the help and to Josh McDonald for xdelta