]>
Commit | Line | Data |
---|---|---|
2889eff1 ER |
1 | %define git_date 20121128 |
2 | %define git_commit_hash cd01361 | |
3 | %define github_seq 7 | |
4 | Summary: HTTP request/response parser for C | |
5 | Name: http-parser | |
6 | Version: 2.0 | |
7 | Release: 0.git%{git_commit_hash} | |
8 | License: MIT | |
9 | Group: Libraries | |
10 | URL: http://github.com/joyent/http-parser | |
11 | # download from https://github.com/joyent/http-parser/tarball/%%{version} | |
12 | 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 | |
13 | # Source0-md5: 340f2aab333c435cbaf49a4949645a06 | |
1dcbed49 | 14 | BuildRequires: libstdc++-devel |
2889eff1 ER |
15 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
16 | # Build shared library with SONAME using gyp and remove -O flags so optflags take over | |
17 | # TODO: do this nicely upstream | |
18 | Patch1: %{name}-gyp-sharedlib.patch | |
19 | BuildRequires: gyp | |
20 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
21 | ||
22 | # we use the upstream version from http_parser.h as the SONAME | |
23 | %define somajor 2 | |
24 | %define sominor 0 | |
25 | %define somicro 0 | |
26 | ||
27 | %description | |
28 | This is a parser for HTTP messages written in C. It parses both | |
29 | requests and responses. The parser is designed to be used in | |
30 | performance HTTP applications. It does not make any syscalls nor | |
31 | allocations, it does not buffer data, it can be interrupted at | |
32 | anytime. Depending on your architecture, it only requires about 40 | |
33 | bytes of data per message stream (in a web server that is per | |
34 | connection). | |
35 | ||
36 | %package devel | |
37 | Summary: Development headers and libraries for http-parser | |
38 | Group: Development/Libraries | |
39 | Requires: %{name} = %{version}-%{release} | |
40 | ||
41 | %description devel | |
42 | Development headers and libraries for http-parser. | |
43 | ||
44 | %prep | |
45 | %setup -q -n joyent-%{name}-%{git_commit_hash} | |
46 | %patch1 | |
47 | ||
48 | %build | |
49 | # TODO: fix -fPIC upstream | |
50 | export CFLAGS='%{optflags} -fPIC' | |
51 | gyp -f make --depth=. http_parser.gyp | |
52 | %{__make} V=1 BUILDTYPE=Release | |
53 | ||
54 | %if %{with tests} | |
55 | export LD_LIBRARY_PATH='./out/Release/lib.target' | |
56 | ./out/Release/test-nonstrict | |
57 | ./out/Release/test-strict | |
58 | %endif | |
59 | ||
60 | %install | |
61 | rm -rf $RPM_BUILD_ROOT | |
62 | install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}} | |
63 | cp -p http_parser.h $RPM_BUILD_ROOT%{_includedir} | |
64 | ||
65 | # install regular variant | |
66 | install -p out/Release/lib.target/libhttp_parser.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}.%{sominor}.%{somicro} | |
67 | lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.*.*.*) | |
68 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor} | |
69 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so | |
70 | ||
71 | # install strict variant | |
72 | install -p out/Release/lib.target/libhttp_parser_strict.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro} | |
73 | lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.*.*.*) | |
74 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor} | |
75 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so | |
76 | ||
77 | %clean | |
78 | rm -rf $RPM_BUILD_ROOT | |
79 | ||
80 | %post -p /sbin/ldconfig | |
81 | %postun -p /sbin/ldconfig | |
82 | ||
83 | %files | |
84 | %defattr(644,root,root,755) | |
85 | %doc AUTHORS CONTRIBUTIONS LICENSE-MIT README.md | |
86 | %attr(755,root,root) %{_libdir}/libhttp_parser.so.*.*.* | |
87 | %ghost %{_libdir}/libhttp_parser.so.2 | |
88 | %attr(755,root,root) %{_libdir}/libhttp_parser_strict.so.*.*.* | |
89 | %ghost %{_libdir}/libhttp_parser_strict.so.2 | |
90 | ||
91 | %files devel | |
92 | %defattr(644,root,root,755) | |
93 | %{_includedir}/http_parser.h | |
94 | %{_libdir}/libhttp_parser.so | |
95 | %{_libdir}/libhttp_parser_strict.so |