%{!?_licensedir:%global license %%doc} %{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))")} %global lualibdir %{_libdir}/lua/%{luaver} %global luapkgdir %{_datadir}/lua/%{luaver} %global commit 24f6dbd8584a1da9b2a338a245f1a7f8dd2bc16e %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global pkg_name luaprompt # Disabling debuginfo - only binary object is a shared library %global _enable_debug_package 0 %global debug_package %{nil} %global __os_install_post /usr/lib/rpm/brp-compress %{nil} %global build_defines -DHAVE_LIBREADLINE -DHAVE_READLINE_HISTORY -DHAVE_IOCTL -DCOMPLETE_KEYWORDS -DCOMPLETE_TABLE_KEYS -DCOMPLETE_FILE_NAMES -DCOMPLETE_MODULES -DSAVE_RESULTS -DRESULTS_TABLE_NAME=\\"_\\" # Proper naming for the tarball from github. %global gittar %{name}-%{version}.tar.gz Name: lua-%{pkg_name} Version: 0.6 Release: 1%{?dist} Summary: A Lua command prompt with pretty-printing and autocompletion License: MIT URL: https://github.com/dpapavas/%{pkg_name} Source0: %{url}/archive/%{commit}/%{gittar} # Submitted to upstream Patch1: lua-luaprompt-0.6-license.patch # Submitted to upstream Patch2: lua-luaprompt-0.6-manpage.patch BuildRequires: lua-devel >= %{luaver} BuildRequires: readline-devel %if 0%{?fedora} Requires: lua(abi) = %{luaver} %else Requires: lua >= %{luaver} %endif Requires: lua-argparse %description luaprompt is both an interactive Lua prompt that can be used instead of the official interpreter, as well as a module that provides a Lua command prompt that can be embedded in a host application. As a standalone interpreter it provides many conveniences that are missing from the official Lua interpreter. As an embedded prompt, it is meant for applications that use Lua as a configuration or interface language and can therefore benefit from an interactive prompt for debugging or regular use. %prep %setup -qn %{pkg_name}-%{commit} %patch1 -p 1 %patch2 -p 1 %build %{__cc} %{optflags} -fPIC -c -c prompt.c -o prompt.o %{build_defines} %{__cc} %{optflags} -fPIC -c -c module.c -o module.o %{build_defines} %{__cc} -shared %{__global_ldflags} -o prompt.so prompt.o module.o -lreadline -lhistory chmod 755 prompt.so %install install -D -p luap.lua %{buildroot}%{_bindir}/luap install -D -p prompt.so %{buildroot}%{lualibdir}/prompt.so install -m 644 -D -p luap.1 %{buildroot}%{_mandir}/man1/luap.1 %files %license LICENSE %doc README %{lualibdir}/prompt.so %{_bindir}/luap %{_mandir}/man1/* %changelog * Wed Jul 22 2015 Jeff Backus - 0.6-1 - Initial release