forked from jengelh/xxhash
fix usage of DISPATCH=1
- upstream will activate optimization only with -O3 but %{optflags} set -O2, we patch optflags to use -O3 - DISPATCH=1 seem to be needed on make / make install line call to obtain an optimized binary, and also get dispatch header installed in include Signed-off-by: Bruno Friedmann <bruno@ioda-net.ch>
This commit is contained in:
parent
679f82e202
commit
6fbc273ac8
21
xxhash.spec
21
xxhash.spec
@ -59,30 +59,32 @@ Headers and other development files for xxHash.
|
||||
%autosetup -p1 -n xxHash-%{version}
|
||||
|
||||
%build
|
||||
# upstream make -O3 mandatory to get performance gain
|
||||
tmpflags="$(echo %{optflags} | sed 's,-O2,-O3,g')"
|
||||
# ALLOW_AVX just means "we guarantee we policed our %%optflags".
|
||||
export CFLAGS="%{optflags} -DXXH_X86DISPATCH_ALLOW_AVX=1"
|
||||
export CXXFLAGS="$CFLAGS"
|
||||
export CFLAGS="${tmpflags} -DXXH_X86DISPATCH_ALLOW_AVX=1"
|
||||
export CXXFLAGS="${CFLAGS}"
|
||||
export LDFLAGS="%{?build_ldflags}"
|
||||
# DISPATCH=1 if you want AVX2/AVX512. But it does not seem to perform any
|
||||
# better than the lowest-denomimation code on at least the 1135G7 and 5950X
|
||||
# CPUs, and for both LP64 as well as ILP32 — it seems to be all within margin
|
||||
# of error.
|
||||
%make_build prefix=%{_prefix} libdir=%{_libdir}
|
||||
%make_build prefix=%{_prefix} libdir=%{_libdir} DISPATCH=1
|
||||
|
||||
%install
|
||||
export CFLAGS="%{optflags} -DXXH_X86DISPATCH_ALLOW_AVX=1"
|
||||
export CXXFLAGS="%{optflags}"
|
||||
export CFLAGS="${tmpflags} -DXXH_X86DISPATCH_ALLOW_AVX=1"
|
||||
export CXXFLAGS="${CFLAGS}"
|
||||
export LDFLAGS="%{?build_ldflags}"
|
||||
%make_install prefix=%{_prefix} libdir=%{_libdir}
|
||||
%make_install prefix=%{_prefix} libdir=%{_libdir} DISPATCH=1
|
||||
rm -rf %{buildroot}%{_libdir}/libxxhash.a
|
||||
|
||||
%check
|
||||
export CFLAGS="%{optflags}"
|
||||
export CXXFLAGS="%{optflags}"
|
||||
export CFLAGS="${tmpflags}"
|
||||
export CXXFLAGS="${CFLAGS}"
|
||||
export LDFLAGS="%{?build_ldflags}"
|
||||
# not safe for parallel execution as it removes xxhash.o and recreates it with different flags
|
||||
# the list is taken from test-all with non-working/irrelevant ones (such as ones that change the toolchain) removed
|
||||
%make_build -j1 test test-unicode listL120 trailingWhitespace test-xxh-nnn-sums
|
||||
%make_build -j1 DISPATCH=1 test test-unicode listL120 trailingWhitespace test-xxh-nnn-sums
|
||||
|
||||
%ldconfig_scriptlets -n libxxhash0
|
||||
|
||||
@ -104,6 +106,7 @@ export LDFLAGS="%{?build_ldflags}"
|
||||
%files devel
|
||||
%{_includedir}/xxhash.h
|
||||
%{_includedir}/xxh3.h
|
||||
%{_includedir}/xxh_x86dispatch.h
|
||||
%{_libdir}/pkgconfig/libxxhash.pc
|
||||
%{_libdir}/libxxhash.so
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user