initial version

This commit is contained in:
Dan Callaghan 2014-06-05 17:39:12 +10:00 committed by Dan Callaghan
parent 12b27b2da5
commit 1cad9b9a7f
5 changed files with 159 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/lualdap-1.1.0.tar.gz

16
destdir.patch Normal file
View File

@ -0,0 +1,16 @@
diff -ur lualdap-1.1.0.orig/Makefile lualdap-1.1.0/Makefile
--- lualdap-1.1.0.orig/Makefile 2007-03-14 08:07:33.000000000 +1000
+++ lualdap-1.1.0/Makefile 2014-06-05 15:33:23.377297238 +1000
@@ -20,9 +20,9 @@
$(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
install: src/$(LIBNAME)
- mkdir -p $(LUA_LIBDIR)
- cp src/$(LIBNAME) $(LUA_LIBDIR)
- cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so
+ mkdir -p $(DESTDIR)$(LUA_LIBDIR)
+ cp src/$(LIBNAME) $(DESTDIR)$(LUA_LIBDIR)
+ ln -s $(LIBNAME) $(DESTDIR)$(LUA_LIBDIR)/$T.so
clean:
rm -f $(OBJS) src/$(LIBNAME)

107
lua-ldap.spec Normal file
View File

@ -0,0 +1,107 @@
%if 0%{?fedora} >= 20 || 0%{?rhel} > 7
%global luaver 5.2
%global luacompatver 5.1
%global luacompatlibdir %{_libdir}/lua/%{luacompatver}
%global luacompatpkgdir %{_datadir}/lua/%{luacompatver}
%global compatbuilddir %{_builddir}/lua51-%{name}-%{version}-%{release}
%else
%global luaver 5.1
%endif
%global lualibdir %{_libdir}/lua/%{luaver}
%global luapkgdir %{_datadir}/lua/%{luaver}
Name: lua-ldap
Version: 1.1.0
Release: 1%{?dist}
Summary: LDAP client library for Lua, using OpenLDAP
License: MIT
URL: http://www.keplerproject.org/lualdap/
Source0: http://files.luaforge.net/releases/lualdap/lualdap/LuaLDAP%{version}/lualdap-%{version}.tar.gz
# obey DESTDIR in the Makefile
Patch0: destdir.patch
# fixes for Lua 5.2 compatibility
Patch1: lua52.patch
BuildRequires: lua-devel
BuildRequires: openldap-devel
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
Requires: lua(abi) = %{luaver}
%else
Requires: lua >= %{luaver}
%endif
%description
LuaLDAP is a simple interface from Lua to an LDAP client. It enables a Lua
program to:
* Connect to an LDAP server;
* Execute any operation (search, add, compare, delete, modify and rename);
* Retrieve entries and references of the search result.
%if "%{?luacompatver}"
%package compat
Summary: LDAP client library for Lua 5.1, using OpenLDAP
BuildRequires: compat-lua-devel >= %{luacompatver}
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
Requires: lua(abi) = %{luacompatver}
%else
Requires: lua >= %{luacompatver}
%endif
%description compat
LuaLDAP is a simple interface from Lua to an LDAP client. It enables a Lua 5.1
program to:
* Connect to an LDAP server;
* Execute any operation (search, add, compare, delete, modify and rename);
* Retrieve entries and references of the search result.
%endif
%prep
%setup -q -n lualdap-%{version}
%patch0 -p1
%patch1 -p1
%if "%{?luacompatver}"
rm -rf %{compatbuilddir}
cp -a . %{compatbuilddir}
%endif
echo "CFLAGS = $RPM_OPT_FLAGS -fPIC -I%{_includedir} -DLDAP_DEPRECATED" >>config
echo "LUA_VERSION_NUM = $(subst .,,%{luaver})0" >>config
echo "LUA_LIBDIR = %{lualibdir}" >>config
%if "%{?luacompatver}"
echo "CFLAGS = $RPM_OPT_FLAGS -fPIC -I%{_includedir}/lua-%{luacompatver} -DLDAP_DEPRECATED" >>%{compatbuilddir}/config
echo "LUA_VERSION_NUM = $(subst .,,%{luacompatver})0" >>%{compatbuilddir}/config
echo "LUA_LIBDIR = %{luacompatlibdir}" >>%{compatbuilddir}/config
%endif
%build
make %{?_smp_mflags}
%if "%{?luacompatver}"
pushd %{compatbuilddir}
make %{?_smp_mflags}
popd
%endif
%install
make install DESTDIR=%{buildroot}
%if "%{?luacompatver}"
pushd %{compatbuilddir}
make install DESTDIR=%{buildroot}
popd
%endif
%files
%doc README doc/
%{lualibdir}/lualdap.so*
%if "%{?luacompatver}"
%files compat
%doc README doc/
%{luacompatlibdir}/lualdap.so*
%endif
%changelog
* Thu Jun 05 2014 Dan Callaghan <dcallagh@redhat.com> - 1.1.0-1
- initial version

34
lua52.patch Normal file
View File

@ -0,0 +1,34 @@
diff -ur lualdap-1.1.0.orig/src/lualdap.c lualdap-1.1.0/src/lualdap.c
--- lualdap-1.1.0.orig/src/lualdap.c 2007-12-15 01:11:22.000000000 +1000
+++ lualdap-1.1.0/src/lualdap.c 2014-06-05 15:34:22.657478715 +1000
@@ -25,6 +25,12 @@
#include "compat-5.1.h"
#endif
+#ifndef luaL_getn
+// Lua 5.1 converted this to a macro, 5.2 dropped it entirely...
+// This is the definition from 5.1
+#define luaL_getn(L,i) ((int)lua_objlen(L, i))
+#endif
+
#ifdef WINLDAPAPI
#define timeval l_timeval
typedef ULONG ldap_int_t;
@@ -872,7 +878,7 @@
** Create a metatable.
*/
static int lualdap_createmeta (lua_State *L) {
- const luaL_reg methods[] = {
+ const luaL_Reg methods[] = {
{"close", lualdap_close},
{"add", lualdap_add},
{"compare", lualdap_compare},
@@ -987,7 +993,7 @@
** Create ldap table and register the open method.
*/
int luaopen_lualdap (lua_State *L) {
- struct luaL_reg lualdap[] = {
+ struct luaL_Reg lualdap[] = {
{"open_simple", lualdap_open_simple},
{NULL, NULL},
};

View File

@ -0,0 +1 @@
5e104520c3f1333f38817a9fa1e76681 lualdap-1.1.0.tar.gz