http-parser/http-parser.spec

116 lines
4.0 KiB
RPMSpec
Raw Normal View History

#
# spec file for package http-parser
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define somajor suse0
%define libname libhttp-parser-%{somajor}
Name: http-parser
Version: 2.7.1
Release: 0
Summary: HTTP request/response parser for C
License: MIT
Group: Development/Libraries/C and C++
Url: https://github.com/joyent/http-parser
Source0: https://github.com/joyent/http-parser/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: baselibs.conf
Patch1: http-parser-gyp-sharedlib.patch
BuildRequires: gcc-c++
BuildRequires: gyp
%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 -n %{libname}
Summary: HTTP request/response parser for C
Group: System/Libraries
%description -n %{libname}
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
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
%description devel
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).
Development headers and libraries for http-parser.
%prep
%setup -q
%patch1 -p1
%build
# TODO: fix -fPIC upstream
export CFLAGS='%{optflags} -fPIC'
gyp -f make --depth=`pwd` http_parser.gyp
make %{?_smp_mflags} BUILDTYPE=Release
%install
install -d %{buildroot}%{_includedir}
install -d %{buildroot}%{_libdir}
install -pm644 http_parser.h %{buildroot}%{_includedir}
#install regular variant
install "out/Release/lib.target/libhttp_parser.so.%{somajor}" "%{buildroot}/%{_libdir}/"
ln -sf "libhttp_parser.so.%{somajor}" "%{buildroot}/%{_libdir}/libhttp_parser.so"
#install strict variant
install "out/Release/lib.target/libhttp_parser_strict.so.%{somajor}" "%{buildroot}/%{_libdir}/"
ln -sf "libhttp_parser_strict.so.%{somajor}" "%{buildroot}/%{_libdir}/libhttp_parser_strict.so"
%check
export LD_LIBRARY_PATH='./out/Release/lib.target'
./out/Release/test-nonstrict
./out/Release/test-strict
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
%defattr(-,root,root)
%doc AUTHORS LICENSE-MIT README.md
%{_libdir}/libhttp_parser.so.*
%{_libdir}/libhttp_parser_strict.so.*
%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/libhttp_parser.so
%{_libdir}/libhttp_parser_strict.so
%changelog