[packages/http-parser] new, version 2.0
glen
glen at pld-linux.org
Sun Apr 7 23:47:31 CEST 2013
commit 2889eff15e96e9b2cd82103d1a0c29392761db24
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon Apr 8 00:46:47 2013 +0300
new, version 2.0
based on fedora package
1511f52a4f015770b8731efde5865479e6ebce13
http-parser-gyp-sharedlib.patch | 40 ++++++++++++++++++
http-parser.spec | 94 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 134 insertions(+)
---
diff --git a/http-parser.spec b/http-parser.spec
new file mode 100644
index 0000000..a95e124
--- /dev/null
+++ b/http-parser.spec
@@ -0,0 +1,94 @@
+%define git_date 20121128
+%define git_commit_hash cd01361
+%define github_seq 7
+Summary: HTTP request/response parser for C
+Name: http-parser
+Version: 2.0
+Release: 0.git%{git_commit_hash}
+License: MIT
+Group: Libraries
+URL: http://github.com/joyent/http-parser
+# download from https://github.com/joyent/http-parser/tarball/%%{version}
+Source0: http://pkgs.fedoraproject.org/repo/pkgs/http-parser/joyent-%{name}-v%{version}-%{github_seq}-g%{git_commit_hash}.tar.gz/340f2aab333c435cbaf49a4949645a06/joyent-http-parser-v%{version}-%{github_seq}-g%{git_commit_hash}.tar.gz
+# Source0-md5: 340f2aab333c435cbaf49a4949645a06
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# Build shared library with SONAME using gyp and remove -O flags so optflags take over
+# TODO: do this nicely upstream
+Patch1: %{name}-gyp-sharedlib.patch
+BuildRequires: gyp
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+# we use the upstream version from http_parser.h as the SONAME
+%define somajor 2
+%define sominor 0
+%define somicro 0
+
+%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 devel
+Summary: Development headers and libraries for http-parser
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Development headers and libraries for http-parser.
+
+%prep
+%setup -q -n joyent-%{name}-%{git_commit_hash}
+%patch1
+
+%build
+# TODO: fix -fPIC upstream
+export CFLAGS='%{optflags} -fPIC'
+gyp -f make --depth=. http_parser.gyp
+%{__make} V=1 BUILDTYPE=Release
+
+%if %{with tests}
+export LD_LIBRARY_PATH='./out/Release/lib.target'
+./out/Release/test-nonstrict
+./out/Release/test-strict
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
+cp -p http_parser.h $RPM_BUILD_ROOT%{_includedir}
+
+# install regular variant
+install -p out/Release/lib.target/libhttp_parser.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}.%{sominor}.%{somicro}
+lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.*.*.*)
+ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}
+ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so
+
+# install strict variant
+install -p out/Release/lib.target/libhttp_parser_strict.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro}
+lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.*.*.*)
+ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}
+ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS CONTRIBUTIONS LICENSE-MIT README.md
+%attr(755,root,root) %{_libdir}/libhttp_parser.so.*.*.*
+%ghost %{_libdir}/libhttp_parser.so.2
+%attr(755,root,root) %{_libdir}/libhttp_parser_strict.so.*.*.*
+%ghost %{_libdir}/libhttp_parser_strict.so.2
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/http_parser.h
+%{_libdir}/libhttp_parser.so
+%{_libdir}/libhttp_parser_strict.so
diff --git a/http-parser-gyp-sharedlib.patch b/http-parser-gyp-sharedlib.patch
new file mode 100644
index 0000000..3687b67
--- /dev/null
+++ b/http-parser-gyp-sharedlib.patch
@@ -0,0 +1,40 @@
+--- http_parser.gyp~ 2012-11-27 15:40:11.721398004 -0700
++++ http_parser.gyp 2012-11-27 15:40:11.721398004 -0700
+@@ -12,7 +12,7 @@
+ # RuntimeLibrary MUST MATCH across the entire project
+ 'Debug': {
+ 'defines': [ 'DEBUG', '_DEBUG' ],
+- 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
++ 'cflags': [ '-Wall', '-Wextra', '-g', '-ftrapv' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 1, # static debug
+@@ -21,7 +21,7 @@
+ },
+ 'Release': {
+ 'defines': [ 'NDEBUG' ],
+- 'cflags': [ '-Wall', '-Wextra', '-O3' ],
++ 'cflags': [ '-Wall', '-Wextra' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'RuntimeLibrary': 0, # static release
+@@ -50,7 +50,8 @@
+ 'targets': [
+ {
+ 'target_name': 'http_parser',
+- 'type': 'static_library',
++ 'type': 'shared_library',
++ 'product_extension': 'so.2',
+ 'include_dirs': [ '.' ],
+ 'direct_dependent_settings': {
+ 'defines': [ 'HTTP_PARSER_STRICT=0' ],
+@@ -73,7 +74,8 @@
+
+ {
+ 'target_name': 'http_parser_strict',
+- 'type': 'static_library',
++ 'type': 'shared_library',
++ 'product_extension': 'so.2',
+ 'include_dirs': [ '.' ],
+ 'direct_dependent_settings': {
+ 'defines': [ 'HTTP_PARSER_STRICT=1' ],
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/http-parser.git/commitdiff/2889eff15e96e9b2cd82103d1a0c29392761db24
More information about the pld-cvs-commit
mailing list