pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/54492: databases/lua-sqlite multiples problems
>Number: 54492
>Category: pkg
>Synopsis: databases/lua-sqlite multiples problems
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Aug 27 09:45:00 +0000 2019
>Originator: clement bouvier
>Release: current
>Organization:
>Environment:
macOS mojave darwin.
>Description:
Multiple errors:
ERROR: lib/lua/5.1/libluasqlite.so: relative library path: libluasqlite.so
ERROR: lib/lua/5.1/libluasqlite.so: missing library: libluasqlite.so
MESSAGE is not adapted to lua 5.1.
The test script (test.lua) provided by the package segfault.
>How-To-Repeat:
Run test.lua with the warning from MESSAGE (adapted to 5.1) or try to install the pkg with PKG_DEVELOPER.
>Fix:
* Adapt message to lua 5.1
* migrate the pkg build to libtool in order to avoid any rpath problem.
* patch test.lua and the c library provided so as to avoid any segfault
Index: MESSAGE
===================================================================
RCS file: /cvsroot/pkgsrc/databases/lua-sqlite/MESSAGE,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 MESSAGE
--- MESSAGE 5 Apr 2004 14:16:14 -0000 1.1.1.1
+++ MESSAGE 27 Aug 2019 09:37:45 -0000
@@ -4,6 +4,6 @@
To use luasqlite in your lua programs you must set this environment
variable:
- LUA_INIT = "loadlib('${PREFIX}/lib/libluasqlite.so','luaLM_import')();"
+LUA_INIT="package.loadlib('${PREFIX}/${LUA_CDIR}/libluasqlite.so','luaLM_import')();"
===========================================================================
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/databases/lua-sqlite/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- Makefile 20 Jan 2015 19:56:54 -0000 1.20
+++ Makefile 27 Aug 2019 09:37:45 -0000
@@ -12,6 +12,10 @@
HOMEPAGE= http://lua-users.org/wiki/LuaSqlite
COMMENT= SQLite binding for LUA
+MESSAGE_SUBST+= LUA_CDIR="${LUA_CDIR}"
+
+USE_LIBTOOL= yes
+
WRKSRC= ${WRKDIR}
CFLAGS+= -fPIC
@@ -23,12 +27,14 @@
INSTALLATION_DIRS+= ${LUA_CDIR} ${LUA_DOCDIR} ${LUA_EXAMPLESDIR}
do-build:
- cd ${WRKSRC}; ${CC} -shared ${CFLAGS} ${LDFLAGS} lsqlite.c \
- -o libluasqlite.so ${LIBS}
+ cd ${WRKSRC}
+ ${LIBTOOL} --tag=CC --mode=compile ${CC} ${CFLAGS} -c ${WRKSRC}/lsqlite.c -o ${WRKDIR}/lsqlite.lo
+ ${LIBTOOL} --tag=CC --mode=link ${CC} ${LDFLAGS} -no-undefined -module -avoid-version -o ${WRKDIR}/libluasqlite.la \
+ ${WRKDIR}/lsqlite.lo -rpath ${PREFIX}/lib/${LUA_CDIR} ${LIBS}
do-install:
- ${INSTALL_DATA} ${WRKSRC}/libluasqlite.so \
- ${DESTDIR}${PREFIX}/${LUA_CDIR}
+ ${LIBTOOL} --mode=install ${INSTALL_LIB} ${WRKDIR}/libluasqlite.la \
+ ${DESTDIR}${PREFIX}/${LUA_CDIR}
${INSTALL_DATA} ${WRKSRC}/readme.txt \
${DESTDIR}${PREFIX}/${LUA_DOCDIR}
${INSTALL_DATA} ${WRKSRC}/test.lua \
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/databases/lua-sqlite/PLIST,v
retrieving revision 1.3
diff -u -r1.3 PLIST
--- PLIST 3 May 2014 13:01:24 -0000 1.3
+++ PLIST 27 Aug 2019 09:37:45 -0000
@@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.3 2014/05/03 13:01:24 alnsn Exp $
-${LUA_CDIR}/libluasqlite.so
+${LUA_CDIR}/libluasqlite.la
${LUA_DOCDIR}/readme.txt
${LUA_EXAMPLESDIR}/test.lua
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/databases/lua-sqlite/distinfo,v
retrieving revision 1.3
diff -u -r1.3 distinfo
--- distinfo 3 Nov 2015 01:56:14 -0000 1.3
+++ distinfo 27 Aug 2019 09:37:45 -0000
@@ -4,3 +4,5 @@
RMD160 (lsqlite_src.zip) = 717771b68507c54c9b0b540ed2ab70adb53cd420
SHA512 (lsqlite_src.zip) = 7933a735559815a67d26225a69de72bea55ff529672820abfe10346b0194dff62a1bc4c6625a0a8621417d5b79a4035d21196f31a2beabb7a6f5e1703b6fb012
Size (lsqlite_src.zip) = 321990 bytes
+SHA1 (patch-lsqlite.c) = 6a05eb64bf873184eb121d9d04a977f934899574
+SHA1 (patch-test.lua) = 808850ff36d41dfbc20044f710a04abcbf9e369d
Index: patches/patch-lsqlite.c
===================================================================
RCS file: patches/patch-lsqlite.c
diff -N patches/patch-lsqlite.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lsqlite.c 27 Aug 2019 09:37:45 -0000
@@ -0,0 +1,23 @@
+$NetBSD$
+* Keep the same logic as lsql_ on lsql_finalize
+* Avoid a segfault on test.lua sqlite.finalize part if no error
+
+--- lsqlite.c.orig 2003-02-28 09:00:22.000000000 +0000
++++ lsqlite.c
+@@ -327,14 +327,11 @@ int lsql_step(lua_State *L)
+ int lsql_finalize(lua_State *L)
+ {
+ dbud *ud = ls_checknargs_vm_getbdud(L,1,"sqlite.finalize(db)");
+- char *errmsg;
+ int err;
+ // do it
+- err = sqlite_finalize( ud->vm , &errmsg );
++ err = sqlite_finalize( ud->vm , NULL);
+ lua_pushnumber(L, (lua_Number )err);
+- lua_pushstring(L,errmsg);
+- if( errmsg != NULL ) sqlite_freemem( errmsg );
+- return 2;
++ return 1;
+ }
+
+ /*
Index: patches/patch-test.lua
===================================================================
RCS file: patches/patch-test.lua
diff -N patches/patch-test.lua
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-test.lua 27 Aug 2019 09:37:45 -0000
@@ -0,0 +1,16 @@
+$NetBSD$
+* Prefer require lua function for loading module.
+
+--- test.lua.orig 2003-02-28 09:00:00.000000000 +0000
++++ test.lua
+@@ -25,8 +25,8 @@ print(os.date"%Y-%b-%d %H:%M:%S")
+
+ -- open binary module
+
+-ok,str=module.load"sqlite"
+-if (not ok)
++sqlite = require("sqlite")
++if (not sqlite)
+ then do print ("Error on module.load: ", str) break end
+ end
+
Home |
Main Index |
Thread Index |
Old Index