libarchive-static 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
- data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
- data/ext/libarchive-0.1.1/README.txt +143 -0
- data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
- data/ext/libarchive-0.1.1/ext/configure +3904 -0
- data/ext/libarchive-0.1.1/ext/configure.in +11 -0
- data/ext/libarchive-0.1.1/ext/depend +19 -0
- data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
- data/ext/libarchive-0.1.1/ext/install-sh +250 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
- data/ext/libarchive-0.1.1/libarchive.c +1762 -0
- data/ext/libarchive-2.8.4/Makefile.in +7076 -0
- data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
- data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
- data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
- data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
- data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
- data/ext/libarchive-2.8.4/config.h.in +772 -0
- data/ext/libarchive-2.8.4/configure +17916 -0
- data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
- data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
- data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
- data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
- data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
- data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
- data/ext/libarchive-static-makefile +80 -0
- data/ext/libarchive-static-wrapper-makefile +22 -0
- data/ext/zlib-1.2.5/Makefile.in +257 -0
- data/ext/zlib-1.2.5/adler32.c +169 -0
- data/ext/zlib-1.2.5/compress.c +80 -0
- data/ext/zlib-1.2.5/configure +596 -0
- data/ext/zlib-1.2.5/crc32.c +442 -0
- data/ext/zlib-1.2.5/crc32.h +441 -0
- data/ext/zlib-1.2.5/deflate.c +1834 -0
- data/ext/zlib-1.2.5/deflate.h +342 -0
- data/ext/zlib-1.2.5/example.c +565 -0
- data/ext/zlib-1.2.5/gzclose.c +25 -0
- data/ext/zlib-1.2.5/gzguts.h +132 -0
- data/ext/zlib-1.2.5/gzlib.c +537 -0
- data/ext/zlib-1.2.5/gzread.c +653 -0
- data/ext/zlib-1.2.5/gzwrite.c +531 -0
- data/ext/zlib-1.2.5/infback.c +632 -0
- data/ext/zlib-1.2.5/inffast.c +340 -0
- data/ext/zlib-1.2.5/inffast.h +11 -0
- data/ext/zlib-1.2.5/inffixed.h +94 -0
- data/ext/zlib-1.2.5/inflate.c +1480 -0
- data/ext/zlib-1.2.5/inflate.h +122 -0
- data/ext/zlib-1.2.5/inftrees.c +330 -0
- data/ext/zlib-1.2.5/inftrees.h +62 -0
- data/ext/zlib-1.2.5/minigzip.c +440 -0
- data/ext/zlib-1.2.5/trees.c +1244 -0
- data/ext/zlib-1.2.5/trees.h +128 -0
- data/ext/zlib-1.2.5/uncompr.c +59 -0
- data/ext/zlib-1.2.5/zconf.h +428 -0
- data/ext/zlib-1.2.5/zlib.h +1613 -0
- data/ext/zlib-1.2.5/zutil.c +318 -0
- data/ext/zlib-1.2.5/zutil.h +274 -0
- metadata +211 -0
data/ext/Makefile
ADDED
data/ext/extconf.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
require 'rbconfig' # For RbConfig::CONFIG
|
4
|
+
|
5
|
+
debug = (ARGV[0]=="debug") # Set true to bypass all the removing, unpacking and sh-configure'ing
|
6
|
+
|
7
|
+
cfg = RbConfig::CONFIG # "c" for short...
|
8
|
+
|
9
|
+
zlib = 'zlib-1.2.5'
|
10
|
+
libar = 'libarchive-2.8.4'
|
11
|
+
wrapper = 'libarchive-0.1.1'
|
12
|
+
|
13
|
+
ruby_root = File.dirname cfg['bindir'] # For the Makefiles
|
14
|
+
|
15
|
+
build_root = Dir.getwd
|
16
|
+
|
17
|
+
# Build zlib...
|
18
|
+
puts "Building #{zlib}..."
|
19
|
+
cd zlib do
|
20
|
+
system "sh configure" unless debug or File.exist? 'Makefile'
|
21
|
+
exit $?.exitstatus unless $?.nil? or $?.exitstatus == 0
|
22
|
+
system "make libz.a"
|
23
|
+
exit $?.exitstatus if $?.exitstatus > 0
|
24
|
+
end
|
25
|
+
|
26
|
+
ENV['CFLAGS'] = "-I#{build_root}/#{zlib} -fPIC"
|
27
|
+
ENV['ZLIB_A'] = "#{build_root}/#{zlib}/libz.a"
|
28
|
+
|
29
|
+
# Build libarchive...
|
30
|
+
puts "Building #{libar}..."
|
31
|
+
cd libar do
|
32
|
+
unless debug
|
33
|
+
system "sh configure --with-zlib=yes --without-xml2 --without-expat" unless debug or File.exist? 'Makefile'
|
34
|
+
exit $?.exitstatus unless $?.nil? or $?.exitstatus == 0
|
35
|
+
end
|
36
|
+
cd 'libarchive' do
|
37
|
+
system "make -f ../../libarchive-static-makefile"
|
38
|
+
exit $?.exitstatus unless $?.nil? or $?.exitstatus == 0
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Build the Ruby wrapper around libarchive and zlib...
|
43
|
+
puts "Building wrapper #{wrapper}..."
|
44
|
+
ENV.delete 'LIBS'
|
45
|
+
ENV['LDFLAGS'] = "-L#{ruby_root}/lib -L#{build_root}/#{zlib} -L#{build_root}/#{libar}/libarchive -larchive"
|
46
|
+
ENV['CFLAGS'] = "-fPIC -I#{build_root}/#{libar}/libarchive \
|
47
|
+
-I#{cfg['includedir']}/ruby-#{cfg['ruby_version']}/#{cfg['arch']} \
|
48
|
+
-I#{cfg['includedir']}/ruby-#{cfg['ruby_version']}/ruby/backward \
|
49
|
+
-I#{cfg['includedir']}/ruby-#{cfg['ruby_version']} \
|
50
|
+
-I#{cfg['archdir']} "
|
51
|
+
|
52
|
+
cd "#{wrapper}/ext" do
|
53
|
+
unless debug
|
54
|
+
system "sh configure" unless debug or File.exist? 'Makefile'
|
55
|
+
exit $?.exitstatus unless $?.nil? or $?.exitstatus == 0
|
56
|
+
end
|
57
|
+
system "make -e -f ../../libarchive-static-wrapper-makefile"
|
58
|
+
exit $?.exitstatus if $?.exitstatus > 0
|
59
|
+
end
|
60
|
+
|
61
|
+
exit 0
|
@@ -0,0 +1,60 @@
|
|
1
|
+
The libarchive distribution as a whole is Copyright by Tim Kientzle
|
2
|
+
and is subject to the copyright notice reproduced at the bottom of
|
3
|
+
this file.
|
4
|
+
|
5
|
+
Each individual file in this distribution should have a clear
|
6
|
+
copyright/licensing statement at the beginning of the file. If any do
|
7
|
+
not, please let me know and I will rectify it. The following is
|
8
|
+
intended to summarize the copyright status of the individual files;
|
9
|
+
the actual statements in the files are controlling.
|
10
|
+
|
11
|
+
* Except as listed below, all C sources (including .c and .h files)
|
12
|
+
and documentation files are subject to the copyright notice reproduced
|
13
|
+
at the bottom of this file.
|
14
|
+
|
15
|
+
* The following source files are also subject in whole or in part to
|
16
|
+
a 3-clause UC Regents copyright; please read the individual source
|
17
|
+
files for details:
|
18
|
+
libarchive/archive_entry.c
|
19
|
+
libarchive/archive_read_support_compression_compress.c
|
20
|
+
libarchive/archive_write_set_compression_compress.c
|
21
|
+
libarchive/mtree.5
|
22
|
+
tar/matching.c
|
23
|
+
|
24
|
+
* The following source files are in the public domain:
|
25
|
+
tar/getdate.y
|
26
|
+
|
27
|
+
* The build files---including Makefiles, configure scripts,
|
28
|
+
and auxiliary scripts used as part of the compile process---have
|
29
|
+
widely varying licensing terms. Please check individual files before
|
30
|
+
distributing them to see if those restrictions apply to you.
|
31
|
+
|
32
|
+
I intend for all new source code to use the license below and hope over
|
33
|
+
time to replace code with other licenses with new implementations that
|
34
|
+
do use the license below. The varying licensing of the build scripts
|
35
|
+
seems to be an unavoidable mess.
|
36
|
+
|
37
|
+
|
38
|
+
Copyright (c) 2003-2008 <author(s)>
|
39
|
+
All rights reserved.
|
40
|
+
|
41
|
+
Redistribution and use in source and binary forms, with or without
|
42
|
+
modification, are permitted provided that the following conditions
|
43
|
+
are met:
|
44
|
+
1. Redistributions of source code must retain the above copyright
|
45
|
+
notice, this list of conditions and the following disclaimer
|
46
|
+
in this position and unchanged.
|
47
|
+
2. Redistributions in binary form must reproduce the above copyright
|
48
|
+
notice, this list of conditions and the following disclaimer in the
|
49
|
+
documentation and/or other materials provided with the distribution.
|
50
|
+
|
51
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
52
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
53
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
54
|
+
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
55
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
56
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
57
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
58
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
59
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
60
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
--------------------------------------------------------------------------
|
3
|
+
|
4
|
+
This program, "bzip2", the associated library "libbzip2", and all
|
5
|
+
documentation, are copyright (C) 1996-2007 Julian R Seward. All
|
6
|
+
rights reserved.
|
7
|
+
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
9
|
+
modification, are permitted provided that the following conditions
|
10
|
+
are met:
|
11
|
+
|
12
|
+
1. Redistributions of source code must retain the above copyright
|
13
|
+
notice, this list of conditions and the following disclaimer.
|
14
|
+
|
15
|
+
2. The origin of this software must not be misrepresented; you must
|
16
|
+
not claim that you wrote the original software. If you use this
|
17
|
+
software in a product, an acknowledgment in the product
|
18
|
+
documentation would be appreciated but is not required.
|
19
|
+
|
20
|
+
3. Altered source versions must be plainly marked as such, and must
|
21
|
+
not be misrepresented as being the original software.
|
22
|
+
|
23
|
+
4. The name of the author may not be used to endorse or promote
|
24
|
+
products derived from this software without specific prior written
|
25
|
+
permission.
|
26
|
+
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
28
|
+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
29
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
30
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
31
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
32
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
33
|
+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
34
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
35
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
36
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
37
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
|
39
|
+
Julian Seward, jseward@bzip.org
|
40
|
+
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
41
|
+
|
42
|
+
--------------------------------------------------------------------------
|
@@ -0,0 +1,143 @@
|
|
1
|
+
= Libarchive/Ruby
|
2
|
+
|
3
|
+
Copyright (c) 2009 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Ruby bindings for Libarchive.
|
8
|
+
|
9
|
+
Libarchive is a programming library that can create and read several different streaming archive formats, including most popular tar variants, several cpio formats, and both BSD and GNU ar variants.
|
10
|
+
|
11
|
+
== Support archive (from Libarchive 2.6.0)
|
12
|
+
=== reading
|
13
|
+
* gzip compression
|
14
|
+
* bzip2 compression
|
15
|
+
* compress/LZW compression
|
16
|
+
* GNU tar format (including GNU long filenames, long link names, and
|
17
|
+
sparse files)
|
18
|
+
* Solaris 9 extended tar format (including ACLs)
|
19
|
+
* Old V7 tar archives
|
20
|
+
* POSIX ustar
|
21
|
+
* POSIX pax interchange format
|
22
|
+
* POSIX octet-oriented cpio
|
23
|
+
* SVR4 ASCII cpio
|
24
|
+
* Binary cpio (big-endian or little-endian)
|
25
|
+
* ISO9660 CD-ROM images (with optional Rockridge extensions)
|
26
|
+
* ZIP archives (with uncompressed or "deflate" compressed entries)
|
27
|
+
* GNU and BSD 'ar' archives
|
28
|
+
* 'mtree' format
|
29
|
+
* lzma compression not supported
|
30
|
+
|
31
|
+
=== writing
|
32
|
+
* gzip compression
|
33
|
+
* bzip2 compression
|
34
|
+
* compress/LZW compression
|
35
|
+
* POSIX ustar
|
36
|
+
* POSIX pax interchange format
|
37
|
+
* "restricted" pax format, which will create ustar archives except for entries that require pax extensions (for long filenames, etc).
|
38
|
+
* ACLs not supported
|
39
|
+
* POSIX octet-oriented cpio
|
40
|
+
* SVR4 "newc" cpio
|
41
|
+
* shar archives
|
42
|
+
* GNU and BSD 'ar' archives
|
43
|
+
|
44
|
+
== Project Page
|
45
|
+
|
46
|
+
http://rubyforge.org/projects/libarchive
|
47
|
+
|
48
|
+
== Source Code
|
49
|
+
|
50
|
+
http://coderepos.org/share/browser/lang/ruby/libarchive/trunk/
|
51
|
+
|
52
|
+
== Dependency
|
53
|
+
|
54
|
+
Libarchive/Ruby depend on Libarchive.
|
55
|
+
|
56
|
+
Please install Libarchive. (version 2.6.0 or more is recommended)
|
57
|
+
|
58
|
+
== Install
|
59
|
+
|
60
|
+
gem install libarchive
|
61
|
+
|
62
|
+
== Example
|
63
|
+
=== reading archive
|
64
|
+
require 'libarchive_ruby'
|
65
|
+
|
66
|
+
Archive.read_open_filename('foo.tar.gz') do |ar|
|
67
|
+
while entry = ar.next_header
|
68
|
+
name = entry.pathname
|
69
|
+
data = ar.read_data
|
70
|
+
|
71
|
+
#data = ""
|
72
|
+
#ar.read_data(1024) do |x|
|
73
|
+
# data << x
|
74
|
+
#end
|
75
|
+
|
76
|
+
puts "#{name} (size=#{data.size})"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
=== creating archive
|
81
|
+
require 'libarchive_ruby'
|
82
|
+
|
83
|
+
Archive.write_open_filename('foo.tar.bz2', Archive::COMPRESSION_BZIP2, Archive::FORMAT_TAR_USTAR) do |ar|
|
84
|
+
Dir.glob('*.c').each do |fn|
|
85
|
+
ar.new_entry do |entry|
|
86
|
+
entry.copy_stat(fn)
|
87
|
+
entry.pathname = fn
|
88
|
+
ar.write_header(entry)
|
89
|
+
ar.write_data(open(fn) {|f| f.read })
|
90
|
+
|
91
|
+
#open(fn) do |f|
|
92
|
+
# ar.write_data do
|
93
|
+
# f.read(1024)
|
94
|
+
# end
|
95
|
+
#end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
=== creating archive by extarnal program
|
101
|
+
require 'libarchive_ruby'
|
102
|
+
|
103
|
+
Archive.write_open_filename('foo.tar.lzo', 'lzop', Archive::FORMAT_TAR_USTAR) do |ar|
|
104
|
+
...
|
105
|
+
end
|
106
|
+
|
107
|
+
== License
|
108
|
+
Copyright (c) 2009 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
|
109
|
+
All rights reserved.
|
110
|
+
|
111
|
+
Redistribution and use in source and binary forms, with or without modification,
|
112
|
+
are permitted provided that the following conditions are met:
|
113
|
+
|
114
|
+
* Redistributions of source code must retain the above copyright notice,
|
115
|
+
this list of conditions and the following disclaimer.
|
116
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
117
|
+
this list of conditions and the following disclaimer in the documentation
|
118
|
+
and/or other materials provided with the distribution.
|
119
|
+
* The names of its contributors may be used to endorse or promote products
|
120
|
+
derived from this software without specific prior written permission.
|
121
|
+
|
122
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
123
|
+
ANY EXPRESS OR IMPLIED WARRANTIES,
|
124
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
125
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
126
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
127
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
128
|
+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
129
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
130
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
131
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
132
|
+
DAMAGE.
|
133
|
+
|
134
|
+
=== Static link library
|
135
|
+
Libarchive/Ruby(mswin32) contains Libarchive(2.6.0) and libbzip2(1.0.5).
|
136
|
+
|
137
|
+
* Libarchive
|
138
|
+
* http://people.freebsd.org/~kientzle/libarchive/
|
139
|
+
* see {COPYING.libarchive}[link:files/COPYING_libarchive.html]
|
140
|
+
|
141
|
+
* libbzip2
|
142
|
+
* http://www.bzip.org/
|
143
|
+
* see {LICENSE.libbzip2}[link:files/LICENSE_libbzip2.html]
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#include <errno.h>
|
2
|
+
#include <archive.h>
|
3
|
+
|
4
|
+
static struct {
|
5
|
+
int code;
|
6
|
+
int (*setter)(struct archive *);
|
7
|
+
} codes[] = {
|
8
|
+
{ ARCHIVE_COMPRESSION_NONE, archive_read_support_compression_none },
|
9
|
+
{ ARCHIVE_COMPRESSION_GZIP, archive_read_support_compression_gzip },
|
10
|
+
{ ARCHIVE_COMPRESSION_BZIP2, archive_read_support_compression_bzip2 },
|
11
|
+
{ ARCHIVE_COMPRESSION_COMPRESS, archive_read_support_compression_compress },
|
12
|
+
// XXX:
|
13
|
+
/*
|
14
|
+
{ ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
|
15
|
+
{ ARCHIVE_COMPRESSION_LZMA, archive_read_support_compression_lzma },
|
16
|
+
*/
|
17
|
+
{ -1, NULL },
|
18
|
+
};
|
19
|
+
|
20
|
+
int archive_read_support_compression(struct archive *a, int code) {
|
21
|
+
int i;
|
22
|
+
|
23
|
+
for (i = 0; codes[i].code >= 0; i++) {
|
24
|
+
if (codes[i].code == code) {
|
25
|
+
return codes[i].setter(a);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
archive_set_error(a, EINVAL, "No such compression");
|
30
|
+
return ARCHIVE_FATAL;
|
31
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#include <errno.h>
|
2
|
+
#include <archive.h>
|
3
|
+
|
4
|
+
static struct {
|
5
|
+
int code;
|
6
|
+
int (*setter)(struct archive *);
|
7
|
+
} codes[] = {
|
8
|
+
{ ARCHIVE_FORMAT_CPIO, archive_read_support_format_cpio },
|
9
|
+
{ ARCHIVE_FORMAT_TAR, archive_read_support_format_tar },
|
10
|
+
{ ARCHIVE_FORMAT_TAR_GNUTAR, archive_read_support_format_gnutar },
|
11
|
+
{ ARCHIVE_FORMAT_ISO9660, archive_read_support_format_iso9660 },
|
12
|
+
{ ARCHIVE_FORMAT_ZIP, archive_read_support_format_zip },
|
13
|
+
{ ARCHIVE_FORMAT_EMPTY, archive_read_support_format_empty },
|
14
|
+
{ ARCHIVE_FORMAT_AR, archive_read_support_format_ar },
|
15
|
+
#ifdef ARCHIVE_FORMAT_MTREE
|
16
|
+
{ ARCHIVE_FORMAT_MTREE, archive_read_support_format_mtree },
|
17
|
+
#endif
|
18
|
+
{ -1, NULL },
|
19
|
+
};
|
20
|
+
|
21
|
+
int archive_read_support_format(struct archive *a, int code) {
|
22
|
+
int i;
|
23
|
+
|
24
|
+
for (i = 0; codes[i].code >= 0; i++) {
|
25
|
+
if (codes[i].code == code) {
|
26
|
+
return codes[i].setter(a);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
archive_set_error(a, EINVAL, "No such format");
|
31
|
+
return ARCHIVE_FATAL;
|
32
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#include <archive.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
|
4
|
+
#ifdef _WIN32
|
5
|
+
typedef long ssize_t;
|
6
|
+
#endif
|
7
|
+
|
8
|
+
static int rb_str_write_open(struct archive *a, void *client_data) {
|
9
|
+
if (archive_write_get_bytes_in_last_block(a) == -1) {
|
10
|
+
archive_write_set_bytes_in_last_block(a, 1);
|
11
|
+
}
|
12
|
+
|
13
|
+
return ARCHIVE_OK;
|
14
|
+
}
|
15
|
+
|
16
|
+
static int rb_str_write_close(struct archive *a, void *client_data) {
|
17
|
+
return ARCHIVE_OK;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
|
22
|
+
VALUE str = (VALUE) client_data;
|
23
|
+
rb_str_cat(str, buff, length);
|
24
|
+
return length;
|
25
|
+
}
|
26
|
+
|
27
|
+
int archive_write_open_rb_str(struct archive *a, VALUE str) {
|
28
|
+
return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
|
29
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#include <errno.h>
|
2
|
+
#include <archive.h>
|
3
|
+
|
4
|
+
static struct {
|
5
|
+
int code;
|
6
|
+
int (*setter)(struct archive *);
|
7
|
+
} codes[] = {
|
8
|
+
{ ARCHIVE_COMPRESSION_NONE, archive_write_set_compression_none },
|
9
|
+
{ ARCHIVE_COMPRESSION_GZIP, archive_write_set_compression_gzip },
|
10
|
+
{ ARCHIVE_COMPRESSION_BZIP2, archive_write_set_compression_bzip2 },
|
11
|
+
#if ARCHIVE_VERSION_NUMBER >= 2005000
|
12
|
+
{ ARCHIVE_COMPRESSION_COMPRESS, archive_write_set_compression_compress },
|
13
|
+
#endif
|
14
|
+
// XXX:
|
15
|
+
/*
|
16
|
+
{ ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
|
17
|
+
*/
|
18
|
+
{ -1, NULL },
|
19
|
+
};
|
20
|
+
|
21
|
+
int archive_write_set_compression(struct archive *a, int code) {
|
22
|
+
int i;
|
23
|
+
|
24
|
+
for (i = 0; codes[i].code >= 0; i++) {
|
25
|
+
if (codes[i].code == code) {
|
26
|
+
return codes[i].setter(a);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
archive_set_error(a, EINVAL, "No such compression");
|
31
|
+
return ARCHIVE_FATAL;
|
32
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/* config.h.in. Generated from configure.in by autoheader. */
|
2
|
+
|
3
|
+
/* Define to the address where bug reports for this package should be sent. */
|
4
|
+
#undef PACKAGE_BUGREPORT
|
5
|
+
|
6
|
+
/* Define to the full name of this package. */
|
7
|
+
#undef PACKAGE_NAME
|
8
|
+
|
9
|
+
/* Define to the full name and version of this package. */
|
10
|
+
#undef PACKAGE_STRING
|
11
|
+
|
12
|
+
/* Define to the one symbol short name of this package. */
|
13
|
+
#undef PACKAGE_TARNAME
|
14
|
+
|
15
|
+
/* Define to the version of this package. */
|
16
|
+
#undef PACKAGE_VERSION
|
17
|
+
|
18
|
+
/* Number of bits in a file offset, on hosts where this is settable. */
|
19
|
+
#undef _FILE_OFFSET_BITS
|
20
|
+
|
21
|
+
/* Define for large files, on AIX-style hosts. */
|
22
|
+
#undef _LARGE_FILES
|