File luajit.spec of Package luajit

#
# spec file for package luajit
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


%define libname libluajit-5_1-2
Name:           luajit
Version:        2.0.4
Release:        0
Summary:        JIT compiler for Lua language
License:        MIT
Group:          Development/Libraries
Url:            http://www.luajit.com/
Source:         http://luajit.org/download/LuaJIT-%{version}.tar.gz
BuildRequires:  pkg-config
Requires:       %{libname} = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# lj_arch.h do not support ppc64/ppc64le
ExcludeArch:    ppc64 ppc64le

%description
A Just-In-Time Compiler for Lua language

%package -n %{libname}
Summary:        Library for JIT Lua compiler
Group:          Development/Libraries

%description -n %{libname}
Libraries to use JIT Lua compiler

%package devel
Summary:        Devel files for %{name}
Group:          Development/Languages/Other
Requires:       %{libname} = %{version}
Requires:       %{name} = %{version}

%description devel
Devel files for luajit package

%prep
%setup -q -n LuaJIT-%{version}

# Fix variables
sed -i "s,PREFIX= %{_prefix}/local,PREFIX= %{_prefix}," Makefile
sed -i "s,%{_libexecdir},%{_libdir}," etc/luajit.pc

%build
CFLAGS="%{optflags}" \
make %{?_smp_mflags} \
	Q= \
	DYNAMIC_CC="cc -fPIC" \
	LDCONFIG="true" \
	TARGET_AR="ar rcus"

%install
make DESTDIR=%{buildroot} install \
	INSTALL_LIB="%{buildroot}/%{_libdir}" \
	DYNAMIC_CC="cc -fPIC" \
	LDCONFIG="true" \
	TARGET_AR="ar rcus"
# remove static lib, not needed
rm %{buildroot}/%{_libdir}/*.a

%post -n %{libname} -p /sbin/ldconfig

%postun -n %{libname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_bindir}/%{name}-%{version}
%{_mandir}/man1/%{name}*
%dir %{_datadir}/%{name}-%{version}/
%{_datadir}/%{name}-%{version}/*

%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%dir %{_includedir}/%{name}-2.0/
%{_includedir}/%{name}-2.0/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc

%changelog
openSUSE Build Service is sponsored by