From: Enrico Tassi <gareuselesinge@debian.org>
Date: Sun, 11 May 2014 17:12:35 +0200
Subject: make

===================================================================
---
 Makefile | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index e42ac1a..d79bba1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,12 @@
 # TODO: support for abi&libtool, installation of lua-curl.h
 
-LIBNAME=liblua5.1-curl
+LIBNAME=liblua5.2-curl
 LIBTOOL=libtool --silent --tag=CC
 HEADER=/usr/include/curl/curl.h
 PREFIX=/usr/local/
 #LUA=lua50
-LUA=lua5.1
+#LUA=lua5.1
+LUA=lua5.2
 LUADOC= luadoc
 VERSION_INFO=0:0:0
 
@@ -15,6 +16,24 @@ CURL_CFLAGS:= $(shell curl-config --cflags 2>/dev/null) $(shell getconf LFS_CFLA
 CURL_LDFLAGS:= $(shell curl-config --libs 2>/dev/null)
 REALSO:=$(LIBNAME).so.$(subst :,.,$(VERSION_INFO))
 
+# ------------------------------ lua5.2 stuff ---------------------------------
+ifeq "$(LUA)" "lua5.2"
+LUA_CFLAGS := $(shell pkg-config lua5.2 --cflags) $(shell getconf LFS_CFLAGS) -DLUA_COMPAT_ALL -DLUA52_API
+# This retrieves the name of the libtool convenience library for Lua
+# (e.g. "/usr/lib/liblua5.2.la") used by --mode=link.
+LUA_LIBTOOL_S := $(shell pkg-config lua5.2 --variable=libtool_lib)
+LUA_LIBTOOL_D := $(LUA_LIBTOOL_S)
+# this is the path where you'll eventually install the module
+LUA_RPATH:=$(shell pkg-config lua5.2 --define-variable=prefix=$(PREFIX) \
+	--variable=INSTALL_CMOD)
+# this is the path where you'll eventually install the C header file
+LUA_HPATH:=$(shell pkg-config lua5.2 --define-variable=prefix=$(PREFIX) \
+	--variable=includedir)/lua5.2
+LUA_DPATH:=$(PREFIX)/share/doc/luacurl/
+LUA_LPATH:=$(PREFIX)/lib/
+OBJS:= lua-curl.lo luabind.lo
+endif
+
 # ------------------------------ lua5.1 stuff ---------------------------------
 ifeq "$(LUA)" "lua5.1"
 LUA_CFLAGS := $(shell pkg-config lua5.1 --cflags) $(shell getconf LFS_CFLAGS)
@@ -119,8 +138,8 @@ curl_netrcopt.h:$(HEADER)
 		> curl_netrcopt.h
 
 curl_authopt.h:$(HEADER)
-	$(H)cat $(HEADER) | grep "CURLAUTH_" | \
-		sed "s/#define *CURL/{\"/" | sed "s/ *\/\*.*\*\///" | \
+	$(H)cat $(HEADER) | grep "define *CURLAUTH_" | \
+		sed "s/#define *CURL/{\"/" | sed "s/ *\/\*.*//" | \
 		sed "s/ /\",/" | sed "s/$$/},/" > curl_authopt.h
 
 curl_ftpauthopt.h:$(HEADER)
