%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))" || echo 0)} %global lualibdir %{_libdir}/lua/%{luaver} %global luacompatver 5.1 %global luacompatlibdir %{_libdir}/lua/%{luacompatver} %if 0%{fedora} # NOTE: for some reason, debugsourcefiles.list is empty when building on Fedora, # even though -g is present in CFLAGS %global debug_package %{nil} %endif Name: lua-bitop Version: 1.0.2 Release: 4%{?dist} Summary: C extension module for Lua which adds bitwise operations on numbers License: MIT URL: http://bitop.luajit.org/ Source0: http://bitop.luajit.org/download/LuaBitOp-%{version}.tar.gz BuildRequires: pkgconfig BuildRequires: gcc %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: compat-lua BuildRequires: compat-lua-devel %else BuildRequires: lua-devel >= %{luaver} %endif Requires: lua >= %{luaver} %description Lua BitOp is a C extension module for Lua 5.1/5.2 which adds bitwise operations on numbers. %if 0%{?fedora} || 0%{?rhel} > 7 %package -n compat-%{name} Summary: C extension module for Lua %{luacompatver} which adds bitwise operations on numbers Requires: lua(abi) = %{luacompatver} %description -n compat-%{name} Lua BitOp is a C extension module for Lua 5.1/5.2 which adds bitwise operations on numbers. %endif %prep %setup -q -n LuaBitOp-%{version} %build %if 0%{?fedora} || 0%{?rhel} > 7 LUALIB=lua-%{luacompatver} %else LUALIB=lua %endif CFLAGS="%{optflags} -fPIC $(pkg-config --cflags $LUALIB)" LDFLAGS="$(pkg-config --libs $LUALIB)" gcc $CFLAGS -c bit.c -o bit.o gcc -shared $LDFLAGS -o bit.so bit.o %install %if 0%{?fedora} || 0%{?rhel} > 7 install -Dm644 bit.so %{buildroot}%{luacompatlibdir}/bit.so %else install -Dm644 bit.so %{buildroot}%{lualibdir}/bit.so %endif %if 0%{?rhel} && 0%{?rhel} <= 7 %files %doc README %{lualibdir}/* %endif %if 0%{?fedora} || 0%{?rhel} > 7 %files -n compat-%{name} %doc README %{luacompatlibdir}/* %endif %changelog * Fri Apr 05 2019 Tomas Krizek - 1.0.2-4 - Bring the package to F28+ for compat-lua - Unify spec for Fedora and EPEL - Remove obsolete Group tag * Mon Aug 4 2014 - Orion Poplawski - 1.0.2-3 - Fix install location * Tue Jul 29 2014 - Orion Poplawski - 1.0.2-2 - Drop BuildRoot - Wrap description * Thu Jun 26 2014 - Orion Poplawski - 1.0.2-1 - Initial package