em-udns 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/em-udns.c +0 -1
  2. data/ext/extconf.rb +50 -10
  3. metadata +49 -33
data/ext/em-udns.c CHANGED
@@ -1,5 +1,4 @@
1
1
  #include <ruby.h>
2
- #include <ctype.h>
3
2
  #include <netinet/in.h>
4
3
  #include "udns.h"
5
4
  #include "em-udns.h"
data/ext/extconf.rb CHANGED
@@ -1,25 +1,66 @@
1
1
  require "mkmf"
2
+ require "rbconfig"
2
3
  require "fileutils"
3
4
 
4
5
 
6
+ def sys(cmd)
7
+ puts "system command: #{cmd}"
8
+ unless ret = xsystem(cmd)
9
+ raise "system command `#{cmd}' failed, please report to https://github.com/ibc/em-udns/issues"
10
+ end
11
+ ret
12
+ end
13
+
14
+
5
15
  here = File.expand_path(File.dirname(__FILE__))
6
16
  udns_tarball = Dir.glob("#{here}/udns-*.tar.gz").first
7
- udns_path = udns_tarball.gsub(".tar.gz", "")
17
+ udns_path = File.basename(udns_tarball, ".tar.gz")
8
18
 
9
19
  Dir.chdir(here) do
10
- puts(cmd = "tar xzf #{udns_tarball} 2>&1")
11
- raise "'#{cmd}' failed" unless system(cmd)
20
+ sys("tar zxf #{udns_tarball}")
12
21
 
13
22
  Dir.chdir(udns_path) do
14
- puts(cmd = "./configure 2>&1")
15
- raise "'#{cmd}' failed" unless system(cmd)
23
+ sys("./configure")
24
+
25
+ case host_os = RbConfig::CONFIG["host_os"]
26
+
27
+ # Linux.
28
+ # Under Linux 64 bits udns must be compiled dynamically (also works for 32 bits):
29
+ # https://github.com/ibc/em-udns/issues#issue/1
30
+ when /linux/i
31
+ sys("make sharedlib")
32
+ sys("ar r libudns.a *.lo")
16
33
 
17
- puts(cmd = "make sharedlib 2>&1")
18
- raise "'#{cmd}' failed" unless system(cmd)
34
+ # BSD.
35
+ # TODO: Not tested. Let's try same as under Linux.
36
+ when /bsd/i
37
+ sys("make sharedlib")
38
+ sys("ar r libudns.a *.lo")
19
39
 
20
- puts(cmd = "ar r libudns.a *.lo 2>&1")
21
- raise "'#{cmd}' failed" unless system(cmd)
40
+ # Solaris.
41
+ # TODO: Not tested. Let's try same as under Linux.
42
+ when /solaris/i
43
+ sys("make sharedlib")
44
+ sys("ar r libudns.a *.lo")
45
+
46
+ # Mac OSX.
47
+ # TODO: This is tested under OSX 32 bits, it could fail under OSX 64 bits (not tested).
48
+ when /darwin|mac os/
49
+ sys("make libudns.a")
22
50
 
51
+ # Windows.
52
+ # NOTE: udns doesn't work on Windows, but there is a port:
53
+ # http://network-research.org/udns.html
54
+ when /mswin|msys|mingw32|windows/i
55
+ raise "udns doesn't compile on Windows, you can try a Windows port: http://network-research.org/udns.html," \
56
+ "report to https://github.com/ibc/em-udns/issues"
57
+
58
+ # Other platforms. Error.
59
+ else
60
+ raise "unknown operating system: #{host_os.inspect}"
61
+
62
+ end
63
+
23
64
  FileUtils.mv "libudns.a", "../"
24
65
  FileUtils.mv "udns.h", "../"
25
66
  end
@@ -27,6 +68,5 @@ Dir.chdir(here) do
27
68
  FileUtils.remove_dir(udns_path, force = true)
28
69
  end
29
70
 
30
-
31
71
  have_library("udns") # == -ludns
32
72
  create_makefile("em_udns_ext")
metadata CHANGED
@@ -1,38 +1,44 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: em-udns
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 3
9
+ version: 0.1.3
6
10
  platform: ruby
7
- authors:
8
- - Iñaki Baz Castillo
11
+ authors:
12
+ - "I\xC3\xB1aki Baz Castillo"
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-02-14 00:00:00.000000000 +01:00
16
+
17
+ date: 2011-02-18 00:00:00 +01:00
13
18
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
16
21
  name: eventmachine
17
- requirement: &9925860 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
18
24
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
23
31
  type: :runtime
24
- prerelease: false
25
- version_requirements: *9925860
26
- description: em-udns is an async DNS resolver for EventMachine based on udns C library.
27
- Having most of the core written in C, em-udns becomes very fast. It can resolve
28
- DNS A, AAAA, PTR, MX, TXT, SRV and NAPTR records, and can handle every kind of errors
29
- (domain/record not found, request timeout, malformed response...).
32
+ version_requirements: *id001
33
+ description: em-udns is an async DNS resolver for EventMachine based on udns C library. Having most of the core written in C, em-udns becomes very fast. It can resolve DNS A, AAAA, PTR, MX, TXT, SRV and NAPTR records, and can handle every kind of errors (domain/record not found, request timeout, malformed response...).
30
34
  email: ibc@aliax.net
31
35
  executables: []
32
- extensions:
36
+
37
+ extensions:
33
38
  - ext/extconf.rb
34
39
  extra_rdoc_files: []
35
- files:
40
+
41
+ files:
36
42
  - lib/em-udns.rb
37
43
  - lib/em-udns/resolver.rb
38
44
  - ext/em-udns.c
@@ -43,26 +49,36 @@ files:
43
49
  has_rdoc: true
44
50
  homepage: https://github.com/ibc/em-udns
45
51
  licenses: []
52
+
46
53
  post_install_message:
47
54
  rdoc_options: []
48
- require_paths:
55
+
56
+ require_paths:
49
57
  - lib
50
- required_ruby_version: !ruby/object:Gem::Requirement
58
+ required_ruby_version: !ruby/object:Gem::Requirement
51
59
  none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 1
65
+ - 8
66
+ - 7
55
67
  version: 1.8.7
56
- required_rubygems_version: !ruby/object:Gem::Requirement
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
69
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
62
76
  requirements: []
77
+
63
78
  rubyforge_project:
64
- rubygems_version: 1.5.2
79
+ rubygems_version: 1.3.7
65
80
  signing_key:
66
81
  specification_version: 3
67
82
  summary: Async DNS resolver for EventMachine based on udns C library
68
83
  test_files: []
84
+