3ba45f1
# we use the upstream version from http_parser.h as the SONAME
3ba45f1
%global somajor 2
0cf3a66
%global sominor 0
3ba45f1
12744ac
%global git_date 20121128
12744ac
%global git_commit_hash cd01361
12744ac
%global github_seq 7
bbd587f
bbd587f
Name:           http-parser
bbd587f
Version:        %{somajor}.%{sominor}
1511f52
Release:        4.%{git_date}git%{git_commit_hash}%{?dist}
bbd587f
Summary:        HTTP request/response parser for C
bbd587f
bbd587f
Group:          System Environment/Libraries
bbd587f
License:        MIT
3ba45f1
URL:            http://github.com/joyent/http-parser
3ba45f1
# download from https://github.com/joyent/http-parser/tarball/%%{version}
d14b316
Source0:        joyent-http-parser-v%{version}-%{github_seq}-g%{git_commit_hash}.tar.gz
bbd587f
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
bbd587f
d14b316
# Build shared library with SONAME using gyp and remove -O flags so optflags take over
3ba45f1
# TODO: do this nicely upstream
3ba45f1
Patch1:		http-parser-gyp-sharedlib.patch
3ba45f1
3ba45f1
BuildRequires:	gyp
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
bbd587f
%package devel
bbd587f
Group:          Development/Libraries
bbd587f
Summary:        Development headers and libraries for http-parser
bbd587f
Requires:       %{name} = %{version}-%{release}
bbd587f
bbd587f
%description devel
0cf3a66
Development headers and libraries for http-parser.
bbd587f
bbd587f
bbd587f
%prep
d14b316
%setup -q -n joyent-http-parser-%{git_commit_hash}
3ba45f1
%patch1
bbd587f
bbd587f
bbd587f
%build
3ba45f1
# TODO: fix -fPIC upstream
3ba45f1
export CFLAGS='%{optflags} -fPIC'
3ba45f1
gyp -f make --depth=`pwd` http_parser.gyp
d14b316
make %{?_smp_mflags} BUILDTYPE=Release 
bbd587f
bbd587f
bbd587f
%install
3ba45f1
rm -rf %{buildroot}
d14b316
3ba45f1
install -d %{buildroot}%{_includedir}
3ba45f1
install -d %{buildroot}%{_libdir}
d14b316
3ba45f1
install -pm644 http_parser.h %{buildroot}%{_includedir}
d14b316
d14b316
#install regular variant
d14b316
install out/Release/lib.target/libhttp_parser.so.%{somajor} %{buildroot}%{_libdir}/libhttp_parser.so.%{somajor}.%{sominor}
3ba45f1
ln -sf libhttp_parser.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser.so.%{somajor}
3ba45f1
ln -sf libhttp_parser.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser.so
bbd587f
d14b316
#install strict variant
d14b316
install out/Release/lib.target/libhttp_parser_strict.so.%{somajor} %{buildroot}%{_libdir}/libhttp_parser_strict.so.%{somajor}.%{sominor}
d14b316
ln -sf libhttp_parser_strict.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser_strict.so.%{somajor}
d14b316
ln -sf libhttp_parser_strict.so.%{somajor}.%{sominor} %{buildroot}%{_libdir}/libhttp_parser_strict.so
d14b316
bbd587f
12744ac
%check
12744ac
export LD_LIBRARY_PATH='./out/Release/lib.target' 
12744ac
./out/Release/test-nonstrict
12744ac
./out/Release/test-strict
bbd587f
bbd587f
bbd587f
%clean
3ba45f1
rm -rf %{buildroot}
bbd587f
bbd587f
bbd587f
%post -p /sbin/ldconfig
bbd587f
%postun -p /sbin/ldconfig
bbd587f
bbd587f
bbd587f
%files
bbd587f
%defattr(-,root,root,-)
bbd587f
%{_libdir}/libhttp_parser.so.*
d14b316
%{_libdir}/libhttp_parser_strict.so.*
3ba45f1
%doc AUTHORS CONTRIBUTIONS LICENSE-MIT README.md
bbd587f
bbd587f
bbd587f
%files devel
bbd587f
%defattr(-,root,root,-)
bbd587f
%{_includedir}/*
bbd587f
%{_libdir}/libhttp_parser.so
d14b316
%{_libdir}/libhttp_parser_strict.so
bbd587f
bbd587f
bbd587f
%changelog
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
0cf3a66
- Initial packaging