Accepting request 539235 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/539235
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/http-parser?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2017-11-10 13:39:33 +00:00 committed by Git OBS Bridge
commit 630c17b46d
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

View File

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