File: extconf.rb

package info (click to toggle)
ruby-http-parser.rb 0.6.0-4%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 376 kB
  • sloc: java: 431; ansic: 412; ruby: 355; makefile: 20
file content (24 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'mkmf'

# check out code if it hasn't been already
if Dir[File.expand_path('../vendor/http-parser/*', __FILE__)].empty?
  Dir.chdir(File.expand_path('../../../', __FILE__)) do
    xsystem 'git submodule init'
    xsystem 'git submodule update'
  end
end

# mongrel and http-parser both define http_parser_(init|execute), so we
# rename functions in http-parser before using them.
vendor_dir = File.expand_path('../vendor/http-parser/', __FILE__)
src_dir = File.expand_path('../', __FILE__)
%w[ http_parser.c http_parser.h ].each do |file|
  File.open(File.join(src_dir, "ryah_#{file}"), 'w'){ |f|
    f.write File.read(File.join(vendor_dir, file)).gsub('http_parser', 'ryah_http_parser')
  }
end

$CFLAGS << " -I#{src_dir}"

dir_config("ruby_http_parser")
create_makefile("ruby_http_parser")