## START: Set by rpmautospec ## (rpmautospec version 0.8.4) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 5; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec %global srcname Stockfish # In src/evaluate.h, # #define EvalFileDefaultNameBig "nn-HASH.nnue" %global nnuehash1 c288c895ea92 # #define EvalFileDefaultNameSmall "nn-HASH.nnue" %global nnuehash2 37f18f62d772 Name: stockfish Version: 18 Release: %autorelease #Source0: %%{url}/files/%%{name}-%%{version}-linux.zip Source0: https://github.com/official-%{name}/%{srcname}/archive/sf_%{version}.zip Summary: Powerful open source chess engine # The entire source is GPL-3.0-or-later, except the NNUE network file (see # https://tests.stockfishchess.org/nns), which is CC0-1.0 and can be considered # content. License: GPL-3.0-or-later AND CC0-1.0 URL: http://%{name}chess.org # the NN files Source1: https://tests.stockfishchess.org/api/nn/nn-%nnuehash1.nnue Source2: https://tests.stockfishchess.org/api/nn/nn-%nnuehash2.nnue # steal some documentation from ubuntu Source10: https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/%{name}/vivid/download/head:/engineinterface.txt-20091204230329-yljoyxocuxhxg1ot-78/engine-interface.txt#/%{name}-interface.txt Source11: https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/%{name}/vivid/download/head:/%{name}.6-20091204230329-yljoyxocuxhxg1ot-76/%{name}.6 # polyglot support Source20: https://raw.githubusercontent.com/mpurland/%{name}/master/polyglot.ini#/%{name}-polyglot.ini ExcludeArch: %{ix86} BuildRequires: gcc-c++ BuildRequires: make #Suggests: polyglot-chess %description Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is not a complete chess program, but requires some UCI compatible GUI (like XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use Stockfish with your GUI. %prep # verify the NNUE net checksums early to catch maintainer error test %nnuehash1 = "$(sha256sum %{SOURCE1} | cut -c1-12)" test %nnuehash2 = "$(sha256sum %{SOURCE2} | cut -c1-12)" #%%autosetup -n%%{name}-%%{version}-linux %autosetup -p1 -n%{srcname}-sf_%{version} # Disable minimum GCC version check, as it only guards against # a bug that only affects Windows - see: # https://github.com/official-stockfish/Stockfish/issues/3216 # This is currently only required for EPEL8 build to pass. sed -i '/#error/d' src/types.h # Verify the NNUE net checksums match the defaults defined in the sources grep -Fq '#define EvalFileDefaultNameBig "nn-%{nnuehash1}.nnue"' src/evaluate.h grep -Fq '#define EvalFileDefaultNameSmall "nn-%{nnuehash2}.nnue"' src/evaluate.h cp -t. -p %{SOURCE10} %{SOURCE11} cp -tsrc -p %{SOURCE1} %{SOURCE2} # W: wrong-file-end-of-line-encoding sed -i 's,\r$,,' %{name}-interface.txt # polyglot of installed binary and disable log sed -e 's,\(EngineDir = \).*,\1%{_bindir},' \ -e 's,\(EngineCommand = \).*,\1%{name},' \ -e 's,\(LogFile = \).*,\1~/,' -e 's,\(LogFile = \).*,\1false,' \ %{SOURCE20} >polyglot.ini %build # This is needed on EPEL9 and older. On Fedora, it happens automatically (and # the explicit macro invocation has no further effect). %set_build_flags # Conditionals based on x86_64 microarchitecture levels provide a bit of # future-proofing and a convenient place to write explanatory comments. They # also have the benefit of improving compatibility with some downstreams; # https://github.com/AlmaLinux/ALESCo/pull/2#issuecomment-2637811851 and the # following discussion. # # As of this writing, EPELs do not yet set the RPM architecture to anything # other than x86_64, although Fedora and/or EPEL might change this in the # future. (For now, Fedora’s baseline *is* x86_64.) %ifarch x86_64_v4 # Requires AVX512F and AVX512BW. %global sfarch x86-64-avx512 %endif # Requires PEXT, which we believe to be present in some form on all hardware # that supports BMI2 (which is part of x86_64-v3). On some machines # (particularly CPUs using the Zen 2 architecture) PEXT is microcode, and this # implementation is not as fast as expected, but this is still probably a good # compromise for x86_64-v3 overall. %ifarch x86_64_v3 %global sfarch x86-64-bmi2 %endif %ifarch x86_64 %if 0%{?rhel} >= 10 # x86_64-v3 baseline, even if the RPM architecture is just x86_64 %global sfarch x86-64-bmi2 %endif %endif %ifarch x86_64_v2 %global sfarch x86-64-sse41-popcnt %endif %ifarch x86_64 %if 0%{?rhel} == 9 # x86_64-v2 baseline, even if the RPM architecture is just x86_64 %global sfarch x86-64-sse41-popcnt %endif %endif %if %{undefined sfarch} %ifarch x86_64 %{?x86_64} # Plain x86_64 (v1), or some other version not covered above. %global sfarch x86-64 %endif %endif %ifarch ppc64le # POWER8 %global sfarch ppc-64-vsx %endif %ifarch aarch64 %global sfarch armv8 %endif %ifarch riscv64 %global sfarch riscv64 %endif %if %{undefined sfarch} # default to general-64, which also works for s390x %global sfarch general-64 %endif # NOTE: The upstream Makefile adds some flags on top of the Fedora ones. # Most of them are harmless/redundant except -O3. However, benchmarks # (based on the duration of `stockfish bench` in koji builders) support # the use of -O3 here: # Architecture | i686 | x86_64 | aarch64 | ppc64le | s390x # -O3 speedup | 14%% | 13%% | 10%% | 31%% | 1%% %if 0%{?el8} %ifarch s390x # (EPEL8 only): # during GIMPLE pass: vect # main.cpp: In function 'main': # main.cpp:33:5: internal compiler error: Segmentation fault # int main(int argc, char* argv[]) { # ^ # Reducing the optimization level fixes this at the cost of some performance; # according to the benchmarks above, the impact is trivial on s390x anyway. sed -r -i 's/-O3//' src/Makefile %endif %endif %make_build -C src profile-build ARCH=%sfarch \ EXTRACXXFLAGS="%{build_cxxflags}" \ EXTRALDFLAGS="%{build_ldflags}" %install mkdir -p %{buildroot}%{_bindir} install -m 755 -p src/%{name} %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_mandir}/man6 cp -p %{name}.6 %{buildroot}%{_mandir}/man6 mkdir -p %{buildroot}%{_sysconfdir}/%{name} cp -p polyglot.ini %{buildroot}%{_sysconfdir}/%{name} %check # run bench as a sanity check ./src/%{name} bench %files %license Copying.txt %doc AUTHORS %{name}-interface.txt README.md %{_mandir}/man*/%{name}* %{_bindir}/%{name} %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/polyglot.ini %changelog ## START: Generated by rpmautospec * Fri Jul 17 2026 Fedora Release Engineering - 18-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild * Tue Feb 03 2026 Ondrej Mosnáček - 18-2 - Make the build pass on EPEL 8 * Sun Feb 01 2026 Benjamin A. Beasley - 18-1 - Update to version 18; close RHBZ#2435680 * Sat Jan 17 2026 Fedora Release Engineering - 17.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild * Fri Jul 25 2025 Fedora Release Engineering - 17.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild * Fri Apr 04 2025 Benjamin A. Beasley - 17.1-1 - Update to 17.1 (close RHBZ#2356072) - The ppc64le version of Stockfish now uses VSX extensions (POWER8) * Sat Feb 15 2025 Benjamin A. Beasley - 17-6 - Drop i686 support (leaf package) * Wed Feb 05 2025 Benjamin A. Beasley - 17-5 - Support RPM architectures corresponding to x86_64 microarch. levels * Sun Jan 19 2025 Fedora Release Engineering - 17-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Sat Jan 18 2025 Ondrej Mosnáček - 17-3 - Backport a fix for GCC 15 * Mon Sep 09 2024 Benjamin A. Beasley - 17-2 - Compile for BMI2/x86_64-v3 on EL10 * Mon Sep 09 2024 Ondrej Mosnáček - 17-1 - Update to version 17 (fedora#2310722) * Sat Jul 20 2024 Fedora Release Engineering - 16.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild * Sat Mar 02 2024 Benjamin A. Beasley - 16.1-7 - On EPEL9 (and future EPEL10, etc.), use x86_64v2 baseline * Sat Mar 02 2024 Benjamin A. Beasley - 16.1-6 - Build with profile-guided optimization (PGO) * Sat Mar 02 2024 Benjamin A. Beasley - 16.1-5 - Ensure EPEL8/EPEL9 builds respect system compiler flags * Tue Feb 27 2024 Benjamin A. Beasley - 16.1-4 - Preemptively add riscv64 conditionals * Tue Feb 27 2024 Benjamin A. Beasley - 16.1-3 - Drop conditionals for armv7hl since Fedora no longer supports it * Tue Feb 27 2024 Benjamin A. Beasley - 16.1-2 - Assume SSE2 on i686 (since it must be on x86_64 hardware) * Sun Feb 25 2024 Benjamin A. Beasley - 16.1-1 - Update to 16.1 (close RHBZ#2265873) * Sat Jan 27 2024 Fedora Release Engineering - 16-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild * Sat Jul 22 2023 Fedora Release Engineering - 16-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild * Sun Jul 02 2023 Ondrej Mosnáček - 16-1 - Update to version 16 - Resolves: fedora#2219103 * Sat Jan 21 2023 Fedora Release Engineering - 15.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild * Mon Dec 05 2022 Ondrej Mosnáček - 15.1-1 - Update to version 15.1 - Resolves: rhbz#2150657 * Mon Dec 05 2022 Ondrej Mosnáček - 15-5 - Switch to rpmautospec * Tue Nov 29 2022 Benjamin A. Beasley - 15-3 - Update License to SPDX * Sat Jul 23 2022 Fedora Release Engineering - 15-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild * Tue Apr 19 2022 Ondrej Mosnacek - 15-1 - Bump to version 15 - Resolves: rhbz#2076750 * Sat Jan 22 2022 Fedora Release Engineering - 14.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Mon Nov 08 2021 Ondrej Mosnacek - 14.1-1 - Adapt spec file for NNUE support - Use upstream buildsystem - Bump to version 14.1 - Resolves: rhbz#1875192 - Resolves: rhbz#1988004 * Fri Jul 23 2021 Fedora Release Engineering - 12-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Wed Jan 27 2021 Fedora Release Engineering - 12-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Sun Sep 06 2020 Raphael Groner - 12-1 - bump to version 12 - use c++17 for std::clamp * Wed Aug 26 2020 Jeff Law - 11-4 - Do not force C++11 mode * Sat Aug 01 2020 Fedora Release Engineering - 11-3 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Wed Jul 29 2020 Fedora Release Engineering - 11-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Thu Apr 02 2020 Raphael Groner - 11-1 - new version * Fri Jan 31 2020 Fedora Release Engineering - 10-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Sat Jul 27 2019 Raphael Groner - 10-1 - new version * Sat Jul 27 2019 Fedora Release Engineering - 9-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Sun Feb 03 2019 Fedora Release Engineering - 9-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Sat Jul 14 2018 Fedora Release Engineering - 9-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Fri Feb 09 2018 Fedora Release Engineering - 9-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild * Fri Feb 02 2018 Raphael Groner - 9-1 - new version * Thu Aug 03 2017 Fedora Release Engineering - 8-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Sat Jun 10 2017 Raphael Groner - 8-1 - new version * Mon May 15 2017 Fedora Release Engineering - 7-3.20160225gite1a7d13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild * Sat Feb 11 2017 Fedora Release Engineering - 7-2.20160225gite1a7d13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Sat Mar 05 2016 Raphael Groner - 7-1.20160225gite1a7d13 - bump to show official upstream release of sf_7 * Sat Mar 05 2016 Raphael Groner - 7-0.11.20160225gite1a7d13 - new upstream snapshot * Wed Feb 03 2016 Raphael Groner - 7-0.10.20160118gitaedebe3 - new upstream snapshot * Tue Dec 15 2015 Raphael Groner - 7-0.9.20151105git76ed0ab - new upstream snapshot * Fri Nov 13 2015 Raphael Groner - 7-0.8.20151105git76ed0ab - new upstream snapshot * Sun Oct 11 2015 Raphael Groner - 7-0.7.20151007git55b46ff - new upstream snapshot * Wed Aug 19 2015 Raphael Groner - 7-0.6.20150817git69a1a80 - new upstream tarball as of 20150817 * Wed Jul 22 2015 Raphael Groner - 7-0.5.20150716git4095ff0 - new snapshot of upstream * Fri Jun 19 2015 Fedora Release Engineering - 7-0.4.20150506git2e86d1f - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Fri May 08 2015 Raphael Groner - 7-0.3.20150506git2e86d1f - latest snapshot from upstream * Sat May 02 2015 Kalev Lember - 7-0.2.20150302gitcb2111f - Rebuilt for GCC 5 C++11 ABI change * Mon Mar 02 2015 Raphael Groner - 7-0.1.20150302gitcb2111f - prepare next major version bump with latest upstream commit - merged c++11 branch (upstream) - disable spinlocks (upstream) - favour fishtest (upstream) * Mon Mar 02 2015 Raphael Groner - 6-4.20150228git1e6d21d - fix ownership of etc/ - add Suggests: polyglot-chess (rhbz#1197333) - latest commit from upstream - merged c++11 branch (upstream) - disable spinlocks (upstream) - favour fishtest (upstream) * Sun Mar 01 2015 Raphael Groner - 6-3.20150228git1e6d21d - implement cmake - harden gcc5 - latest commit from upstream * Sat Feb 28 2015 Raphael Groner - 6-2.20150226git8a2c413 - switch to official github sources (as mentioned at homepage) - provide polyglot support - disable debuginfo * Wed Feb 25 2015 Raphael Groner - 6-1.20150131gitb331768 - bump to version 6 and switch to commits * Tue Sep 10 2013 Dhiru Kholia - 4-2 - fixed prep section and book path, removed dos2unix call, confirm to FHS - preserve timestamps for resources, use ExclusiveArch, preserve debug symbols * Tue Sep 10 2013 Dhiru Kholia - 4-1 - initial version based on stockfish.spec from mageia ## END: Generated by rpmautospec