Skip to contentSkip to conversation

package/libhttpparser: New package

PATCH New Renaud AUBIN 2 participants 2 messages Aug 27, 2015 – Aug 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libhttpparser: New package

http-parser provides a simple C API to parse HTTP responses and requests.

This packaging uses the official Joyent repository.

---
 package/Config.in                      |  1 +
 package/libhttpparser/Config.in        | 13 +++++++++++++
 package/libhttpparser/libhttpparser.mk | 27 +++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 package/libhttpparser/Config.in
 create mode 100644 package/libhttpparser/libhttpparser.mk
package/Config.in +1 -0
index 783fbb4..89d863d 100644
@@ -979,6 +979,7 @@ menu "Networking"
 	source "package/libeXosip2/Config.in"
 	source "package/libfcgi/Config.in"
 	source "package/libgsasl/Config.in"
+	source "package/libhttpparser/Config.in"
 	source "package/libidn/Config.in"
 	source "package/libiscsi/Config.in"
 	source "package/libmbus/Config.in"
package/libhttpparser/Config.in new file +13 -0
new file mode 100644
index 0000000..b8e6825
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LIBHTTPPARSER
+        bool "libhttpparser"
+        help
+          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).
+
+          https://github.com/joyent/http-parser
package/libhttpparser/libhttpparser.mk new file +27 -0
new file mode 100644
index 0000000..bcb26c7
@@ -0,0 +1,27 @@
+################################################################################
+#
+# libhttp-parser
+#
+################################################################################
+
+LIBHTTPPARSER_VERSION = v2.5.0
+LIBHTTPPARSER_SITE = $(call github,joyent,http-parser,$(LIBHTTPPARSER_VERSION))
+LIBHTTPPARSER_INSTALL_STAGING = YES
+LIBHTTPPARSER_LICENSE = MIT
+LIBHTTPPARSER_LICENSE_FILES = LICENSE-MIT
+
+define LIBHTTPPARSER_BUILD_CMDS
+    $(MAKE) CC=$(TARGET_CC) LD=$(TARGET_LD) -C $(@D) library package
+endef
+
+define LIBHTTPPARSER_INSTALL_STAGING_CMDS
+    $(INSTALL) -D -m 0755 $(@D)/libhttp_parser.a $(STAGING_DIR)/usr/lib/libhttp_parser.a
+    $(INSTALL) -D -m 0644 $(@D)/http_parser.h $(STAGING_DIR)/usr/include/http_parser.h
+    $(INSTALL) -D -m 0755 $(@D)/libhttp_parser.so* $(STAGING_DIR)/usr/lib
+endef
+
+define LIBHTTPPARSER_INSTALL_TARGET_CMDS
+    $(INSTALL) -D -m 0755 $(@D)/libhttp_parser.so* $(TARGET_DIR)/usr/lib
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 package/libhttpparser: New package

Dear Renaud AUBIN,

Quoted 11 lines · Renaud AUBIN

http-parser provides a simple C API to parse HTTP responses and requests.

This packaging uses the official Joyent repository.

---
 package/Config.in                      |  1 +
 package/libhttpparser/Config.in        | 13 +++++++++++++
 package/libhttpparser/libhttpparser.mk | 27 +++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 package/libhttpparser/Config.in
 create mode 100644 package/libhttpparser/libhttpparser.mk

Thanks, I've applied your patch to the next branch, after doing some changes:

[Thomas:
- since we're always building the shared library, depend on !BR2_STATIC_LIBS in Config.in. We could build only the static library, but then we would have to do all the lib installation manually.
- indent using tabs in Config.in
- use 'make install' instead of handcoding the library installation.
- use $(TARGET_CONFIGURE_OPTS) instead of just CC= and LD=.
- use tabs for indentation in commands instead of spaces
- add patch to fix reinstallation.]

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com