T.C. Hollingsworth 3ba45f
# we use the upstream version from http_parser.h as the SONAME
T.C. Hollingsworth 3ba45f
%global somajor 2
0cf3a6
%global sominor 0
T.C. Hollingsworth 3ba45f
T.C. Hollingsworth 12744a
%global git_date 20121128
T.C. Hollingsworth 12744a
%global git_commit_hash cd01361
T.C. Hollingsworth 12744a
%global github_seq 7
bbd587
bbd587
Name:           http-parser
bbd587
Version:        %{somajor}.%{sominor}
a044ad
Release:        5.%{git_date}git%{git_commit_hash}%{?dist}
bbd587
Summary:        HTTP request/response parser for C
bbd587
bbd587
Group:          System Environment/Libraries
bbd587
License:        MIT
T.C. Hollingsworth 3ba45f
URL:            http://github.com/joyent/http-parser
T.C. Hollingsworth 3ba45f
# download from https://github.com/joyent/http-parser/tarball/%%{version}
T.C. Hollingsworth d14b31
Source0:        joyent-http-parser-v%{version}-%{github_seq}-g%{git_commit_hash}.tar.gz
bbd587
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
bbd587
T.C. Hollingsworth d14b31
# Build shared library with SONAME using gyp and remove -O flags so optflags take over
T.C. Hollingsworth 3ba45f
# TODO: do this nicely upstream
T.C. Hollingsworth 3ba45f
Patch1:		http-parser-gyp-sharedlib.patch
T.C. Hollingsworth 3ba45f
T.C. Hollingsworth 3ba45f
BuildRequires:	gyp
T.C. Hollingsworth 3ba45f
bbd587
%description
bbd587
This is a parser for HTTP messages written in C. It parses both requests and
bbd587
responses. The parser is designed to be used in performance HTTP applications.
bbd587
It does not make any syscalls nor allocations, it does not buffer data, it can
bbd587
be interrupted at anytime. Depending on your architecture, it only requires
bbd587
about 40 bytes of data per message stream (in a web server that is per
bbd587
connection).
bbd587
bbd587
bbd587
%package devel
bbd587
Group:          Development/Libraries
bbd587
Summary:        Development headers and libraries for http-parser
bbd587
Requires:       %{name} = %{version}-%{release}
bbd587
bbd587
%description devel
0cf3a6
Development headers and libraries for http-parser.
bbd587
bbd587
bbd587
%prep
T.C. Hollingsworth d14b31
%setup -q -n joyent-http-parser-%{git_commit_hash}
T.C. Hollingsworth 3ba45f
%patch1
bbd587
bbd587
bbd587
%build
T.C. Hollingsworth 3ba45f
# TODO: fix -fPIC upstream
T.C. Hollingsworth 3ba45f
export CFLAGS='%{optflags} -fPIC'
T.C. Hollingsworth 3ba45f
gyp -f make --depth=`pwd` http_parser.gyp
T.C. Hollingsworth d14b31
make %{?_smp_mflags} BUILDTYPE=Release 
bbd587
bbd587
bbd587
%install
T.C. Hollingsworth 3ba45f
rm -rf %{buildroot}
T.C. Hollingsworth d14b31
T.C. Hollingsworth 3ba45f
install -d %{buildroot}%{_includedir}
T.C. Hollingsworth 3ba45f
install -d %{buildroot}%{_libdir}
T.C. Hollingsworth d14b31
T.C. Hollingsworth 3ba45f
install -pm644 http_parser.h %{buildroot}%{_includedir}
T.C. Hollingsworth d14b31
T.C. Hollingsworth d14b31
#install regular variant
T.C. Hollingsworth d14b31
install out/Release/lib.target/libhttp_parser.so.%{somajor} %{buildroot}%{_libdir}/libhttp_parser.so.%{somajor}.%{sominor}
T.C. Hollingsworth 3ba45f
ln -sf libhttp_parser.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser.so.%{somajor}
T.C. Hollingsworth 3ba45f
ln -sf libhttp_parser.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser.so
bbd587
T.C. Hollingsworth d14b31
#install strict variant
T.C. Hollingsworth d14b31
install out/Release/lib.target/libhttp_parser_strict.so.%{somajor} %{buildroot}%{_libdir}/libhttp_parser_strict.so.%{somajor}.%{sominor}
T.C. Hollingsworth d14b31
ln -sf libhttp_parser_strict.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser_strict.so.%{somajor}
T.C. Hollingsworth d14b31
ln -sf libhttp_parser_strict.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser_strict.so
T.C. Hollingsworth d14b31
bbd587
T.C. Hollingsworth 12744a
%check
T.C. Hollingsworth 12744a
export LD_LIBRARY_PATH='./out/Release/lib.target' 
T.C. Hollingsworth 12744a
./out/Release/test-nonstrict
T.C. Hollingsworth 12744a
./out/Release/test-strict
bbd587
bbd587
bbd587
%clean
T.C. Hollingsworth 3ba45f
rm -rf %{buildroot}
bbd587
bbd587
bbd587
%post -p /sbin/ldconfig
bbd587
%postun -p /sbin/ldconfig
bbd587
bbd587
bbd587
%files
bbd587
%defattr(-,root,root,-)
bbd587
%{_libdir}/libhttp_parser.so.*
T.C. Hollingsworth d14b31
%{_libdir}/libhttp_parser_strict.so.*
T.C. Hollingsworth 3ba45f
%doc AUTHORS CONTRIBUTIONS LICENSE-MIT README.md
bbd587
bbd587
bbd587
%files devel
bbd587
%defattr(-,root,root,-)
bbd587
%{_includedir}/*
bbd587
%{_libdir}/libhttp_parser.so
T.C. Hollingsworth d14b31
%{_libdir}/libhttp_parser_strict.so
bbd587
bbd587
bbd587
%changelog
a044ad
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-5.20121128gitcd01361
a044ad
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
a044ad
1511f5
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-4.20121128gitcd01361
1511f5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
1511f5
T.C. Hollingsworth 12744a
* Sun Dec 02 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-3.20121128gitcd01361
T.C. Hollingsworth 12744a
- latest git snapshot
T.C. Hollingsworth 12744a
- fixes buffer overflow in tests
T.C. Hollingsworth 12744a
T.C. Hollingsworth d14b31
* Tue Nov 27 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-2.20121110git245f6f0
T.C. Hollingsworth d14b31
- latest git snapshot
T.C. Hollingsworth 12744a
- fixes tests
T.C. Hollingsworth d14b31
- use SMP make flags
T.C. Hollingsworth d14b31
- build as Release instead of Debug
T.C. Hollingsworth d14b31
- ship new strict variant
T.C. Hollingsworth d14b31
T.C. Hollingsworth 3ba45f
* Sat Oct 13 2012 T.C. Hollingsworth <tchollingsworth@gmail.com> - 2.0-1
T.C. Hollingsworth 3ba45f
- new upstream release 2.0
T.C. Hollingsworth 3ba45f
- migrate to GYP buildsystem
T.C. Hollingsworth 3ba45f
666b0c
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-3
666b0c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
666b0c
af6d05
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
af6d05
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
af6d05
0cf3a6
* Mon Aug 22 2011 T.C. Hollingsworth <tchollingsworth@gmail.com> - 1.0-1
0cf3a6
- New upstream release 1.0
0cf3a6
- Remove patches, no longer needed for nodejs
0cf3a6
- Fix typo in -devel description
0cf3a6
- use github tarball instead of checkout
0cf3a6
4b6f69
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-6.20100911git
4b6f69
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
4b6f69
389fac
* Tue Jan 11 2011 Lubomir Rintel <lkundrak@v3.sk> - 0.3-5.20100911git
389fac
- Add support for methods used by node.js
389fac
0cf3a6
* Thu Nov  4 2010 Dan Horák <dan[at]danny.cz> - 0.3-4.20100911git
2bc7ee
- build with -fsigned-char
2bc7ee
Jesse Keating 275401
* Wed Sep 29 2010 jkeating - 0.3-3.20100911git
Jesse Keating 275401
- Rebuilt for gcc bug 634757
Jesse Keating 275401
bbd587
* Mon Sep 20 2010 Lubomir Rintel <lkundrak@v3.sk> - 0.3-2.20100911git
bbd587
- Call ldconfig (Peter Lemenkov)
bbd587
bbd587
* Fri Sep 17 2010 Lubomir Rintel <lkundrak@v3.sk> - 0.3-1.20100911git
0cf3a6
- Initial packaging