%global real_name lua %global package_version 54 %global major_version 5.4 # Normally, this is the same as version, but... not always. %global test_version 5.4.8 # If you are incrementing major_version, enable bootstrapping and adjust accordingly. # Version should be the latest prior build. If you don't do this, RPM will break and # everything will grind to a halt. %global bootstrap 0 %global bootstrap_major_version 5.3 %global bootstrap_version %{bootstrap_major_version}.6 # Place rpm-macros into proper location. %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: lua%{package_version} Version: %{major_version}.8 Release: 1%{?dist} Summary: Powerful light-weight programming language License: MIT URL: https://www.lua.org/ Source0: https://www.lua.org/ftp/lua-%{version}.tar.gz # copied from doc/readme.html on 2014-07-18 Source1: mit.txt %if 0%{?bootstrap} Source2: https://www.lua.org/ftp/lua-%{bootstrap_version}.tar.gz %endif Source3: https://www.lua.org/tests/lua-%{test_version}-tests.tar.gz # multilib Source4: luaconf.h Patch0: %{real_name}-5.4.0-beta-autotoolize.patch Patch1: %{real_name}-5.4.6-idsize.patch Patch3: %{real_name}-5.2.2-configure-linux.patch Patch4: %{real_name}-5.3.0-configure-compat-module.patch %if 0%{?bootstrap} Patch5: %{real_name}-5.3.0-autotoolize.patch Patch6: %{real_name}-5.3.5-luac-shared-link-fix.patch %endif # https://www.lua.org/bugs.html BuildRequires: automake autoconf libtool readline-devel ncurses-devel BuildRequires: make Requires: %{name}-libs = %{version}-%{release} %description Lua is a powerful light-weight programming language designed for extending applications. Lua is also frequently used as a general-purpose, stand-alone language. Lua is free software. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from bytecodes, and has automatic memory management with garbage collection, making it ideal for configuration, scripting, and rapid prototyping. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} # The RPM related dependencies bring nothing to a non-RPM Lua developer # But we want them when packages BuildRequire lua-devel Requires: pkgconfig %description devel This package contains development files for %{name}. %package libs Summary: Libraries for %{name} Provides: lua(abi) = %{major_version} %description libs This package contains the shared libraries for %{name}. %package static Summary: Static library for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description static This package contains the static version of liblua for %{name}. %prep %if 0%{?bootstrap} %setup -q -a 2 -a 3 -n %{real_name}-%{version} %else %setup -q -a 3 -n %{real_name}-%{version} %endif cp %{SOURCE1} . mv src/luaconf.h src/luaconf.h.template.in %patch -P0 -p1 -E -z .autoxxx %patch -P1 -p1 -z .idsize #%% patch -P2 -p1 -z .luac-shared %patch -P3 -p1 -z .configure-linux # Put proper version in configure.ac, patch0 hardcodes 5.3.0 sed -i 's|5.3.0|%{version}|g' configure.ac autoreconf -ifv %if 0%{?bootstrap} cd lua-%{bootstrap_version}/ mv src/luaconf.h src/luaconf.h.template.in %patch -P5 -p1 -b .autoxxx %patch -P1 -p1 -b .idsize %patch -P3 -p1 -z .configure-linux %patch -P4 -p1 -z .configure-compat-all %patch -P6 -p1 -b .luac-shared-link-fix autoreconf -i cd .. %endif %build %configure --with-readline --with-compat-module sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool # Autotools give me a headache sometimes. sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template # hack so that only /usr/bin/lua gets linked with readline as it is the # only one which needs this and otherwise we get License troubles %make_build LIBS="-lm -ldl" # only /usr/bin/lua links with readline now #luac_LDADD="liblua.la -lm -ldl" %if 0%{?bootstrap} pushd lua-%{bootstrap_version} %configure --with-readline --with-compat-module sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool # Autotools give me a headache sometimes. sed -i 's|@pkgdatadir@|%{_datadir}|g' src/luaconf.h.template # hack so that only /usr/bin/lua gets linked with readline as it is the # only one which needs this and otherwise we get License troubles %make_build LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl" popd %endif %check cd ./lua-%{test_version}-tests/ # Dont skip the fully portable or ram-hungry tests: # sed -i.orig -e ' # /attrib.lua/d; # /files.lua/d; # /db.lua/d; # /errors.lua/d; # ' all.lua # LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} $RPM_BUILD_ROOT/%{_bindir}/lua all.lua # Removing tests that fail under mock/koji sed -i.orig -e ' /db.lua/d; /errors.lua/d; ' all.lua LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} $RPM_BUILD_ROOT/%{_bindir}/lua%{package_version} -e"_U=true" all.lua %install %make_install rm $RPM_BUILD_ROOT%{_libdir}/*.la mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{major_version} mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{major_version} # Rename luaconf.h to luaconf-.h to avoid file conflicts on # multilib systems and install luaconf.h wrapper mv %{buildroot}%{_includedir}/luaconf.h %{buildroot}%{_includedir}/luaconf-%{_arch}.h install -p -m 644 %{SOURCE4} %{buildroot}%{_includedir}/luaconf.h %if 0%{?bootstrap} pushd lua-%{bootstrap_version} mkdir $RPM_BUILD_ROOT/installdir make install DESTDIR=$RPM_BUILD_ROOT/installdir cp -a $RPM_BUILD_ROOT/installdir/%{_libdir}/liblua-%{bootstrap_major_version}.so $RPM_BUILD_ROOT%{_libdir}/ mkdir -p $RPM_BUILD_ROOT%{_libdir}/lua/%{bootstrap_major_version} mkdir -p $RPM_BUILD_ROOT%{_datadir}/lua/%{bootstrap_major_version} rm -rf $RPM_BUILD_ROOT/installdir popd %endif mv %{buildroot}%{_bindir}/lua %{buildroot}%{_bindir}/lua%{package_version} mv %{buildroot}%{_bindir}/luac %{buildroot}%{_bindir}/luac%{package_version} mv %{buildroot}%{_libdir}/liblua.so %{buildroot}%{_libdir}/liblua%{package_version}.so mv %{buildroot}%{_mandir}/man1/lua.1 %{buildroot}%{_mandir}/man1/lua%{package_version}.1 mv %{buildroot}%{_mandir}/man1/luac.1 %{buildroot}%{_mandir}/man1/luac%{package_version}.1 %files %{!?_licensedir:%global license %%doc} %license mit.txt %doc README doc/*.html doc/*.css doc/*.gif doc/*.png %{_bindir}/lua%{package_version} %{_bindir}/luac%{package_version} %{_mandir}/man1/lua*.1* %files libs %dir %{_libdir}/lua %dir %{_libdir}/lua/%{major_version} %{_libdir}/liblua-%{major_version}.so %dir %{_datadir}/lua %dir %{_datadir}/lua/%{major_version} %if 0%{?bootstrap} %dir %{_libdir}/lua/%{bootstrap_major_version} %{_libdir}/liblua-%{bootstrap_major_version}.so %dir %{_datadir}/lua/%{bootstrap_major_version} %endif %files devel %{_includedir}/l*.h %{_includedir}/l*.hpp %{_libdir}/liblua%{package_version}.so %{_libdir}/pkgconfig/*.pc %files static %{_libdir}/*.a %changelog