luasec: fix build with OPENSSL_NO_COMP 3035/head
authorJo-Philipp Wich <jo@mein.io>
Tue, 9 Aug 2016 07:35:21 +0000 (09:35 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 9 Aug 2016 07:35:21 +0000 (09:35 +0200)
Currently luasec fails to build if OpenSSL was built without compression
support due to an undefined COMP_METHOD type:

    ssl.c: In function 'meth_compression':
    ssl.c:404:9: error: unknown type name 'COMP_METHOD'
       const COMP_METHOD *comp;
             ^
    <builtin>: recipe for target 'ssl.o' failed
    make[6]: *** [ssl.o] Error 1

Add a local patch to stub the `meth_compression()` function if there is no
compression support available in the OpenSSL library in order to allow
luasec to build.

A similar fix has been added upstream with
https://github.com/brunoos/luasec/pull/30

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
lang/luasec/Makefile
lang/luasec/patches/200-compression-method-fix.patch [new file with mode: 0644]

index 6429b2d3e74a9d87578d8699fcb6fea0a60d476f..532fd303e50ecc47197908153199af4e1f7da599 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luasec
 PKG_VERSION:=0.5.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/brunoos/luasec/archive/
diff --git a/lang/luasec/patches/200-compression-method-fix.patch b/lang/luasec/patches/200-compression-method-fix.patch
new file mode 100644 (file)
index 0000000..e249bfb
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/src/ssl.c
++++ b/src/ssl.c
+@@ -401,17 +401,21 @@ static int meth_want(lua_State *L)
+  */
+ static int meth_compression(lua_State *L)
+ {
++#ifndef OPENSSL_NO_COMP
+   const COMP_METHOD *comp;
++#endif
+   p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
+   if (ssl->state != LSEC_STATE_CONNECTED) {
+     lua_pushnil(L);
+     lua_pushstring(L, "closed");
+     return 2;
+   }
++#ifndef OPENSSL_NO_COMP
+   comp = SSL_get_current_compression(ssl->ssl);
+   if (comp)
+     lua_pushstring(L, SSL_COMP_get_name(comp));
+   else
++#endif
+     lua_pushnil(L);
+   return 1;
+ }