Sha256: 393e4a49336f67e6bd51e5af366cd77e67f531b7ec874021fccd32029a1a6c4b

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require "mkmf"

def tweak_include
  dir = File.dirname __FILE__
  multipart_dir = File.join dir, "multipart-parser-c"
  http_parser_dir = File.join dir, "http-parser"
  flags = " -I#{multipart_dir.shellescape} -I#{http_parser_dir.shellescape}"
  $CFLAGS << flags
  $CPPFLAGS << flags
end

def tweak_cflags
  mf_conf = RbConfig::MAKEFILE_CONFIG
  if mf_conf['CC'] =~ /clang/
    # enable c++11. this can not be installed on $CPPFLAGS, wtf??
    mf_conf['CXXFLAGS'] << ' -stdlib=libc++ -std=c++11'
    $CFLAGS << ' $(xflags)'
  else
    mf_conf['CXXFLAGS'] << ' -std=c++11'
    $CFLAGS << ' -std=c99 -Wno-declaration-after-statement $(xflags)'
  end

  $CPPFLAGS << ' $(xflags)'
  puts "To enable debug: make xflags='-DDEBUG -O0'"
end

have_kqueue = (have_header("sys/event.h") and have_header("sys/queue.h"))
have_epoll = have_func('epoll_create', 'sys/epoll.h')
abort('no kqueue nor epoll') if !have_kqueue and !have_epoll
$defs << "-DNDEBUG -D#{have_epoll ? 'HAVE_EPOLL' : 'HAVE_KQUEUE'}"

tweak_include
tweak_cflags
create_makefile 'nyara'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nyara-0.0.1.pre.2 ext/extconf.rb
nyara-0.0.1.pre.1 ext/extconf.rb
nyara-0.0.1.pre ext/extconf.rb