about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/lua-modules
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/lua-modules
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/lua-modules')
-rw-r--r--nixpkgs/pkgs/development/lua-modules/generic/default.nix54
-rw-r--r--nixpkgs/pkgs/development/lua-modules/luasql.patch37
-rw-r--r--nixpkgs/pkgs/development/lua-modules/zip.patch23
3 files changed, 114 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/lua-modules/generic/default.nix b/nixpkgs/pkgs/development/lua-modules/generic/default.nix
new file mode 100644
index 000000000000..5669eae96c5e
--- /dev/null
+++ b/nixpkgs/pkgs/development/lua-modules/generic/default.nix
@@ -0,0 +1,54 @@
+{ lua, writeText }:
+
+{ buildInputs ? [], disabled ? false, ... } @ attrs:
+
+if disabled then
+  throw "${attrs.name} not supported by interpreter lua-${lua.luaversion}"
+else
+  lua.stdenv.mkDerivation (
+    {
+      makeFlags = [
+        "PREFIX=$(out)"
+        "LUA_LIBDIR=$(out)/lib/lua/${lua.luaversion}"
+        "LUA_INC=-I${lua}/include"
+      ];
+    }
+    //
+    attrs
+    //
+    {
+      name = "lua${lua.luaversion}-" + attrs.name;
+      buildInputs = buildInputs ++ [ lua ];
+
+      setupHook = writeText "setup-hook.sh" ''
+        # check for lua/clua modules and don't add duplicates
+
+        addLuaLibPath() {
+          local package_path="$1/share/lua/${lua.luaversion}"
+          if [[ ! -d $package_path ]]; then return; fi
+          if [[ $LUA_PATH = *"$package_path"* ]]; then return; fi
+
+          if [[ -z $LUA_PATH ]]; then
+            export LUA_PATH="$package_path/?.lua;$package_path/?/init.lua"
+          else
+            export LUA_PATH="$LUA_PATH;$package_path/?.lua;$package_path/?/init.lua"
+          fi
+        }
+
+        addLuaLibCPath() {
+          local package_cpath="$1/lib/lua/${lua.luaversion}"
+          if [[ ! -d $package_cpath ]]; then return; fi
+          if [[ $LUA_CPATH = *"$package_cpath"* ]]; then return; fi
+
+          if [[ -z $LUA_CPATH ]]; then
+            export LUA_CPATH="$package_cpath/?.so"
+          else
+            export LUA_CPATH="$LUA_CPATH;$package_cpath/?.so"
+          fi
+        }
+
+        addEnvHooks "$hostOffset" addLuaLibPath
+        addEnvHooks "$hostOffset" addLuaLibCPath
+      '';
+    }
+  )
diff --git a/nixpkgs/pkgs/development/lua-modules/luasql.patch b/nixpkgs/pkgs/development/lua-modules/luasql.patch
new file mode 100644
index 000000000000..e91840101ee5
--- /dev/null
+++ b/nixpkgs/pkgs/development/lua-modules/luasql.patch
@@ -0,0 +1,37 @@
+--- a/config	2013-02-18 19:36:44.000000000 +0400
++++ b/config	2014-10-01 08:36:37.104254404 +0400
+@@ -1,12 +1,12 @@
+ # $Id: config,v 1.10 2008/05/30 17:21:18 tomas Exp $
+ 
+ # Driver (leave uncommented ONLY the line with the name of the driver)
+-T= mysql
++#T= mysql
+ #T= oci8
+ #T= odbc
+ #T= postgres
+ #T= sqlite
+-#T=sqlite3
++T=sqlite3
+ #T=firebird
+ 
+ # Installation directories
+@@ -37,8 +37,8 @@
+ ######## MySQL
+ #DRIVER_LIBS= -L/usr/local/mysql/lib -lmysqlclient -lz
+ #DRIVER_INCS= -I/usr/local/mysql/include
+-DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
+-DRIVER_INCS= -I/usr/include/mysql
++#DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
++#DRIVER_INCS= -I/usr/include/mysql
+ ######## Oracle OCI8
+ #DRIVER_LIBS= -L/home/oracle/OraHome1/lib -lz -lclntsh
+ #DRIVER_INCS= -I/home/oracle/OraHome1/rdbms/demo -I/home/oracle/OraHome1/rdbms/public
+@@ -51,7 +51,7 @@
+ #DRIVER_LIBS= -lsqlite
+ #DRIVER_INCS=
+ ######## SQLite3 
+-#DRIVER_LIBS= -L/opt/local/lib -lsqlite3
++DRIVER_LIBS= -lsqlite3
+ #DRIVER_INCS= -I/opt/local/include
+ ######## ODBC
+ #DRIVER_LIBS= -L/usr/local/lib -lodbc
diff --git a/nixpkgs/pkgs/development/lua-modules/zip.patch b/nixpkgs/pkgs/development/lua-modules/zip.patch
new file mode 100644
index 000000000000..c3f88f451e8d
--- /dev/null
+++ b/nixpkgs/pkgs/development/lua-modules/zip.patch
@@ -0,0 +1,23 @@
+--- a/Makefile	2007-10-30 01:59:10.000000000 +0300
++++ b/Makefile	2014-09-18 11:04:53.176320021 +0400
+@@ -6,10 +6,6 @@
+
+ include $(CONFIG)
+
+-ifeq "$(LUA_VERSION_NUM)" "500"
+-COMPAT_O= $(COMPAT_DIR)/compat-5.1.o
+-endif
+-
+ SRCS= src/lua$T.c
+ OBJS= src/lua$T.o $(COMPAT_O)
+
+@@ -19,9 +15,6 @@
+ src/$(LIBNAME): $(OBJS)
+ 	export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/$(LIBNAME) $(OBJS) -lzzip
+
+-$(COMPAT_DIR)/compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c
+-	$(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
+-
+ install: src/$(LIBNAME)
+ 	mkdir -p $(LUA_LIBDIR)
+ 	cp src/$(LIBNAME) $(LUA_LIBDIR)