4bfa664
%if 0%{?fedora} >= 20 || 0%{?rhel} > 7
4bfa664
%define luaver 5.2
4bfa664
%else
4bfa664
%define luaver 5.1
4bfa664
%endif
4bfa664
138fc20
%global lualibdir %{_libdir}/lua/%{luaver}
138fc20
%global luapkgdir %{_datadir}/lua/%{luaver}
df9fd4d
138fc20
%global real_name luasec
138fc20
%global github_commit 063e8a8a5c57858cdc845f8d51b994426edd37ab
138fc20
%global shortcommit %(c=%{github_commit}; echo ${c:0:7})
df9fd4d
df9fd4d
Name:           lua-sec
df9fd4d
Version:        0.4.1
4bfa664
Release:        6.0.3.20130824R%{shortcommit}%{?dist}
df9fd4d
Summary:        Lua binding for OpenSSL library
df9fd4d
df9fd4d
Group:          Development/Libraries
df9fd4d
License:        MIT
138fc20
URL:            https://github.com/brunoos/luasec
138fc20
Source0:        https://github.com/brunoos/luasec/archive/%{shortcommit}.tar.gz
4bfa664
Patch0:         lua-sec-0.4.1-no_ecdh.patch
4bfa664
Patch1:         lua-sec-0.4.1-fix-Makefile.patch
df9fd4d
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
df9fd4d
df9fd4d
BuildRequires:  lua-devel
4bfa664
BuildRequires:  lua-socket-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
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
df9fd4d
df9fd4d
%prep
138fc20
%setup -q -n %{real_name}-%{github_commit}
4bfa664
%patch0 -p1 -b .ecdh
4bfa664
%patch1 -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
df9fd4d
df9fd4d
%build
4bfa664
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{_includedir}" \
4bfa664
    LDFLAGS="-L%{_libdir}" EXTRA="" DEFS="" \
4bfa664
    linux
df9fd4d
df9fd4d
df9fd4d
%install
df9fd4d
rm -rf $RPM_BUILD_ROOT
df9fd4d
mkdir -p $RPM_BUILD_ROOT%{luapkgdir}
df9fd4d
mkdir -p $RPM_BUILD_ROOT%{lualibdir}
4bfa664
make install DESTDIR=$RPM_BUILD_ROOT \
4bfa664
    CFLAGS="$RPM_OPT_FLAGS -fPIC -I%{_includedir}" \
4bfa664
    EXTRA="" DEFS="" LDFLAGS="-L%{_libdir}" \
4bfa664
    LUAPATH=$RPM_BUILD_ROOT%{luapkgdir} \
4bfa664
    LUACPATH=$RPM_BUILD_ROOT%{lualibdir}
df9fd4d
df9fd4d
df9fd4d
%clean
df9fd4d
rm -rf $RPM_BUILD_ROOT
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
df9fd4d
df9fd4d
%changelog
4bfa664
* Mon Sep 09 2013 Matěj Cepl <mcepl@redhat.com> - 0.4.1-6.0.3.20130824R063e8a8
4bfa664
- Rebuilt for new lua-socket (#985573, #1000622)
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