diff -pruN tar-1.13/src/common.h tar-1.13-xz/src/common.h
--- tar-1.13/src/common.h	2009-05-22 14:02:02.000000000 +0200
+++ tar-1.13-xz/src/common.h	2009-05-22 14:04:47.000000000 +0200
@@ -131,6 +131,7 @@ GLOBAL int archive_is_bz2;
 GLOBAL int archive_is_gz;
 GLOBAL int archive_is_lzma;
 GLOBAL int archive_is_z;
+GLOBAL int archive_is_xz;
 
 /* Boolean value.  */
 GLOBAL int backup_option;
diff -pruN tar-1.13/src/tar.c tar-1.13-xz/src/tar.c
--- tar-1.13/src/tar.c	2009-05-22 14:03:11.000000000 +0200
+++ tar-1.13-xz/src/tar.c	2009-05-22 14:07:20.000000000 +0200
@@ -24,6 +24,8 @@
 
 /* Patched to handle archives with '.pet' suffix as '.tgz' archives */
 
+/* Patched to integrate xz as compression filter (options -J, --xz and --lzma2) */
+
 #include "system.h"
 
 #include <getopt.h>
@@ -212,6 +214,7 @@ struct option long_options[] =
   {"list", no_argument, NULL, 't'},
   {"listed-incremental", required_argument, NULL, 'g'},
   {"lzma", no_argument, NULL, NEW_LZMA_COMPRESS},
+  {"lzma2", no_argument, NULL, 'J'},
   {"mode", required_argument, NULL, MODE_OPTION},
   {"modification-time", no_argument, NULL, OBSOLETE_TOUCH},
   {"multi-volume", no_argument, NULL, 'M'},
@@ -259,6 +262,7 @@ struct option long_options[] =
   {"version", no_argument, &show_version, 1},
   {"version-control", required_argument, NULL, OBSOLETE_VERSION_CONTROL},
   {"volno-file", required_argument, NULL, VOLNO_FILE_OPTION},
+  {"xz", no_argument, NULL, 'J'},
 
   {0, 0, 0, 0}
 };
@@ -360,6 +364,7 @@ Archive format selection:\n\
   -a, --auto-compress                autodetect compression based on file suffix\n\
       --lzma                         filter the archive through lzma\n\
   -j, --bzip2, --bunzip2             filter the archive through bzip2\n\
+  -J, --xz, -lzma2                   filter the archive through xz(lzma2)\n\
   -z, --gzip, --ungzip               filter the archive through gzip\n\
   -Z, --compress, --uncompress       filter the archive through compress\n\
       --use-compress-program=PROG    filter through PROG (must accept -d)\n"),
@@ -436,7 +441,7 @@ Report bugs to <tar-bugs@gnu.org>.\n"),
    Y  per-block gzip compression */
 
 #define OPTION_STRING \
-  "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zab:cdf:g:hijklmoprstuvwxz"
+  "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:JZab:cdf:g:hijklmoprstuvwxz"
 
 static void
 set_subcommand_option (enum subcommand subcommand)
@@ -669,6 +674,14 @@ decode_options (int argc, char *const *a
               }
 	      {
 	        ssize_t len=strlen(optarg);
+                if (len>=3 && strcmp(optarg+len-3,".xz")==0) archive_is_xz=1;
+              }
+	      {
+	        ssize_t len=strlen(optarg);
+                if (len>=4 && strcmp(optarg+len-4,".txz")==0) archive_is_xz=1;
+              }
+		  {
+	        ssize_t len=strlen(optarg);
                 if (len>=4 && strcmp(optarg+len-4,".pet")==0) archive_is_gz=1;
               }
 	   }
@@ -869,6 +882,10 @@ decode_options (int argc, char *const *a
         set_use_compress_program_option ("bzip2");
         break;
 
+      case 'J':
+	set_use_compress_program_option ("xz");
+	break;
+
       case 'z':
 	set_use_compress_program_option ("gzip");
 	break;
@@ -1076,6 +1093,7 @@ decode_options (int argc, char *const *a
   if (autodetect_option_used && archive_is_bz2) use_compress_program_option="bzip2";
   if (autodetect_option_used && archive_is_lzma) use_compress_program_option="lzma";
   if (autodetect_option_used && archive_is_z) use_compress_program_option="compress";
+  if (autodetect_option_used && archive_is_xz) use_compress_program_option="xz";  
 
   /* Process trivial options.  */
 
