# Tests by default. No tests: rpm -ba --define 'dotests 0' *.spec %{!?dotests: %define dotests 1} %define _libdir64 %{_prefix}/lib64 %define _testsdir %{_libexecdir}/lutok/tests Summary: Lightweight C++ API library for Lua Name: lutok Version: 0.4 Release: 1 License: BSD License Group: Development/Languages URL: https://github.com/jmmv/lutok Source0:https://github.com/jmmv/lutok/releases/download/lutok-0.4/%{name}-%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: lua-devel >= 5.3.4 BuildRequires: libatf-c++-devel >= 0.21 Requires: lua >= 5.3.4 Requires: libgcc >= 8.3.0, libstdc++ >= 8.3.0 %description Lutok provides thin C++ wrappers around the Lua C API to ease the interaction between C++ and Lua. These wrappers make intensive use of RAII to prevent resource leakage, expose C++-friendly data types, report errors by means of exceptions and ensure that the Lua stack is always left untouched in the face of errors. The library also provides a small subset of miscellaneous utility functions built on top of the wrappers. Lutok focuses on providing a clean and safe C++ interface; the drawback is that it is not suitable for performance-critical environments. In order to implement error-safe C++ wrappers on top of a Lua C binary library, Lutok adds several layers or abstraction and error checking that go against the original spirit of the Lua C API and thus degrade performance. %package devel Summary: Libraries and header files for Lutok development Requires: %{name}%{?_isa} = %{version}-%{release} Requires: lua-devel >= 5.3.4 %description devel Provides the libraries and header files to develop applications that use the Lutok C++ API to Lua. %prep %setup -q -n %{name}-%{version} %build export CC="/opt/freeware/bin/gcc" export CXX__="/opt/freeware/bin/g++" # First build 64 bit export OBJECT_MODE=64 export CFLAGS="-O2 -maix64" export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib" export CXXFLAGS="$CFLAGS" export LUA_CFLAGS="-I/opt/freeware/include" export LUA_LIBS="-L/opt/freeware/lib64 -llua" ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir64} \ --docdir=%{_defaultdocdir}/lutok-doc-%{version} \ --disable-static \ --htmldir=%{_defaultdocdir}/lutok-doc-%{version}/html \ --without-doxygen \ --with-atf=auto gmake %{?_smp_mflags} VERBOSE=1 %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} # install on 64bit mode export OBJECT_MODE=64 gmake DESTDIR=${RPM_BUILD_ROOT} install %check # In order to enable this, we need to add a BuildRequires on kyua-cli. The # problem is that kyua-cli depends on lutok. Introducing a circular dependency # for this minor benefit does not seem like the best move. After all, we can # always install lutok-tests later and run the tests post-install. if [ "%{dotests}" == 1 ] then gmake -k check testsdir=%{_testsdir} fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc AUTHORS COPYING NEWS README %{_libdir64}/liblutok.a %files devel %defattr(-,root,system,-) %{_includedir}/lutok %{_libdir64}/pkgconfig/lutok.pc %changelog * Fri Apr 24 2020 Ashwini Chandrappa - 0.4 -1 - Initial build