mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-18 08:45:22 +03:00
50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
Link with system-provided libhttp_parser.
|
||
|
||
mongrel is dead, the last release is from 2009, so I don't think it
|
||
there's still some risk of symbols clash.
|
||
|
||
--- a/ext/ruby_http_parser/extconf.rb
|
||
+++ b/ext/ruby_http_parser/extconf.rb
|
||
@@ -1,24 +1,7 @@
|
||
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}"
|
||
+$CFLAGS << ' -Wall -Wextra'
|
||
+$LDFLAGS << ' -lhttp_parser'
|
||
|
||
dir_config("ruby_http_parser")
|
||
create_makefile("ruby_http_parser")
|
||
--- a/ext/ruby_http_parser/ruby_http_parser.c
|
||
+++ b/ext/ruby_http_parser/ruby_http_parser.c
|
||
@@ -1,6 +1,12 @@
|
||
#include "ruby.h"
|
||
#include "ext_help.h"
|
||
-#include "ryah_http_parser.h"
|
||
+#include "http_parser.h"
|
||
+
|
||
+#define ryah_http_parser http_parser
|
||
+#define ryah_http_parser_execute http_parser_execute
|
||
+#define ryah_http_parser_init http_parser_init
|
||
+#define ryah_http_parser_settings http_parser_settings
|
||
+#define ryah_http_parser_type http_parser_type
|
||
|
||
#define GET_WRAPPER(N, from) ParserWrapper *N = (ParserWrapper *)(from)->data;
|
||
#define HASH_CAT(h, k, ptr, len) \
|