fix-soname.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. Description: set SONAME in shared object file
  2. Author: Ben Noordhuis <info@bnoordhuis.nl>
  3. Bug: https://github.com/joyent/http-parser/issues/151
  4. Origin: https://github.com/joyent/http-parser/commit/1b96c76.patch
  5. Last-Update: 2013-06-13
  6. ---
  7. .gitignore | 2 +-
  8. Makefile | 34 ++++++++++++++++++++++++++++++++--
  9. http_parser.h | 1 +
  10. 3 files changed, 34 insertions(+), 3 deletions(-)
  11. --- a/Makefile
  12. +++ b/Makefile
  13. @@ -1,3 +1,26 @@
  14. +# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  15. +#
  16. +# Permission is hereby granted, free of charge, to any person obtaining a copy
  17. +# of this software and associated documentation files (the "Software"), to
  18. +# deal in the Software without restriction, including without limitation the
  19. +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  20. +# sell copies of the Software, and to permit persons to whom the Software is
  21. +# furnished to do so, subject to the following conditions:
  22. +#
  23. +# The above copyright notice and this permission notice shall be included in
  24. +# all copies or substantial portions of the Software.
  25. +#
  26. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  27. +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  28. +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  29. +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30. +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  31. +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  32. +# IN THE SOFTWARE.
  33. +
  34. +PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
  35. +SONAME ?= libhttp_parser.so.2.1
  36. +
  37. CC?=gcc
  38. AR?=ar
  39. @@ -12,6 +35,13 @@
  40. CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
  41. CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
  42. +LDFLAGS_LIB = -shared
  43. +
  44. +ifneq (darwin,$(PLATFORM))
  45. +# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
  46. +LDFLAGS_LIB += -Wl,-soname=$(SONAME)
  47. +endif
  48. +
  49. test: test_g test_fast
  50. ./test_g
  51. ./test_fast
  52. @@ -44,7 +74,7 @@
  53. $(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
  54. library: libhttp_parser.o
  55. - $(CC) -shared -o libhttp_parser.so libhttp_parser.o
  56. + $(CC) $(LDFLAGS_LIB) -o $(SONAME) $<
  57. package: http_parser.o
  58. $(AR) rcs libhttp_parser.a http_parser.o
  59. @@ -66,7 +96,7 @@
  60. clean:
  61. rm -f *.o *.a tags test test_fast test_g \
  62. - http_parser.tar libhttp_parser.so \
  63. + http_parser.tar libhttp_parser.so.* \
  64. url_parser url_parser_g parsertrace parsertrace_g
  65. contrib/url_parser.c: http_parser.h
  66. --- a/http_parser.h
  67. +++ b/http_parser.h
  68. @@ -24,6 +24,7 @@
  69. extern "C" {
  70. #endif
  71. +/* Also update SONAME in the Makefile whenever you change these. */
  72. #define HTTP_PARSER_VERSION_MAJOR 2
  73. #define HTTP_PARSER_VERSION_MINOR 1