File luafilesystem.spec of Package luafilesystem

#
# spec file for package luafilesystem
# Copyright (c) 2009 florian.leparoux@gmail.com
# Copyright (c) 2012 Togan Muftuoglu toganm@opensuse.org
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           luafilesystem
Version:        1.5.0
Release:        0
License:        MIT
Summary:        Lua library to Access Directories and FIles
Url:            http://keplerproject.github.com/luafilesystem
Group:          Productivity/Networking/Other
Source:         https://github.com/downloads/keplerproject/luafilesystem/%{name}-%{version}.tar.gz
# PATCH-FIX_UPSTREAM -- toganm@opensuse.org provide optflags for config
Patch1:         luafilesystem-optflags.patch
# PATCH-FIX-UPSTREAM -- toganm@opensuse.org fixes Makefile for DESTDIR
Patch2:         luafilesystem-1.5.0-destdir.patch
%if 0%{?suse_version} > 1210
BuildRequires:  lua51-devel
%else
BuildRequires:  lua-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
LuaFileSystem is a Lua library developed to complement the set of functions
related to file systems offered by the standard Lua distribution.
LuaFileSystem offers a portable way to access the underlying directory
structure and file attributes.

%prep
%setup -q
%patch1
%patch2 -p1

sed -i 's|@@LIBDIR@@|%{_libdir}|g;s|@@INCLUDEDIR@@|%{_includedir}|g;' $(perl -ne 'print $1,"\n" if /^\+{3}\s+(.+?)\s+/' "%{PATCH1}")

%build

make %{?_smp_mflags} \
    PREFIX=%{_prefix} \
    LUA_LIBDIR=%{_libdir}/lua/5.1 \
    CFLAGS="%{optflags} -fPIC"

%install
%make_install \
    DESTDIR=%buildroot \
    PREFIX="%{_prefix}" \
    LUA_LIBDIR="%{_libdir}/lua/5.1"


%files
%defattr(-,root,root)
%{_libdir}/lua/5.1/lfs.so
%if %sles_version >=11
%{_libdir}/lua
%{_libdir}/lua/5.1
%endif
%changelog
openSUSE Build Service is sponsored by