On Mon, 28 Apr 2014 13:47:49 +0200
Enrico Tassi <gareuselesi...@debian.org> wrote:

> On Sun, Apr 27, 2014 at 11:22:50PM -0700, Igor Bogomazov wrote:
> > the package cannot be used with Lua 5.2 that is current stable
> > release of the language; also this is the only cURL wrapper Lua
> > library available in Debian repository; does it make sense for you
> > to adopt the package so that it could be used with Lua 5.2?
> 
> Sorry but I'm not following.  What do you mean by "adopting" here?
> 
> > I could successfully recompile it from sources with only few lines
> > of code fixed. I am ready to attach the patch here if it might be
> > useful, though the modifications are quite straightforward and well
> > documented…
> > 
> > Anyway, let me know if I can help with this!
> 
> Sure!  Your patch is welcome, and any help too.
> 
> Ciao

Sorry for my English… by adopting I mean to make it work with Lua 5.2

in attachment is what I applied to debian/ directory (from
lua-curl_0.3.0-7.debian.tar.gz) so that I could re-build lua-curl with
«debuild -i -us -uc -b -d»

after «sudo dpkg -i lua-curl_0.3.0-7_amd64.deb» it works as expected:

$ lua5.2 -e 'print((require "curl").version())'
libcurl/7.36.0 GnuTLS/2.12.23 zlib/1.2.8 libidn/1.28 libssh2/1.4.3
librtmp/2.3


-- 
Sincerely yours,

Igor Bogomazov
Saint-Petersburg, Russia

diff --git a/control b/control
index 2fc5efc..c85c2de 100644
--- a/control
+++ b/control
@@ -13,11 +13,11 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: multiarch-support
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Replaces: liblua5.1-curl0 (<< 0.3.0-6~)
-Breaks: liblua5.1-curl0 (<< 0.3.0-6~)
-Provides: liblua5.1-curl0, ${lua:Provides}
+Replaces: liblua5.2-curl0 (<< 0.3.0-7~)
+Breaks: liblua5.2-curl0 (<< 0.3.0-7~)
+Provides: liblua5.2-curl0, ${lua:Provides}
 XB-Lua-Versions: ${lua:Versions}
-Description: libcURL bindings for the Lua language version 5.1
+Description: libcURL bindings for the Lua language version 5.2
  This package contains the bindings for the cURL library.
  Currently many different implementations of cURL bindings are available,
  this package includes the one developed for the FreePOPs project
@@ -29,9 +29,9 @@ Multi-Arch: same
 Pre-Depends: multiarch-support
 Section: libdevel
 Depends: lua-curl (= ${binary:Version}), ${misc:Depends}
-Replaces: liblua5.1-curl-dev (<< 0.3.0-6~)
-Breaks: liblua5.1-curl-dev (<< 0.3.0-6~)
-Provides: liblua5.1-curl-dev, ${lua:Provides}
+Replaces: liblua5.2-curl-dev (<< 0.3.0-7~)
+Breaks: liblua5.2-curl-dev (<< 0.3.0-7~)
+Provides: liblua5.2-curl-dev, ${lua:Provides}
 XB-Lua-Versions: ${lua:Versions}
 Description: libcURL development files for the Lua language
  This package contains the development files of the libcURL Lua bindings,
@@ -40,7 +40,7 @@ Description: libcURL development files for the Lua language
  .
  Documentation is also shipped within this package.
 
-Package: liblua5.1-curl0
+Package: liblua5.2-curl0
 Section: oldlibs
 Priority: extra
 Architecture: all
@@ -49,7 +49,7 @@ Description: Transitional package for lua-curl
  This is a transitional package to ease upgrades to the lua-curl
  package. It can safely be removed.
 
-Package: liblua5.1-curl-dev
+Package: liblua5.2-curl-dev
 Section: oldlibs
 Priority: extra
 Architecture: all
diff --git a/dh-lua.conf b/dh-lua.conf
index 13b3569..72c4ea6 100644
--- a/dh-lua.conf
+++ b/dh-lua.conf
@@ -1,7 +1,7 @@
-LUA_VERSION=5.1
+LUA_VERSION=5.2
 PKG_NAME=curl
 
-CLIB_CFLAGS= $(shell curl-config --cflags 2>/dev/null) $(shell getconf LFS_CFLGAS)
+CLIB_CFLAGS= $(shell curl-config --cflags 2>/dev/null) $(shell getconf LFS_CFLGAS) -DLUA52_API -DLUA_COMPAT_ALL
 CLIB_LDFLAGS= $(shell curl-config --libs 2>/dev/null) $(shell getconf LFS_LIBS)
 CLIB_OBJS= lua-curl.lo luabind.lo
 
diff --git a/patches/lua-curl.patch b/patches/lua-curl.patch
new file mode 100644
index 0000000..526141a
--- /dev/null
+++ b/patches/lua-curl.patch
@@ -0,0 +1,18 @@
+Description: added Lua 5.2 compatibility
+Index: lua-curl-0.3.0/lua-curl.c
+===================================================================
+--- lua-curl-0.3.0.orig/lua-curl.c	2008-10-25 08:26:26.000000000 -0700
++++ lua-curl-0.3.0/lua-curl.c	2014-04-28 23:08:45.839340610 -0700
+@@ -49,6 +49,12 @@
+   #include "compat-5.1.h"
+ #endif
+ 
++#ifdef LUA52_API
++/* Lua 5.2 compatibility trick */
++#define luaL_reg			luaL_Reg
++#define luaL_register(L,name,tbl)	luaL_setfuncs(L,tbl,0)
++#endif
++
+ #define CURL_EASY_META_NAME "curleasy.type"
+ 
+ /* think more if this means unicity... maybe store in the bag some pointers */
diff --git a/patches/make.patch b/patches/make.patch
index 441e62e..d0734e7 100644
--- a/patches/make.patch
+++ b/patches/make.patch
@@ -1,10 +1,50 @@
-Author: Enrico Tassi <gareuselesi...@debian.org>
 Description: fix regex to get auth options from curl.h
+ add Lua 5.2 section
 Index: lua-curl-0.3.0/Makefile
 ===================================================================
---- lua-curl-0.3.0.orig/Makefile	2008-10-25 17:26:26.000000000 +0200
-+++ lua-curl-0.3.0/Makefile	2012-05-30 21:57:54.000000000 +0200
-@@ -119,8 +119,8 @@
+--- lua-curl-0.3.0.orig/Makefile	2008-10-25 08:26:26.000000000 -0700
++++ lua-curl-0.3.0/Makefile	2014-04-28 22:59:12.009078537 -0700
+@@ -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_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
  
  curl_authopt.h:$(HEADER)
diff --git a/patches/series b/patches/series
index 6a21a5b..e10fcb4 100644
--- a/patches/series
+++ b/patches/series
@@ -1,2 +1,3 @@
 test.patch
 make.patch
+lua-curl.patch
diff --git a/patches/test.patch b/patches/test.patch
index 93fd8f5..ae7f4c7 100644
--- a/patches/test.patch
+++ b/patches/test.patch
@@ -5,4 +5,5 @@ Description: make the test work
 @@ -1,2 +1,3 @@
 +curl = require "curl"
  print(curl.version())
- table.foreach(package.loaded,print)
+-table.foreach(package.loaded,print)
++for k,v in pairs(package.loaded) do print(k,v) end

Reply via email to