File http-parser.spec of Package http-parser
Name: http-parser
Version: 2.8.0
Release: 1%{?dist}
Summary: HTTP request/response parser for C
License: MIT
URL: https://github.com/nodejs/http-parser
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: meson
BuildRequires: gcc
%if 0%{?rhel} == 7
BuildRequires: epel-rpm-macros
%endif
%description
This is a parser for HTTP messages written in C. It parses both requests and
responses. The parser is designed to be used in performance HTTP applications.
It does not make any syscalls nor allocations, it does not buffer data, it can
be interrupted at anytime. Depending on your architecture, it only requires
about 40 bytes of data per message stream (in a web server that is per
connection).
%package devel
Summary: Development headers and libraries for http-parser
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
Development headers and libraries for http-parser.
%prep
%autosetup -p1
# TODO: try to send upstream?
cat > meson.build << EOF
project('%{name}', 'c', version : '%{version}')
install_headers('http_parser.h')
foreach x : [['http_parser', ['-DHTTP_PARSER_STRICT=0']],
['http_parser_strict', ['-DHTTP_PARSER_STRICT=1']]]
lib = library(x.get(0), 'http_parser.c',
c_args : x.get(1),
version : '%{version}',
install : true)
test('test-@0@'.format(x.get(0)),
executable('test-@0@'.format(x.get(0)), 'test.c',
c_args : x.get(1),
link_with : lib),
timeout : 60)
endforeach
EOF
%build
%meson
%meson_build
%install
%meson_install
%check
%meson_test
%ldconfig_scriptlets
%files
%license LICENSE-MIT
%doc AUTHORS README.md
%{_libdir}/libhttp_parser.so.*
%{_libdir}/libhttp_parser_strict.so.*
%files devel
%{_includedir}/http_parser.h
%{_libdir}/libhttp_parser.so
%{_libdir}/libhttp_parser_strict.so