d994071
%if 0%{?fedora} >= 22
d994071
%define luaver 5.3
d994071
%else
4bfa664
%if 0%{?fedora} >= 20 || 0%{?rhel} > 7
4bfa664
%define luaver 5.2
4bfa664
%else
4bfa664
%define luaver 5.1
4bfa664
%endif
d994071
%endif
4bfa664
0135ceb
%define luacompatver 5.1
0135ceb
%define luacompatlibdir %{_libdir}/lua/%{luacompatver}
0135ceb
%define luacompatpkgdir %{_datadir}/lua/%{luacompatver}
0135ceb
%define lua51dir %{_builddir}/lua51-%{name}-%{version}-%{release}
0135ceb
138fc20
%global lualibdir %{_libdir}/lua/%{luaver}
138fc20
%global luapkgdir %{_datadir}/lua/%{luaver}
df9fd4d
138fc20
%global real_name luasec
df9fd4d
df9fd4d
Name:           lua-sec
0135ceb
Version:        0.5
d994071
Release:        4%{?dist}
df9fd4d
Summary:        Lua binding for OpenSSL library
df9fd4d
df9fd4d
Group:          Development/Libraries
df9fd4d
License:        MIT
138fc20
URL:            https://github.com/brunoos/luasec
0135ceb
Source0:        https://github.com/brunoos/luasec/archive/%{real_name}-%{version}.tar.gz
0135ceb
Patch0:         lua-sec-0.4.1-fix-Makefile.patch
df9fd4d
df9fd4d
BuildRequires:  lua-devel
df9fd4d
BuildRequires:  openssl-devel
df9fd4d
Requires:       lua-socket
df9fd4d
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
df9fd4d
Requires: lua(abi) = %{luaver}
df9fd4d
%else
df9fd4d
Requires: lua >= %{luaver}
df9fd4d
%endif
df9fd4d
0135ceb
%if 0%{?fedora} >= 20
0135ceb
BuildRequires:  compat-lua >= %{luacompatver}, compat-lua-devel >= %{luacompatver}
0135ceb
%endif
df9fd4d
df9fd4d
%description
df9fd4d
Lua binding for OpenSSL library to provide TLS/SSL communication.
df9fd4d
It takes an already established TCP connection and creates a secure
df9fd4d
session between the peers.
df9fd4d
0135ceb
%if 0%{?fedora} >= 20
0135ceb
%package compat
0135ceb
Summary:        Lua 5.1 binding for OpenSSL library
0135ceb
Group:          Development/Libraries
0135ceb
0135ceb
%description compat
0135ceb
Lua 5.1 binding for OpenSSL library to provide TLS/SSL communication.
0135ceb
It takes an already established TCP connection and creates a secure
0135ceb
session between the peers.
0135ceb
%endif
df9fd4d
df9fd4d
%prep
0135ceb
%setup -q -n %{real_name}-%{real_name}-%{version}
0135ceb
%patch0 -p1 -b .fixMakefile
4bfa664
df9fd4d
for file in CHANGELOG LICENSE; do
df9fd4d
    iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
df9fd4d
    touch -r $file $file.new && \
df9fd4d
    mv $file.new $file
df9fd4d
done
df9fd4d
0135ceb
%if 0%{?fedora} >= 20
0135ceb
rm -rf %{lua51dir}
0135ceb
cp -a . %{lua51dir}
0135ceb
%endif
df9fd4d
df9fd4d
%build
d994071
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC -I. -I%{_includedir} -DWITH_LUASOCKET -DLUASOCKET_DEBUG -DLUA_COMPAT_APIINTCASTS" \
0135ceb
    LD="gcc -shared" LDFLAGS="-O -fPIC -shared -L./luasocket" \
4bfa664
    linux
df9fd4d
0135ceb
%if 0%{?fedora} >= 20
0135ceb
pushd %{lua51dir}
d994071
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC -I. -I%{_includedir}/lua-%{luacompatver} -DWITH_LUASOCKET -DLUASOCKET_DEBUG -DLUA_COMPAT_APIINTCASTS" \
0135ceb
    LD="gcc -shared" LDFLAGS="-O -fPIC -shared -L./luasocket" \
0135ceb
    linux
0135ceb
popd
0135ceb
%endif
df9fd4d
df9fd4d
%install
df9fd4d
mkdir -p $RPM_BUILD_ROOT%{luapkgdir}
df9fd4d
mkdir -p $RPM_BUILD_ROOT%{lualibdir}
4bfa664
make install DESTDIR=$RPM_BUILD_ROOT \
d994071
    CFLAGS="$RPM_OPT_FLAGS -fPIC -I. -I%{_includedir}/lua-%{luaver} -DWITH_LUASOCKET -DLUASOCKET_DEBUG -DLUA_COMPAT_APIINTCASTS" \
0135ceb
    LUAPATH=%{luapkgdir} \
0135ceb
    LUACPATH=%{lualibdir}
0135ceb
0135ceb
%if 0%{?fedora} >= 20
0135ceb
pushd %{lua51dir}
0135ceb
mkdir -p $RPM_BUILD_ROOT%{luacompatpkgdir}
0135ceb
mkdir -p $RPM_BUILD_ROOT%{luacompatlibdir}
0135ceb
make install DESTDIR=$RPM_BUILD_ROOT \
d994071
    CFLAGS="$RPM_OPT_FLAGS -fPIC -I. -I%{_includedir}/lua-%{luacompatver} -DWITH_LUASOCKET -DLUASOCKET_DEBUG -DLUA_COMPAT_APIINTCASTS" \
0135ceb
    LUAPATH=%{luacompatpkgdir} \
0135ceb
    LUACPATH=%{luacompatlibdir}
0135ceb
popd
0135ceb
%endif
df9fd4d
df9fd4d
df9fd4d
%files
df9fd4d
%defattr(-,root,root,-)
df9fd4d
%doc CHANGELOG LICENSE
df9fd4d
%{lualibdir}/ssl.so
df9fd4d
%{luapkgdir}/ssl.lua
df9fd4d
%dir %{luapkgdir}/ssl
df9fd4d
%{luapkgdir}/ssl/*
df9fd4d
0135ceb
%if 0%{?fedora} >= 20
0135ceb
%files compat
0135ceb
%defattr(-,root,root,-)
0135ceb
%doc CHANGELOG LICENSE
0135ceb
%{luacompatlibdir}/ssl.so
0135ceb
%{luacompatpkgdir}/ssl.lua
0135ceb
%dir %{luacompatpkgdir}/ssl
0135ceb
%{luacompatpkgdir}/ssl/*
0135ceb
%endif
df9fd4d
df9fd4d
%changelog
d994071
* Fri Jan 16 2015 Tom Callaway <spot@fedoraproject.org> - 0.5-4
d994071
- rebuild for lua 5.3
d994071
d331c22
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-3
d331c22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
d331c22
7b16f0b
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-2
7b16f0b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
7b16f0b
0135ceb
* Wed May 14 2014 Jan Kaluza <jkaluza@redhat.com> - 0.5-1
0135ceb
- update to luasec-0.5 (#1000622)
0135ceb
- build -compat subpackage against compat-lua
4bfa664
29be652
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.1-6
29be652
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
29be652
20b6a1d
* Sun May 12 2013 Tom Callaway <spot@fedoraproject.org> - 0.4.1-5
20b6a1d
- rebuild for lua 5.2
20b6a1d
73ff0cf
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.1-4
73ff0cf
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
73ff0cf
47bedbb
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.1-3
47bedbb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
47bedbb
df9fd4d
* Tue Mar 06 2012 Johan Cwiklinski <johan AT x-tnd DOT be> 0.4.1-2
df9fd4d
- Remove __mkdir macros
df9fd4d
df9fd4d
* Tue Mar 06 2012 Johan Cwiklinski <johan AT x-tnd DOT be> 0.4.1-1
df9fd4d
- 0.4.1
df9fd4d
- Add lua as a Requires (bz #551763)
df9fd4d
df9fd4d
* Fri Jan 01 2010 Johan Cwiklinski <johan AT x-tnd DOT be> 0.4-1
df9fd4d
- Initial packaging