snappy 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ext/{snappy.cc → api.cc} +3 -0
- data/ext/extconf.rb +50 -3
- data/snappy.gemspec +3 -3
- metadata +21 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/ext/{snappy.cc → api.cc}
RENAMED
@@ -37,6 +37,9 @@ void Init_snappy()
|
|
37
37
|
rb_define_singleton_method(rb_mSnappy, "deflate", (VALUE (*)(...))snappy_deflate, 1);
|
38
38
|
rb_define_singleton_method(rb_mSnappy, "inflate", (VALUE (*)(...))snappy_inflate, 1);
|
39
39
|
|
40
|
+
rb_define_singleton_method(rb_mSnappy, "compress", (VALUE (*)(...))snappy_deflate, 1);
|
41
|
+
rb_define_singleton_method(rb_mSnappy, "uncompress", (VALUE (*)(...))snappy_inflate, 1);
|
42
|
+
|
40
43
|
i_to_s = rb_intern("to_s");
|
41
44
|
}
|
42
45
|
}
|
data/ext/extconf.rb
CHANGED
@@ -1,5 +1,52 @@
|
|
1
1
|
require 'mkmf'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
|
-
have_library
|
4
|
-
|
5
|
-
|
4
|
+
unless have_library 'snappy'
|
5
|
+
have_header 'sys/mman.h'
|
6
|
+
|
7
|
+
have_header 'stdint.h'
|
8
|
+
|
9
|
+
have_header 'stddef.h'
|
10
|
+
|
11
|
+
if try_run 'int main(int argc, char** argv){ return __builtin_expect(1, 1) ? 0 : 1; }'
|
12
|
+
$defs << '-DHAVE_BUILTIN_EXPECT'
|
13
|
+
end
|
14
|
+
|
15
|
+
if try_run 'int main(int argc, char** argv){ return (__builtin_ctzll(0x100000000LL) == 32) ? 0 : 1; }'
|
16
|
+
$defs << '-DHAVE_BUILTIN_CTZ'
|
17
|
+
end
|
18
|
+
|
19
|
+
dst = File.expand_path Dir.pwd
|
20
|
+
|
21
|
+
ver = "1.0.1"
|
22
|
+
src = "snappy-#{ver}"
|
23
|
+
FileUtils.rm_rf src
|
24
|
+
|
25
|
+
system "curl -s http://snappy.googlecode.com/files/#{src}.tar.gz | tar xz"
|
26
|
+
|
27
|
+
%w(
|
28
|
+
snappy-internal.h
|
29
|
+
snappy-sinksource.cc
|
30
|
+
snappy-sinksource.h
|
31
|
+
snappy-stubs-internal.cc
|
32
|
+
snappy-stubs-internal.h
|
33
|
+
snappy.cc
|
34
|
+
snappy.h
|
35
|
+
).each do |file|
|
36
|
+
FileUtils.copy File.join(src, file), File.join(dst, file)
|
37
|
+
end
|
38
|
+
|
39
|
+
hdr = File.open(File.join(src, 'snappy-stubs-public.h.in'), 'rb'){ |f| f.read }
|
40
|
+
{
|
41
|
+
%r'#if @ac_cv_have_stdint_h@' => '#ifdef HAVE_STDINT_H',
|
42
|
+
%r'#if @ac_cv_have_stddef_h@' => '#ifdef HAVE_STDDEF_H',
|
43
|
+
%r'@SNAPPY_MAJOR@' => '1',
|
44
|
+
%r'@SNAPPY_MINOR@' => '0',
|
45
|
+
%r'@SNAPPY_PATCHLEVEL@' => '1',
|
46
|
+
}.each { |ptn, str| hdr.gsub! ptn, str }
|
47
|
+
File.open(File.join(dst, 'snappy-stubs-public.h'), 'wb'){ |f| f.write hdr }
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
have_library 'stdc++'
|
52
|
+
create_makefile 'snappy'
|
data/snappy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{snappy}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["miyucy"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-29}
|
13
13
|
s.description = %q{libsnappy binding for Ruby}
|
14
14
|
s.email = %q{miyucy@gmail.com}
|
15
15
|
s.extensions = ["ext/extconf.rb"]
|
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
"README.rdoc",
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
|
+
"ext/api.cc",
|
29
30
|
"ext/extconf.rb",
|
30
|
-
"ext/snappy.cc",
|
31
31
|
"snappy.gemspec",
|
32
32
|
"spec/snappy_spec.rb",
|
33
33
|
"spec/spec_helper.rb"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snappy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- miyucy
|
@@ -15,13 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-29 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
type: :development
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
27
25
|
- - ~>
|
@@ -32,12 +30,12 @@ dependencies:
|
|
32
30
|
- 3
|
33
31
|
- 0
|
34
32
|
version: 2.3.0
|
35
|
-
name: rspec
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
33
|
prerelease: false
|
39
34
|
type: :development
|
40
|
-
requirement:
|
35
|
+
requirement: *id001
|
36
|
+
name: rspec
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
40
|
requirements:
|
43
41
|
- - ~>
|
@@ -48,12 +46,12 @@ dependencies:
|
|
48
46
|
- 0
|
49
47
|
- 0
|
50
48
|
version: 1.0.0
|
51
|
-
name: bundler
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
49
|
prerelease: false
|
55
50
|
type: :development
|
56
|
-
requirement:
|
51
|
+
requirement: *id002
|
52
|
+
name: bundler
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
58
56
|
requirements:
|
59
57
|
- - ~>
|
@@ -64,12 +62,12 @@ dependencies:
|
|
64
62
|
- 5
|
65
63
|
- 2
|
66
64
|
version: 1.5.2
|
67
|
-
name: jeweler
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
65
|
prerelease: false
|
71
66
|
type: :development
|
72
|
-
requirement:
|
67
|
+
requirement: *id003
|
68
|
+
name: jeweler
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
73
71
|
none: false
|
74
72
|
requirements:
|
75
73
|
- - ">="
|
@@ -78,8 +76,10 @@ dependencies:
|
|
78
76
|
segments:
|
79
77
|
- 0
|
80
78
|
version: "0"
|
79
|
+
prerelease: false
|
80
|
+
type: :development
|
81
|
+
requirement: *id004
|
81
82
|
name: rcov
|
82
|
-
version_requirements: *id004
|
83
83
|
description: libsnappy binding for Ruby
|
84
84
|
email: miyucy@gmail.com
|
85
85
|
executables: []
|
@@ -98,8 +98,8 @@ files:
|
|
98
98
|
- README.rdoc
|
99
99
|
- Rakefile
|
100
100
|
- VERSION
|
101
|
+
- ext/api.cc
|
101
102
|
- ext/extconf.rb
|
102
|
-
- ext/snappy.cc
|
103
103
|
- snappy.gemspec
|
104
104
|
- spec/snappy_spec.rb
|
105
105
|
- spec/spec_helper.rb
|