Package Details: lua-sql-sqlite 2.6.0-1

Git Clone URL: https://aur.archlinux.org/luasql.git (read-only, click to copy)
Package Base: luasql
Description: SQLite module for Lua
Upstream URL: https://keplerproject.github.io/luasql
Licenses: MIT
Submitter: Barthalion
Maintainer: alerque
Last Packager: alerque
Votes: 3
Popularity: 0.59
First Submitted: 2018-01-07 16:33 (UTC)
Last Updated: 2024-03-28 15:07 (UTC)

Latest Comments

Nazdravi commented on 2024-11-27 09:48 (UTC) (edited on 2024-11-27 09:53 (UTC) by Nazdravi)

Version 2.6.0 of this package does not function with a current Lua version (5.4.7). When trying to open a database the result is: "undefined symbol: lua_newuserdata". That's why it was necessary to use a more recent version of this library:

--- PKGBUILD.orig       2024-11-27 10:39:00.541644400 +0100
+++ PKGBUILD    2024-11-26 22:29:59.788440597 +0100
@@ -5,23 +5,27 @@

 pkgbase=luasql
 pkgname=('lua-sql-mysql' 'lua-sql-postgres' 'lua-sql-sqlite')
-pkgver=2.6.0
+pkgver=d60f8b2
 pkgrel=1
 arch=('x86_64')
 url='https://keplerproject.github.io/luasql'
 license=('MIT')
 makedepends=('lua' 'libmariadbclient' 'postgresql-libs' 'sqlite')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/$pkgver.tar.gz")
-sha256sums=('8ec445c58fa6148be759080c08f37baea5c3fa84f766197db9bf9c8edb6f8e60')
+source=("$pkgbase-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/$pkgver.tar.gz")
+sha256sums=('b6e9577dedd0ddbb8d4f82d7f8126eaae3d88a3ea59b98bd069dfc5a2ca22add')
+
+luaversion=$(lua -v | sed -E -e 's/^Lua ([0-9]+\.[0-9]+).*$/\1/')

 prepare() {
-  cd $pkgbase-$pkgver
+  cd $(find ./ -name "$pkgbase-$pkgver*" -type d)
   # Lua 5.3 compat
-  sed -i -e 's/luaL_optint/(int)luaL_optinteger/' src/ls_mysql.c
+  # sed -i -e 's/luaL_optint/(int)luaL_optinteger/' src/ls_mysql.c
+  # currently installed lua version
+  sed -E -i -e 's/ 5\.2$/ '$luaversion'/' config
 }

 build() {
-  cd $pkgbase-$pkgver
+  cd $(find ./ -name "$pkgbase-$pkgver*" -type d)
   msg2 'Building sqlite support'
   make sqlite3 PREFIX=/usr DRIVER_LIBS='-lsqlite3' DRIVER_INCS='-std=c99'
   msg2 'Building PostgreSQL support'
@@ -37,8 +41,8 @@
   conflicts=('luasql-mysql')
   replaces=('luasql-mysql')

-  cd $pkgbase-$pkgver
-  install -Dm644 src/mysql.so "$pkgdir/usr/lib/lua/5.3/luasql/mysql.so"
+  cd $(find ./ -name "$pkgbase-$pkgver*" -type d)
+  install -Dm644 src/mysql.so "$pkgdir/usr/lib/lua/$luaversion/luasql/mysql.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

@@ -46,8 +50,8 @@
   pkgdesc='PostgreSQL module for Lua'
   depends=('lua' 'postgresql-libs')

-  cd $pkgbase-$pkgver
-  install -Dm644 src/postgres.so "$pkgdir/usr/lib/lua/5.3/luasql/postgres.so"
+  cd $(find ./ -name "$pkgbase-$pkgver*" -type d)
+  install -Dm644 src/postgres.so "$pkgdir/usr/lib/lua/$luaversion/luasql/postgres.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

@@ -55,8 +59,8 @@
   pkgdesc='SQLite module for Lua'
   depends=('lua' 'sqlite')

-  cd $pkgbase-$pkgver
-  install -Dm644 src/sqlite3.so "$pkgdir/usr/lib/lua/5.3/luasql/sqlite3.so"
+  cd $(find ./ -name "$pkgbase-$pkgver*" -type d)
+  install -Dm644 src/sqlite3.so "$pkgdir/usr/lib/lua/$luaversion/luasql/sqlite3.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

Nazdravi commented on 2023-08-01 08:09 (UTC) (edited on 2023-08-01 08:16 (UTC) by Nazdravi)

Did not run unmodified with Lua5.4 (as it is installed currently). That's why patching PKGBUILD was necessary:

--- original/PKGBUILD   2023-07-31 22:17:07.603493494 +0200
+++ new/PKGBUILD    2023-08-01 09:53:57.093176209 +0200
@@ -14,10 +14,14 @@
 source=("$pkgname-$pkgver.tar.gz::https://github.com/keplerproject/luasql/archive/$pkgver.tar.gz")
 sha256sums=('8ec445c58fa6148be759080c08f37baea5c3fa84f766197db9bf9c8edb6f8e60')

+luaversion=$(lua -v | sed -E -e 's/^Lua ([0-9]+\.[0-9]+).*$/\1/')
+
 prepare() {
   cd $pkgbase-$pkgver
   # Lua 5.3 compat
   sed -i -e 's/luaL_optint/(int)luaL_optinteger/' src/ls_mysql.c
+  # currently installed lua version
+  sed -E -i -e 's/ 5\.2$/ '$luaversion'/' config
 }

 build() {
@@ -38,7 +42,7 @@
   replaces=('luasql-mysql')

   cd $pkgbase-$pkgver
-  install -Dm644 src/mysql.so "$pkgdir/usr/lib/lua/5.3/luasql/mysql.so"
+  install -Dm644 src/mysql.so "$pkgdir/usr/lib/lua/$luaversion/luasql/mysql.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

@@ -47,7 +51,7 @@
   depends=('lua' 'postgresql-libs')

   cd $pkgbase-$pkgver
-  install -Dm644 src/postgres.so "$pkgdir/usr/lib/lua/5.3/luasql/postgres.so"
+  install -Dm644 src/postgres.so "$pkgdir/usr/lib/lua/$luaversion/luasql/postgres.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

@@ -56,7 +60,7 @@
   depends=('lua' 'sqlite')

   cd $pkgbase-$pkgver
-  install -Dm644 src/sqlite3.so "$pkgdir/usr/lib/lua/5.3/luasql/sqlite3.so"
+  install -Dm644 src/sqlite3.so "$pkgdir/usr/lib/lua/$luaversion/luasql/sqlite3.so"
   install -Dm644 doc/us/license.html "$pkgdir/usr/share/licenses/$pkgname/license.html"
 }

alerque commented on 2020-02-09 07:18 (UTC)

Upstream seems to have moved here: https://keplerproject.github.io/luasql/