Browse Source

libevhtp: add version 1.2.9

Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Tested-by: Gergely Kiss <mail.gery@gmail.com>
Gergely Kiss 10 years ago
parent
commit
033d721e1f

+ 60
- 0
libs/libevhtp/Makefile View File

@@ -0,0 +1,60 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=libevhtp
11
+PKG_VERSION:=1.2.9
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=BSD-3-Clause
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16
+PKG_SOURCE:=$(PKG_VERSION).tar.gz
17
+PKG_SOURCE_URL:=https://github.com/ellzey/libevhtp/archive/
18
+PKG_MD5SUM:=428a8d179fcc0cadedd914ed6456e08f
19
+PKG_CAT:=zcat
20
+PKG_INSTALL:=1
21
+
22
+include $(INCLUDE_DIR)/package.mk
23
+
24
+define Package/libevhtp
25
+    SECTION:=libs
26
+    CATEGORY:=Libraries
27
+    TITLE:=A more flexible replacement for libevent's httpd API
28
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
29
+    URL:=https://github.com/ellzey/libevhtp
30
+    DEPENDS:=+libevent2 +libevent2-openssl +libevent2-pthreads +libopenssl +libpthread
31
+endef
32
+
33
+define Package/libevhtp/description
34
+   Libevhtp was created as a replacement API for Libevent's current HTTP API.
35
+   The reality of libevent's http interface is that it was created as a JIT server,
36
+   meaning the developer never thought of it being used for creating a full-fledged HTTP service.
37
+endef
38
+
39
+include $(INCLUDE_DIR)/cmake.mk
40
+
41
+Hooks/Prepare/Post += delete_source_package
42
+
43
+define delete_source_package
44
+	# deleting source package as its filename is ambiguous
45
+	rm -f $(DL_DIR)/$(PKG_SOURCE)
46
+endef
47
+
48
+define Build/InstallDev
49
+	$(INSTALL_DIR) $(1)/usr/{include,lib}
50
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
51
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevhtp.so* $(1)/usr/lib/
52
+
53
+endef
54
+
55
+define Package/libevhtp/install
56
+	$(INSTALL_DIR) $(1)/usr/lib
57
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevhtp.so* $(1)/usr/lib/
58
+endef
59
+
60
+$(eval $(call BuildPackage,libevhtp))

+ 12
- 0
libs/libevhtp/patches/010-enable-shared-object-building.patch View File

@@ -0,0 +1,12 @@
1
+diff -rupN libevhtp-1.2.9.orig/CMakeLists.txt libevhtp-1.2.9/CMakeLists.txt
2
+--- libevhtp-1.2.9.orig/CMakeLists.txt	2014-03-23 12:50:50.000000000 +0100
3
++++ libevhtp-1.2.9/CMakeLists.txt	2014-11-21 11:46:58.644575813 +0100
4
+@@ -64,7 +64,7 @@ OPTION(EVHTP_DISABLE_EVTHR     "Disable
5
+ OPTION(EVHTP_DISABLE_REGEX     "Disable regex support"    OFF)
6
+ 
7
+ # -DEVHTP_BUILD_SHARED:STRING=ON
8
+-OPTION(EVHTP_BUILD_SHARED      "Build shared library too" OFF)
9
++OPTION(EVHTP_BUILD_SHARED      "Build shared library too" ON)
10
+ 
11
+ # -DEVHTP_USE_DEFER_ACCEPT:STRING=ON
12
+ OPTION(EVHTP_USE_DEFER_ACCEPT  "Enable TCP_DEFER_ACCEPT"  OFF)

+ 49
- 0
libs/libevhtp/patches/020-strcmp-endianness-fix.patch View File

@@ -0,0 +1,49 @@
1
+diff -rupN libevhtp-1.2.9.orig/htparse/htparse.c libevhtp-1.2.9/htparse/htparse.c
2
+--- libevhtp-1.2.9.orig/htparse/htparse.c	2014-03-23 12:50:50.000000000 +0100
3
++++ libevhtp-1.2.9/htparse/htparse.c	2014-12-09 01:12:22.242001241 +0100
4
+@@ -197,6 +197,7 @@ static const char * method_strmap[] = {
5
+ 
6
+ #define _MIN_READ(a, b) ((a) < (b) ? (a) : (b))
7
+ 
8
++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
9
+ #define _str3_cmp(m, c0, c1, c2, c3) \
10
+     *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
11
+ 
12
+@@ -226,6 +227,37 @@ static const char * method_strmap[] = {
13
+     *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)        \
14
+     && ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
15
+     && m[8] == c8
16
++#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
17
++#define _str3_cmp(m, c0, c1, c2, c3) \
18
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
19
++
20
++#define _str3Ocmp(m, c0, c1, c2, c3) \
21
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
22
++
23
++#define _str4cmp(m, c0, c1, c2, c3) \
24
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
25
++
26
++#define _str5cmp(m, c0, c1, c2, c3, c4)                          \
27
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
28
++    && m[4] == c4
29
++
30
++#define _str6cmp(m, c0, c1, c2, c3, c4, c5)                      \
31
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
32
++    && (((uint32_t *)m)[1] & 0xffff0000) == ((c4 << 24) | c5 << 16)
33
++
34
++#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7)             \
35
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
36
++    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
37
++
38
++#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7)              \
39
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
40
++    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
41
++
42
++#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8)                 \
43
++    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)        \
44
++    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7) \
45
++    && m[8] == c8
46
++#endif
47
+ 
48
+ #define __HTPARSE_GENHOOK(__n)                                                    \
49
+     static inline int hook_ ## __n ## _run(htparser * p, htparse_hooks * hooks) { \