3ba45f1
# we use the upstream version from http_parser.h as the SONAME
3ba45f1
%global somajor 2
5b87ba4
%global sominor 7
5b87ba4
%global sopoint 1
bbd587f
bbd587f
Name:           http-parser
8567b0f
Version:        %{somajor}.%{sominor}.%{sopoint}
0cb0b0d
Release:        4%{?dist}
bbd587f
Summary:        HTTP request/response parser for C
bbd587f
bbd587f
License:        MIT
0cb0b0d
URL:            https://github.com/nodejs/http-parser
0cb0b0d
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
8567b0f
0cb0b0d
# https://github.com/nodejs/http-parser/commit/335850f6b868d3411968cbf5a4d59fe619dee36f
0cb0b0d
Patch0001:      %{name}-0001-parser-HTTP_STATUS_MAP-XX-and-enum-http_status.patch
bbd587f
0cb0b0d
BuildRequires:  gcc
0cb0b0d
BuildRequires:  cmake
3ba45f1
bbd587f
%description
bbd587f
This is a parser for HTTP messages written in C. It parses both requests and
bbd587f
responses. The parser is designed to be used in performance HTTP applications.
bbd587f
It does not make any syscalls nor allocations, it does not buffer data, it can
bbd587f
be interrupted at anytime. Depending on your architecture, it only requires
bbd587f
about 40 bytes of data per message stream (in a web server that is per
bbd587f
connection).
bbd587f
bbd587f
%package devel
bbd587f
Summary:        Development headers and libraries for http-parser
0cb0b0d
Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
bbd587f
bbd587f
%description devel
0cf3a66
Development headers and libraries for http-parser.
bbd587f
bbd587f
%prep
0cb0b0d
%autosetup -p1
0cb0b0d
# TODO: try to send upstream?
0cb0b0d
cat > CMakeLists.txt << EOF
0cb0b0d
cmake_minimum_required (VERSION 2.8.5)
0cb0b0d
project (http-parser C)
0cb0b0d
include (GNUInstallDirs)
0cb0b0d
0cb0b0d
set (SRCS http_parser.c)
0cb0b0d
set (HDRS http_parser.h)
0cb0b0d
set (TEST_SRCS test.c)
0cb0b0d
0cb0b0d
# Non-Strict version
0cb0b0d
add_library (http_parser \${SRCS})
0cb0b0d
target_compile_definitions (http_parser
0cb0b0d
                            PUBLIC -DHTTP_PARSER_STRICT=0)
0cb0b0d
add_executable (test-nonstrict \${TEST_SRCS})
0cb0b0d
target_link_libraries (test-nonstrict http_parser)
0cb0b0d
# Strict version
0cb0b0d
add_library (http_parser_strict \${SRCS})
0cb0b0d
target_compile_definitions (http_parser_strict
0cb0b0d
                            PUBLIC -DHTTP_PARSER_STRICT=1)
0cb0b0d
add_executable (test-strict \${TEST_SRCS})
0cb0b0d
target_link_libraries (test-strict http_parser_strict)
0cb0b0d
0cb0b0d
set_target_properties (http_parser http_parser_strict
0cb0b0d
                       PROPERTIES
0cb0b0d
                           SOVERSION %{somajor}
0cb0b0d
                           VERSION %{version})
0cb0b0d
0cb0b0d
install (TARGETS http_parser http_parser_strict
0cb0b0d
         LIBRARY DESTINATION \${CMAKE_INSTALL_LIBDIR})
0cb0b0d
install (FILES \${HDRS}
0cb0b0d
         DESTINATION \${CMAKE_INSTALL_INCLUDEDIR})
0cb0b0d
0cb0b0d
enable_testing ()
0cb0b0d
add_test (NAME test-nonstrict COMMAND test-nonstrict)
0cb0b0d
add_test (NAME test-strict COMMAND test-strict)
0cb0b0d
EOF
bbd587f
bbd587f
%build
0cb0b0d
mkdir %{_target_platform}
0cb0b0d
pushd %{_target_platform}
0cb0b0d
  %cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
0cb0b0d
popd
0cb0b0d
%make_build -C %{_target_platform}
bbd587f
bbd587f
%install
0cb0b0d
%make_install -C %{_target_platform}
bbd587f
12744ac
%check
0cb0b0d
make test -C %{_target_platform}
bbd587f
bbd587f
%post -p /sbin/ldconfig
bbd587f
%postun -p /sbin/ldconfig
bbd587f
bbd587f
%files
bbd587f
%{_libdir}/libhttp_parser.so.*
d14b316
%{_libdir}/libhttp_parser_strict.so.*
8567b0f
%doc AUTHORS README.md
8567b0f
%license LICENSE-MIT
bbd587f
bbd587f
%files devel
0cb0b0d
%{_includedir}/http_parser.h
bbd587f
%{_libdir}/libhttp_parser.so
d14b316
%{_libdir}/libhttp_parser_strict.so
bbd587f
bbd587f
%changelog
0cb0b0d
* Mon Nov 21 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 2.7.1-4
0cb0b0d
- Use CMake buildsystem
0cb0b0d
05ce28f
* Tue Oct 25 2016 Nathaniel McCallum <npmccallum@redhat.com> - 2.7.1-3
05ce28f
- Add (upstreamed) status code patch
05ce28f
5b87ba4
* Tue Aug 16 2016 Stephen Gallagher <sgallagh@redhat.com> - 2.7.1-2
5b87ba4
- Upgrade to version 2.7.1
5b87ba4
049e9b5
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-2
049e9b5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
049e9b5
8567b0f
* Tue Dec 01 2015 Stephen Gallagher <sgallagh@redhat.com> 2.6.0-1
8567b0f
- Upgrade to version 2.6.0
8567b0f
- Change to new upstream at https://github.com/nodejs/http-parser/
8567b0f
beb3289
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-9.20121128gitcd01361
beb3289
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
beb3289
62a0c6e
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 2.0-8.20121128gitcd01361
62a0c6e
- Rebuilt for GCC 5 C++11 ABI change
62a0c6e
72e8ca5
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-7.20121128gitcd01361
72e8ca5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
72e8ca5
13dbe10
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-6.20121128gitcd01361
13dbe10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
13dbe10
a044ad9
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-5.20121128gitcd01361
a044ad9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
b979bd3
1511f52
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-4.20121128gitcd01361
1511f52
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
1511f52
12744ac
* Sun Dec 02 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-3.20121128gitcd01361
12744ac
- latest git snapshot
12744ac
- fixes buffer overflow in tests
12744ac
d14b316
* Tue Nov 27 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-2.20121110git245f6f0
d14b316
- latest git snapshot
12744ac
- fixes tests
d14b316
- use SMP make flags
d14b316
- build as Release instead of Debug
d14b316
- ship new strict variant
d14b316
3ba45f1
* Sat Oct 13 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-1
3ba45f1
- new upstream release 2.0
3ba45f1
- migrate to GYP buildsystem
3ba45f1
666b0c4
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-3
666b0c4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
666b0c4
af6d056
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
af6d056
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
af6d056
0cf3a66
* Mon Aug 22 2011 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0-1
0cf3a66
- New upstream release 1.0
0cf3a66
- Remove patches, no longer needed for nodejs
0cf3a66
- Fix typo in -devel description
0cf3a66
- use github tarball instead of checkout
0cf3a66
4b6f69b
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-6.20100911git
4b6f69b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
4b6f69b
389fac3
* Tue Jan 11 2011 Lubomir Rintel <lkundrak@v3.sk> - 0.3-5.20100911git
389fac3
- Add support for methods used by node.js
389fac3
0cf3a66
* Thu Nov  4 2010 Dan Horák <dan[at]danny.cz> - 0.3-4.20100911git
2bc7ee7
- build with -fsigned-char
2bc7ee7
Jesse Keating 2754012
* Wed Sep 29 2010 jkeating - 0.3-3.20100911git
Jesse Keating 2754012
- Rebuilt for gcc bug 634757
Jesse Keating 2754012
bbd587f
* Mon Sep 20 2010 Lubomir Rintel <lkundrak@v3.sk> - 0.3-2.20100911git
bbd587f
- Call ldconfig (Peter Lemenkov)
bbd587f
bbd587f
* Fri Sep 17 2010 Lubomir Rintel <lkundrak@v3.sk> - 0.3-1.20100911git
8567b0f
- Initial packaging
8567b0f