Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify extconf.rb and make it work on OSX

  • Loading branch information...
commit c0c1967f63bd7fb02e93301903b743d987cd2af5 1 parent cd6b6d6
Aman Gupta authored
Showing with 15 additions and 18 deletions.
  1. +15 −18 ext/extconf.rb
33 ext/extconf.rb
View
@@ -1,32 +1,29 @@
require "mkmf"
require "fileutils"
+def sys(cmd)
+ puts " -- #{cmd}"
+ unless ret = xsystem(cmd)
+ raise "#{cmd} failed, please report to https://github.com/ibc/em-udns/issues"
+ end
+ ret
+end
-here = File.expand_path(File.dirname(__FILE__))
-udns_tarball = Dir.glob("#{here}/udns-*.tar.gz").first
-udns_path = udns_tarball.gsub(".tar.gz", "")
+here = File.expand_path('../', __FILE__)
+udns_tarball = Dir["#{here}/udns-*.tar.gz"].first
+udns_path = File.basename(udns_tarball, '.tar.gz')
Dir.chdir(here) do
- puts(cmd = "tar xzf #{udns_tarball} 2>&1")
- raise "'#{cmd}' failed" unless system(cmd)
+ sys("tar zxvf #{udns_tarball}")
Dir.chdir(udns_path) do
- puts(cmd = "./configure 2>&1")
- raise "'#{cmd}' failed" unless system(cmd)
-
- puts(cmd = "make sharedlib 2>&1")
- raise "'#{cmd}' failed" unless system(cmd)
+ sys("./configure")
+ sys("make libudns.a")
- puts(cmd = "ar r libudns.a *.lo 2>&1")
- raise "'#{cmd}' failed" unless system(cmd)
-
- FileUtils.mv "libudns.a", "../"
- FileUtils.mv "udns.h", "../"
+ FileUtils.cp 'libudns.a', here
+ FileUtils.cp 'udns.h', here
end
-
- FileUtils.remove_dir(udns_path, force = true)
end
-
have_library("udns") # == -ludns
create_makefile("em_udns_ext")

1 comment on commit c0c1967

Iñaki Baz Castillo

Hi Aman, please check my comment about it:
https://github.com/ibc/em-udns/issues#issue/1/comment/770010

Your code doesn't compile under Linux 64 bits (and maybe neither under MacOSX 64 bits).

Please sign in to comment.
Something went wrong with that request. Please try again.