%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 - 1.1.0-1 - initial version