1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-18 08:45:22 +03:00
aports/testing/ruby-http_parser.rb/use-system-libhttp_parser.patch
2021-06-30 00:11:42 +00:00

50 lines
1.7 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Link with system-provided libhttp_parser.
mongrel is dead, the last release is from 2009, so Idon'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) \