CONFIG_asan = -DCMAKE_BUILD_TYPE=Debug -DSANITIZE=address -DENABLE_LTO=OFF -DENABLE_FULL_DEBUG=ON
CONFIG_release = -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LTO=ON
-ENABLE_LUAJIT := -DENABLE_LUAJIT=OFF
+ENABLE_LUAJIT := -DENABLE_LUAJIT=ON -DLUA_ROOT=/luajit-build
# Can be filled by a build system
EXTRA_ARGS :=
%endif
%endif
+%if 0%{getenv:LUAJIT}
+BuildRequires: git
+%else
BuildRequires: lua-devel
+%endif
BuildRequires: openblas-devel
BuildRequires: openssl-devel
BuildRequires: pcre2-devel
%prep
%setup -q -n %{name}-%{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%{?el7}
source /usr/lib/gcc-toolset/15-env.source
%endif
-
+%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} \
%else
-DENABLE_JEMALLOC=ON \
%endif
%endif
- -DENABLE_LUAJIT=OFF \
- -DENABLE_FASTTEXT=ON \
+%if 0%{getenv:LUAJIT}
+ -DENABLE_LUAJIT=ON \
+ -DLUA_ROOT=%{_builddir}/luajit-build \
+%else
+ -DENABLE_LUAJIT=OFF \
+%endif
+ -DENABLE_FASTTEXT=ON \
-DFASTTEXT_ROOT_DIR=/fasttext \
-DENABLE_BLAS=ON
make %{?_smp_mflags}