commit 7229977: [Minor] More flexibility fixes for the spec file

Vsevolod Stakhov vsevolod at rspamd.com
Wed Feb 8 14:49:03 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-02-08 14:47:48 +0000
URL: https://github.com/rspamd/rspamd/commit/72299772072c0ad4d0881f0c0ac5ae460ab3302e (HEAD -> master)

[Minor] More flexibility fixes for the spec file

---
 rpm/rspamd.spec | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/rpm/rspamd.spec b/rpm/rspamd.spec
index ff2656725..8adad69a3 100644
--- a/rpm/rspamd.spec
+++ b/rpm/rspamd.spec
@@ -26,7 +26,9 @@ BuildRequires:    libunwind-devel
 %ifarch x86_64 amd64
 BuildRequires:    hyperscan-devel
 BuildRequires:    jemalloc-devel
-BuildRequires:    luajit-devel
+%endif
+%if 0%{getenv:LUAJIT}
+BuildRequires:    git
 %else
 BuildRequires:    lua-devel
 %endif
@@ -51,13 +53,23 @@ lua.
 
 %prep
 %setup -q -n rspamd-%{version}
+%if 0%{getenv:LUAJIT}
+rm -fr %{_builddir}/luajit-src || true
+rm -fr %{_builddir}/luajit-build || true
+git clone -b v2.1 https://luajit.org/git/luajit-2.0.git %{_builddir}/luajit-src
+%endif
 
 %build
+%if 0%{getenv:LUAJIT}
+pushd %{_builddir}/luajit-src && make clean && make %{?_smp_mflags} CC="gcc -fPIC" PREFIX=%{_builddir}/luajit-build && make install PREFIX=%{_builddir}/luajit-build ; popd
+rm -f %{_builddir}/luajit-build/lib/*.so || true
+%endif
 %if 0%{?el7}
-%{__cmake3} \
+%{cmake3} \
 %else
-%{__cmake} \
+%{cmake} \
 %endif
+	-B . \
         -DCMAKE_BUILD_TYPE=RelWithDebInfo \
         -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
         -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
@@ -87,14 +99,16 @@ lua.
 %endif
 %ifarch x86_64 amd64
         -DENABLE_JEMALLOC=ON \
+%endif
+%if 0%{getenv:LUAJIT}
         -DENABLE_LUAJIT=ON \
+	-DLUA_ROOT=%{_builddir}/luajit-build \
 %endif
         -DENABLE_BLAS=ON
-
-%{__make} %{?_smp_mflags}
+make %{?_smp_mflags}
 
 %install
-%{__make} install DESTDIR=%{buildroot} INSTALLDIRS=vendor
+%make_install
 %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
 %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_presetdir}/80-rspamd.preset
 %{__install} -d -p -m 0755 %{buildroot}%{_localstatedir}/log/rspamd


More information about the Commits mailing list