snappy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/ext/extconf.rb +39 -12
  3. data/snappy.gemspec +2 -2
  4. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/ext/extconf.rb CHANGED
@@ -1,12 +1,8 @@
1
1
  require 'mkmf'
2
2
  require 'fileutils'
3
3
 
4
- unless have_library 'snappy'
5
- have_header 'sys/mman.h'
6
-
7
- have_header 'stdint.h'
8
-
9
- have_header 'stddef.h'
4
+ def try_configure
5
+ return if system "./configure --disable-option-checking --disable-dependency-tracking --disable-gtest --without-gflags"
10
6
 
11
7
  if try_run 'int main(int argc, char** argv){ return __builtin_expect(1, 1) ? 0 : 1; }'
12
8
  $defs << '-DHAVE_BUILTIN_EXPECT'
@@ -16,15 +12,45 @@ unless have_library 'snappy'
16
12
  $defs << '-DHAVE_BUILTIN_CTZ'
17
13
  end
18
14
 
19
- dst = File.expand_path Dir.pwd
15
+ have_header 'dlfcn.h'
16
+ have_header 'inttypes.h'
17
+ have_header 'memory.h'
18
+ have_header 'stddef.h'
19
+ have_header 'stdint.h'
20
+ have_header 'stdlib.h'
21
+ have_header 'strings.h'
22
+ have_header 'string.h'
23
+ have_header 'sys/mman.h'
24
+ have_header 'sys/stat.h'
25
+ have_header 'sys/types.h'
26
+ have_header 'sys/resource.h'
27
+ have_header 'unistd.h'
28
+
29
+ if try_run 'int main(int argc, char** argv){ int i = 1; return *((char*)&i); }'
30
+ $defs << '-DWORDS_BIGENDIAN'
31
+ end
32
+ end
33
+
34
+ unless have_library 'snappy'
35
+ dst = File.dirname File.expand_path __FILE__
20
36
 
21
- ver = "1.0.1"
37
+ tar = 'tar'
38
+ tar = 'gnutar' if find_executable 'gnutar'
39
+
40
+ ver = "1.0.2"
22
41
  src = "snappy-#{ver}"
23
- FileUtils.rm_rf src
24
42
 
25
- system "curl -s http://snappy.googlecode.com/files/#{src}.tar.gz | tar xz"
43
+ FileUtils.rm_rf File.join dst, src
44
+ system "curl -s http://snappy.googlecode.com/files/#{src}.tar.gz | #{tar} xz"
45
+
46
+ src = File.join dst, src
47
+
48
+ Dir.chdir src do
49
+ try_configure
50
+ end
26
51
 
27
52
  %w(
53
+ config.h
28
54
  snappy-internal.h
29
55
  snappy-sinksource.cc
30
56
  snappy-sinksource.h
@@ -33,7 +59,7 @@ snappy-stubs-internal.h
33
59
  snappy.cc
34
60
  snappy.h
35
61
  ).each do |file|
36
- FileUtils.copy File.join(src, file), File.join(dst, file)
62
+ FileUtils.copy File.join(src, file), File.join(dst, file) if FileTest.exist? File.join(src, file)
37
63
  end
38
64
 
39
65
  hdr = File.open(File.join(src, 'snappy-stubs-public.h.in'), 'rb'){ |f| f.read }
@@ -42,10 +68,11 @@ snappy.h
42
68
  %r'#if @ac_cv_have_stddef_h@' => '#ifdef HAVE_STDDEF_H',
43
69
  %r'@SNAPPY_MAJOR@' => '1',
44
70
  %r'@SNAPPY_MINOR@' => '0',
45
- %r'@SNAPPY_PATCHLEVEL@' => '1',
71
+ %r'@SNAPPY_PATCHLEVEL@' => '2',
46
72
  }.each { |ptn, str| hdr.gsub! ptn, str }
47
73
  File.open(File.join(dst, 'snappy-stubs-public.h'), 'wb'){ |f| f.write hdr }
48
74
 
75
+ FileUtils.touch 'config.h'
49
76
  end
50
77
 
51
78
  have_library 'stdc++'
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.1"
8
+ s.version = "0.0.2"
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-29}
12
+ s.date = %q{2011-05-09}
13
13
  s.description = %q{libsnappy binding for Ruby}
14
14
  s.email = %q{miyucy@gmail.com}
15
15
  s.extensions = ["ext/extconf.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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - miyucy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-29 00:00:00 +09:00
18
+ date: 2011-05-09 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency