Blob Blame Raw
# we use the upstream version from http_parser.h as the SONAME
%global somajor 2
%global sominor 0

%global git_date 20121110
%global git_commit_hash 245f6f0
%global github_seq 5

Name:           http-parser
Version:        %{somajor}.%{sominor}
Release:        2.%{git_date}git%{git_commit_hash}%{?dist}
Summary:        HTTP request/response parser for C

Group:          System Environment/Libraries
License:        MIT
# download from{version}
Source0:        joyent-http-parser-v%{version}-%{github_seq}-g%{git_commit_hash}.tar.gz
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

# Build shared library with SONAME using gyp and remove -O flags so optflags take over
# TODO: do this nicely upstream
Patch1:		http-parser-gyp-sharedlib.patch

BuildRequires:	gyp

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

%package devel
Group:          Development/Libraries
Summary:        Development headers and libraries for http-parser
Requires:       %{name} = %{version}-%{release}

%description devel
Development headers and libraries for http-parser.

%setup -q -n joyent-http-parser-%{git_commit_hash}

# TODO: fix -fPIC upstream
export CFLAGS='%{optflags} -fPIC'
gyp -f make --depth=`pwd` http_parser.gyp
make %{?_smp_mflags} BUILDTYPE=Release 

rm -rf %{buildroot}

install -d %{buildroot}%{_includedir}
install -d %{buildroot}%{_libdir}

install -pm644 http_parser.h %{buildroot}%{_includedir}

#install regular variant
install out/Release/{somajor} %{buildroot}%{_libdir}/{somajor}.%{sominor}
ln -sf{somajor}.%{sominor} %{buildroot}%{_libdir}/{somajor}
ln -sf{somajor}.%{sominor} %{buildroot}%{_libdir}/

#install strict variant
install out/Release/{somajor} %{buildroot}%{_libdir}/{somajor}.%{sominor}
ln -sf{somajor}.%{sominor} %{buildroot}%{_libdir}/{somajor}
ln -sf{somajor}.%{sominor} %{buildroot}%{_libdir}/

# Currently failing:
export LD_LIBRARY_PATH='./out/Release/' 

rm -rf %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files devel

* Tue Nov 27 2012 T.C. Hollingsworth <> - 2.0-2.20121110git245f6f0
- latest git snapshot
- fixes tests
- use SMP make flags
- build as Release instead of Debug
- ship new strict variant

* Sat Oct 13 2012 T.C. Hollingsworth <> - 2.0-1
- new upstream release 2.0
- migrate to GYP buildsystem

* Thu Jul 19 2012 Fedora Release Engineering <> - 1.0-3
- Rebuilt for

* Fri Jan 13 2012 Fedora Release Engineering <> - 1.0-2
- Rebuilt for

* Mon Aug 22 2011 T.C. Hollingsworth <> - 1.0-1
- New upstream release 1.0
- Remove patches, no longer needed for nodejs
- Fix typo in -devel description
- use github tarball instead of checkout

* Wed Feb 09 2011 Fedora Release Engineering <> - 0.3-6.20100911git
- Rebuilt for

* Tue Jan 11 2011 Lubomir Rintel <> - 0.3-5.20100911git
- Add support for methods used by node.js

* Thu Nov  4 2010 Dan Horák <dan[at]> - 0.3-4.20100911git
- build with -fsigned-char

* Wed Sep 29 2010 jkeating - 0.3-3.20100911git
- Rebuilt for gcc bug 634757

* Mon Sep 20 2010 Lubomir Rintel <> - 0.3-2.20100911git
- Call ldconfig (Peter Lemenkov)

* Fri Sep 17 2010 Lubomir Rintel <> - 0.3-1.20100911git
- Initial packaging