SHA256
1
0
forked from pool/lua-toluapp
lua-toluapp/lua51-toluapp.spec

167 lines
5.1 KiB
RPMSpec
Raw Normal View History

#
# spec file for package lua51-toluapp
#
# Copyright (c) 2017 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 lua_major_version 5.1
%define lua_suffix 5_1
Name: lua51-toluapp
Version: 1.0.93
Release: 0
Summary: C/C++ with Lua Integration Tool
License: MIT
Group: Development/Languages/Lua
Url: https://github.com/LuaDist/toluapp
Source: https://github.com/LuaDist/toluapp/archive/%{version}/toluapp-%{version}.tar.gz
Patch: toluapp-libdir.patch
Patch1: toluapp-versioned-shared-lib.patch
Patch2: toluapp-build-compare.patch
BuildRequires: gcc-c++
BuildRequires: lua51-devel
BuildRequires: pkg-config
BuildRequires: scons >= 2.3.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
tolua++ is an extended version of tolua, a tool to integrate C/C++ code with
Lua. tolua++ includes new features oriented to c++ such as:
* support for std::string as a basic type (this can be turned off by a command
line option)
* support for class templates
as well as other features and bugfixes.
%package -n toluapp-%{lua_major_version}
Summary: C/C++ with Lua Integration Tool
Group: Development/Languages/Lua
Requires(preun): update-alternatives
Requires(post): update-alternatives
# 99.1: just make sure it's big enough
Provides: tolua++ = %{version}-99.1
Obsoletes: tolua++ < %{version}-99.1
%description -n toluapp-%{lua_major_version}
tolua++ is an extended version of tolua, a tool to integrate C/C++ code with
Lua. tolua++ includes new features oriented to c++ such as:
* support for std::string as a basic type (this can be turned off by a command
line option)
* support for class templates
as well as other features and bugfixes.
%package -n libtolua++-%{lua_suffix}-1
Summary: Runtime libraries for tolua++
Group: System/Libraries
%description -n libtolua++-%{lua_suffix}-1
This package provides shared libraries for tolua++.
%package -n libtolua++-%{lua_suffix}-devel
Summary: Development headers for tolua++
Group: Development/Libraries/C and C++
Requires: toluapp-%{lua_major_version}
%description -n libtolua++-%{lua_suffix}-devel
This package provides development headers for tolua++.
%prep
%setup -q -n toluapp-%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
sed -i "s/@SUFFIX@/%{lua_major_version}/" SConstruct
%build
cat <<'EOF' > config_linux.py
import re,os
CCFLAGS = re.split(r"\s+", os.environ['CCFLAGS'])
LIBS = re.split(r"\s+", os.environ['LIBS'])
prefix = "%{_prefix}"
EOF
CCFLAGS="%{optflags} -fPIC -I%{lua_incdir}" \
LIBS="-llua -lm -ldl" \
scons %{?_smp_mflags} \
prefix="%{_prefix}" \
libdir="%{_libdir}" \
shared=1 \
lib bin
%install
CCFLAGS="%{optflags} -fPIC -I%{lua_incdir}" \
LIBS="-llua -lm -ldl" \
scons %{?_smp_flags} \
prefix="%{buildroot}%{_prefix}" \
libdir="%{buildroot}%{_libdir}" \
shared=1 \
install
# pkgconfig file
mkdir -p %{buildroot}%{_libdir}/pkgconfig
cat > %{buildroot}%{_libdir}/pkgconfig/tolua++.pc << EOF
prefix=%{_prefix}
exec_prefix=%{_prefix}
libdir=%{_libdir}
sharedlibdir=%{_libdir}
includedir=%{_includedir}
Name: tolua++
Description: C/C++ with Lua Integration Tool
Version: %{version}
Libs: -ltolua++-%{lua_major_version}
Cflags: -I%{_includedir}
EOF
# update-alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/tolua++
ln -sf %{_sysconfdir}/alternatives/tolua++ %{buildroot}%{_bindir}/tolua++
%post -n libtolua++-%{lua_suffix}-1 -p /sbin/ldconfig
%postun -n libtolua++-%{lua_suffix}-1 -p /sbin/ldconfig
%post -n toluapp-%{lua_major_version}
/sbin/ldconfig
%{_sbindir}/update-alternatives --install %{_bindir}/tolua++ tolua++ %{_bindir}/toluapp-%{lua_major_version} 10
%preun -n toluapp-%{lua_major_version}
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove tolua++ %{_bindir}/toluapp-%{lua_major_version}
fi
%postun -n toluapp-%{lua_major_version} -p /sbin/ldconfig
%files -n toluapp-%{lua_major_version}
%defattr(-,root,root)
%doc COPYRIGHT README
%ghost %{_sysconfdir}/alternatives/tolua++
%{_bindir}/tolua++
%{_bindir}/toluapp-%{lua_major_version}
%files -n libtolua++-%{lua_suffix}-devel
%defattr(-,root,root)
%{_includedir}/tolua++.h
%{_libdir}/libtolua++-%{lua_major_version}.so
%{_libdir}/pkgconfig/tolua++.pc
%files -n libtolua++-%{lua_suffix}-1
%defattr(-,root,root)
%{_libdir}/libtolua++-%{lua_major_version}.so.1
%{_libdir}/libtolua++-%{lua_major_version}.so.%{version}
%changelog