Accepting request 538640 from home:mimi_vx:branches:devel:libraries:c_c++

- move out from gyp
- use correct SONAME
- drop http-parser-gyp-sharedlib.patch
- add makefile.patch

OBS-URL: https://build.opensuse.org/request/show/538640
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/http-parser?expand=0&rev=11
This commit is contained in:
Marcus Meissner 2017-11-06 09:54:56 +00:00 committed by Git OBS Bridge
parent 742883aa5b
commit d3343c69f5
5 changed files with 85 additions and 87 deletions

View File

@ -1 +1 @@
libhttp-parser-suse0 libhttp_parser2_7_1

View File

@ -1,56 +0,0 @@
build: build http-parser as a shared library
Since the pristine package only ever builds as static library, it is
to be assumed that the project does not track and enumerate ABI
changes. Building it as shared nevertheless is therefore a distro
extension - hence the "suse" suffix. Enumeration is therefore
also distro-specific.
Remove -O flags so %optflags take over.
TODO: do this nicely upstream
---
http_parser.gyp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: http-parser-2.6.2/http_parser.gyp
===================================================================
--- http-parser-2.6.2.orig/http_parser.gyp
+++ http-parser-2.6.2/http_parser.gyp
@@ -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.suse0',
'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.suse0',
'include_dirs': [ '.' ],
'direct_dependent_settings': {
'defines': [ 'HTTP_PARSER_STRICT=1' ],

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Nov 3 10:01:08 UTC 2017 - mimi.vx@gmail.com
- move out from gyp
- use correct SONAME
- drop http-parser-gyp-sharedlib.patch
- add makefile.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Oct 21 19:16:56 UTC 2016 - p.drouand@gmail.com Fri Oct 21 19:16:56 UTC 2016 - p.drouand@gmail.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package http-parser # spec file for package http-parser
# #
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,20 +16,19 @@
# #
%define somajor suse0 %define soname 2_7_1
%define libname libhttp-parser-%{somajor} %define libname libhttp_parser%{soname}
Name: http-parser Name: http-parser
Version: 2.7.1 Version: 2.7.1
Release: 0 Release: 0
Summary: HTTP request/response parser for C Summary: HTTP request/response parser for C
License: MIT License: MIT
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Url: https://github.com/joyent/http-parser Url: https://github.com/nodejs/http-parser
Source0: https://github.com/joyent/http-parser/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: https://github.com/nodejs/http-parser/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: baselibs.conf Source1: baselibs.conf
Patch1: http-parser-gyp-sharedlib.patch Patch0: makefile.patch
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: gyp
%description %description
This is a parser for HTTP messages written in C. It parses both This is a parser for HTTP messages written in C. It parses both
@ -43,6 +42,8 @@ connection).
%package -n %{libname} %package -n %{libname}
Summary: HTTP request/response parser for C Summary: HTTP request/response parser for C
Group: System/Libraries Group: System/Libraries
Provides: libhttp-parser-suse0 = %{version}
Obsoletes: libhttp-parser-suse0 <= %{version}
%description -n %{libname} %description -n %{libname}
This is a parser for HTTP messages written in C. It parses both This is a parser for HTTP messages written in C. It parses both
@ -71,45 +72,27 @@ Development headers and libraries for http-parser.
%prep %prep
%setup -q %setup -q
%patch1 -p1 %patch0 -p1
%build %build
# TODO: fix -fPIC upstream make %{?_smp_mflags} PREFIX=%{_prefix} library
export CFLAGS='%{optflags} -fPIC'
gyp -f make --depth=`pwd` http_parser.gyp
make %{?_smp_mflags} BUILDTYPE=Release
%install %install
install -d %{buildroot}%{_includedir} make PREFIX=%{_prefix} DESTDIR=%{buildroot} LIBDIR=%{_libdir} install
install -d %{buildroot}%{_libdir} chmod a-x %{buildroot}/%{_includedir}/*.h
install -pm644 http_parser.h %{buildroot}%{_includedir}
#install regular variant
install "out/Release/lib.target/libhttp_parser.so.%{somajor}" "%{buildroot}/%{_libdir}/"
ln -sf "libhttp_parser.so.%{somajor}" "%{buildroot}/%{_libdir}/libhttp_parser.so"
#install strict variant
install "out/Release/lib.target/libhttp_parser_strict.so.%{somajor}" "%{buildroot}/%{_libdir}/"
ln -sf "libhttp_parser_strict.so.%{somajor}" "%{buildroot}/%{_libdir}/libhttp_parser_strict.so"
%check %check
export LD_LIBRARY_PATH='./out/Release/lib.target' make %{?_smp_mflags} test
./out/Release/test-nonstrict
./out/Release/test-strict
%post -n %{libname} -p /sbin/ldconfig %post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname} %files -n %{libname}
%defattr(-,root,root)
%doc AUTHORS LICENSE-MIT README.md %doc AUTHORS LICENSE-MIT README.md
%{_libdir}/libhttp_parser.so.* %{_libdir}/libhttp_parser.so.*
%{_libdir}/libhttp_parser_strict.so.*
%files devel %files devel
%defattr(-,root,root)
%{_includedir}/* %{_includedir}/*
%{_libdir}/libhttp_parser.so %{_libdir}/libhttp_parser.so
%{_libdir}/libhttp_parser_strict.so
%changelog %changelog

63
makefile.patch Normal file
View File

@ -0,0 +1,63 @@
Index: http-parser-2.7.1/Makefile
===================================================================
--- http-parser-2.7.1.orig/Makefile
+++ http-parser-2.7.1/Makefile
@@ -46,7 +46,6 @@ CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSE
CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
-CFLAGS += -Wall -Wextra -Werror
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
@@ -55,7 +54,7 @@ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
LDFLAGS_LIB = $(LDFLAGS) -shared
INSTALL ?= install
-PREFIX ?= $(DESTDIR)/usr/local
+PREFIX ?= /usr/local
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include
@@ -102,7 +101,7 @@ libhttp_parser.o: http_parser.c http_par
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
library: libhttp_parser.o
- $(CC) $(LDFLAGS_LIB) -o $(SONAME) $<
+ $(CC) $(CFLAGS_LIB) $(LDFLAGS_LIB) -o $(SONAME) $<
package: http_parser.o
$(AR) rcs libhttp_parser.a http_parser.o
@@ -122,20 +121,20 @@ parsertrace_g: http_parser_g.o contrib/p
tags: http_parser.c http_parser.h test.c
ctags $^
-install: library
- $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
- $(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
- ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
-
-install-strip: library
- $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
- $(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
- ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
+install: $(SONAME)
+ $(INSTALL) -D http_parser.h "$(DESTDIR)$(INCLUDEDIR)/http_parser.h"
+ $(INSTALL) -D $(SONAME) "$(DESTDIR)$(LIBDIR)/$(SONAME)"
+ ln -s $(SONAME) "$(DESTDIR)$(LIBDIR)/libhttp_parser.$(SOEXT)"
+
+install-strip: $(SONAME)
+ $(INSTALL) -D http_parser.h "$(DESTDIR)$(INCLUDEDIR)/http_parser.h"
+ $(INSTALL) -D -s $(SONAME) "$(DESTDIR)$(LIBDIR)/$(SONAME)"
+ ln -s $(SONAME) "$(DESTDIR)$(LIBDIR)/libhttp_parser.$(SOEXT)"
uninstall:
- rm $(INCLUDEDIR)/http_parser.h
- rm $(LIBDIR)/$(SONAME)
- rm $(LIBDIR)/libhttp_parser.so
+ rm "$(DESTDIR)$(INCLUDEDIR)/http_parser.h"
+ rm "$(DESTDIR)$(LIBDIR)/$(SONAME)"
+ rm "$(DESTDIR)$(LIBDIR)/libhttp_parser.so"
clean:
rm -f *.o *.a tags test test_fast test_g \