File luajit.spec of Package luajit
%define realname LuaJIT
%define gen 2.1
%define srcext tar.xz
%define so_ver 2
%define abi_ver_pkg 5_1
%define abi_ver_lib 5.1
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: luajit
Version: 2.1
Release: %{?extraver:0.}1%{?dist}
License: MIT
Group: Development/Languages/Other
URL: http://luajit.org/
Summary: Just-In-Time Compiler (JIT) for the Lua programming language
# Build-time parameters
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-root
Source: %{realname}-%{version}%{?extraver}.%{srcext}
%description
LuaJIT is a just-in-time (JIT) compiler for the Lua language. The virtual
machine (VM) is based on a fast interpreter combined with a trace compiler.
It can significantly improve the performance of Lua programs.
LuaJIT is API- and ABI-compatible with the VM of the standard Lua 5.1
interpreter. When embedding the VM into an application, the built library can be
used as a drop-in replacement.
# Create subpackage with new name
%package -n lib%{name}-%{abi_ver_pkg}-%{so_ver}
Group: System/Libraries
Summary: Shared library for %{name}
Provides: lib%{name} = %{version}
%description -n lib%{name}-%{abi_ver_pkg}-%{so_ver}
Shared library for %{name}
LuaJIT is a just-in-time (JIT) compiler for the Lua language. The virtual
machine (VM) is based on a fast interpreter combined with a trace compiler.
It can significantly improve the performance of Lua programs.
LuaJIT is API- and ABI-compatible with the VM of the standard Lua 5.1
interpreter. When embedding the VM into an application, the built library can be
used as a drop-in replacement.
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: lib%{name}-%{abi_ver_pkg}-%{so_ver} = %{version}
Provides: lib%{name}-devel = %{version}
%description devel
Development files for %{name}
LuaJIT is a just-in-time (JIT) compiler for the Lua language. The virtual
machine (VM) is based on a fast interpreter combined with a trace compiler.
It can significantly improve the performance of Lua programs.
LuaJIT is API- and ABI-compatible with the VM of the standard Lua 5.1
interpreter. When embedding the VM into an application, the built library can be
used as a drop-in replacement.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%{__make} %{?_smp_mflags} \
PREFIX=%{_prefix} \
MULTILIB=%{_lib} \
BUILDMODE=dynamic \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%install
%{__make} install DESTDIR=%{buildroot} \
PREFIX=%{_prefix} \
MULTILIB=%{_lib}
for man in %{buildroot}%{_mandir}/man1/*; do
%{__ln_s} ${man##*/} ${man%.1*}-%{version}.1
done
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYRIGHT
%doc README
%{_bindir}/%{name}
%{_bindir}/%{name}-%{gen}*
%doc %{_mandir}/man1/*
%files -n lib%{name}-%{abi_ver_pkg}-%{so_ver}
%defattr(-,root,root)
%license COPYRIGHT
%doc README
%{_libdir}/lib%{name}-%{abi_ver_lib}.so.*
%dir %{_libdir}/lua/%{abi_ver_lib}
%dir %{_libdir}/lua
%dir %{_datadir}/lua/%{abi_ver_lib}
%dir %{_datadir}/lua
%dir %{_datadir}/%{name}-%{gen}/jit
%dir %{_datadir}/%{name}-%{gen}
%{_datadir}/%{name}-%{gen}/jit/*.lua
# Development stuff
%files devel
%defattr(-,root,root)
%license COPYRIGHT
%doc README doc/*
%{_libdir}/pkgconfig/%{name}.pc
%dir %{_includedir}/%{name}-%{gen}
%{_includedir}/%{name}-%{gen}/*.h
%{_includedir}/%{name}-%{gen}/*.hpp
%{_libdir}/lib%{name}-%{abi_ver_lib}.so
%post -n lib%{name}-%{abi_ver_pkg}-%{so_ver} -p /sbin/ldconfig
%postun -n lib%{name}-%{abi_ver_pkg}-%{so_ver} -p /sbin/ldconfig
%changelog