# # spec file for package lua51 # # Copyright (c) 2015 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 major_version 5.1 %define lib_suffix 5_1 Name: lua51 Version: 5.1.5 Release: 0 Summary: Small Embeddable Language with Simple Procedural Syntax License: MIT Group: Development/Languages/Lua Url: http://www.lua.org Source: http://www.lua.org/ftp/lua-%{version}.tar.gz Source1: macros.lua Source2: baselibs.conf Patch0: %{name}-%{version}-shared.diff Patch1: %{name}-%{version}-module-path.diff Patch3: %{name}-%{version}-libdir.diff Patch4: %{name}-%{version}-pkgconfig.patch BuildRequires: pkg-config BuildRequires: readline-devel Requires(post): update-alternatives Requires(preun): update-alternatives Provides: Lua(API) = %{major_version} BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Lua is a programming language originally designed for extending applications, but also frequently used as a general-purpose, stand-alone language. Lua combines simple procedural syntax (similar to Pascal) with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from byte codes, and has automatic memory management, making it ideal for configuration, scripting, and rapid prototyping. Lua is implemented as a small library of C functions, written in ANSI C, and the implementation goals are simplicity, efficiency, portability, and low embedding cost. %package devel Summary: Development files for lua Group: Development/Libraries/C and C++ Requires: %{name} = %{version} Requires: liblua%{lib_suffix} = %{version} Provides: Lua(devel) = %{major_version} Obsoletes: otherproviders(Lua(devel)) %description devel Lua is a programming language originally designed for extending applications, but also frequently used as a general-purpose, stand-alone language. This package contains files needed for embedding lua into your application. %package -n liblua%{lib_suffix} Summary: The Lua integration library Group: System/Libraries Provides: %{name}-libs = %{version} Obsoletes: %{name}-libs <= %{version} %description -n liblua%{lib_suffix} Lua is a programming language originally designed for extending applications, but also frequently used as a general-purpose, stand-alone language. Lua combines simple procedural syntax (similar to Pascal) with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from byte codes, and has automatic memory management, making it ideal for configuration, scripting, and rapid prototyping. Lua is implemented as a small library of C functions, written in ANSI C, and the implementation goals are simplicity, efficiency, portability, and low embedding cost. %package doc Summary: Documentation for Lua, a small embeddable language Group: Documentation/HTML %if 0%{?suse_version} >= 1120 BuildArch: noarch %endif %description doc Lua is a programming language originally designed for extending applications, but also frequently used as a general-purpose, stand-alone language. Lua combines simple procedural syntax (similar to Pascal) with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from byte codes, and has automatic memory management, making it ideal for configuration, scripting, and rapid prototyping. Lua is implemented as a small library of C functions, written in ANSI C, and the implementation goals are simplicity, efficiency, portability, and low embedding cost. %prep %setup -q -n lua-%{version} %patch0 -b .shared %patch1 -p1 %patch3 -p1 %patch4 -p1 %build sed -i 's:LUA_ROOT2 "LIBDIR/lua/%{major_version}/":LUA_ROOT2 \"%{_lib}/lua/%{major_version}/":' src/luaconf.h make %{?_smp_mflags} -C src CC="gcc" MYCFLAGS="%{optflags} -fPIC -DLUA_USE_LINUX" MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" V=%{major_version} all %install make install INSTALL_TOP="%{buildroot}%{_prefix}" INSTALL_LIB="%{buildroot}%{_libdir}" INSTALL_CMOD=%{buildroot}%{_libdir}/lua/%{major_version} INSTALL_MAN="%{buildroot}%{_mandir}/man1" find %{buildroot} -name "*.a" -delete -print install -D -m644 etc/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua-%{major_version}.pc # update-alternatives mkdir -p %{buildroot}%{_sysconfdir}/alternatives for file in lua luac ; do mv "%{buildroot}%{_bindir}/${file}" "%{buildroot}%{_bindir}/${file}%{major_version}" touch "%{buildroot}%{_sysconfdir}/alternatives/${file}" ln -sf "%{_sysconfdir}/alternatives/${file}" "%{buildroot}%{_bindir}/${file}" mv "%{buildroot}%{_mandir}/man1/${file}.1" "%{buildroot}%{_mandir}/man1/${file}%{major_version}.1" touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1.gz" ln -sf "%{_sysconfdir}/alternatives/${file}.1.gz" "%{buildroot}%{_mandir}/man1/${file}.1.gz" done install -d -m 0755 %{buildroot}%{_libdir}/lua/%{major_version} install -d -m 0755 %{buildroot}%{_datadir}/lua/%{major_version} install -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.lua-%{major_version} # Debian/Ubuntu/SteamOS/Arch Linux compatibility ln -s %{_libdir}/liblua.so.%{major_version} %{buildroot}%{_libdir}/liblua%{major_version}.so.0 ln -s %{_libdir}/liblua.so %{buildroot}%{_libdir}/liblua5.1.so %post %{_sbindir}/update-alternatives --install \ %{_bindir}/lua lua %{_bindir}/lua%{major_version} 30 \ --slave %{_bindir}/luac luac %{_bindir}/luac%{major_version} \ --slave %{_mandir}/man1/lua.1.gz lua.1.gz %{_mandir}/man1/lua%{major_version}.1.gz \ --slave %{_mandir}/man1/luac.1.gz luac.1.gz %{_mandir}/man1/luac%{major_version}.1.gz %preun if [ "$1" = 0 ] ; then %{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version} fi %post -n liblua%{lib_suffix} -p /sbin/ldconfig %postun -n liblua%{lib_suffix} -p /sbin/ldconfig %files %defattr(-,root,root) %doc COPYRIGHT HISTORY README %{_bindir}/lua%{major_version} %{_bindir}/luac%{major_version} %{_mandir}/man1/lua%{major_version}.1.gz %{_mandir}/man1/luac%{major_version}.1.gz %{_bindir}/lua %{_bindir}/luac %{_mandir}/man1/lua.1.gz %{_mandir}/man1/luac.1.gz %ghost %{_sysconfdir}/alternatives/lua %ghost %{_sysconfdir}/alternatives/luac %ghost %{_sysconfdir}/alternatives/lua.1.gz %ghost %{_sysconfdir}/alternatives/luac.1.gz %dir %{_libdir}/lua %dir %{_libdir}/lua/%{major_version} %dir %{_datadir}/lua %dir %{_datadir}/lua/%{major_version} %files -n liblua%{lib_suffix} %defattr(-,root,root) %{_libdir}/liblua.so.%{major_version} %{_libdir}/liblua%{major_version}.so.0 %files devel %defattr(-,root,root) %{_sysconfdir}/rpm/macros.lua-%{major_version} %{_includedir}/lauxlib.h %{_includedir}/lua.h %{_includedir}/lua.hpp %{_includedir}/luaconf.h %{_includedir}/lualib.h %{_libdir}/pkgconfig/lua-%{major_version}.pc %{_libdir}/liblua.so %{_libdir}/liblua5.1.so %files doc %defattr(-,root,root) %doc doc/* %changelog