me
/
guix
Archived
1
0
Fork 0

gnu: stockfish: Factor out the neural network revision.

* gnu/packages/games.scm (stockfish): Factor out the neural-network-revision.
master
Tobias Geerinckx-Rice 2021-07-03 00:14:37 +02:00
parent 8630017e2e
commit c33e2009d4
No known key found for this signature in database
GPG Key ID: 0DB0FF884F556D79
1 changed files with 51 additions and 48 deletions

View File

@ -11962,56 +11962,59 @@ etc. You can also play games on FICS or against an engine.")
(license license:gpl2+))) (license license:gpl2+)))
(define-public stockfish (define-public stockfish
(package (let ((neural-network-revision "3475407dc199")) ; also update hash below
(name "stockfish") (package
(version "14") (name "stockfish")
(source (version "14")
(origin (source
(method git-fetch) (origin
(uri (git-reference (method git-fetch)
(url "https://github.com/official-stockfish/Stockfish") (uri (git-reference
(commit (string-append "sf_" version)))) (url "https://github.com/official-stockfish/Stockfish")
(file-name (git-file-name name version)) (commit (string-append "sf_" version))))
(sha256 (file-name (git-file-name name version))
(base32 "046b3rq9w8lzgk07q5zazzkl93ai99ab18hr9d8n73mabjpi6zbx")))) (sha256
(build-system gnu-build-system) (base32 "046b3rq9w8lzgk07q5zazzkl93ai99ab18hr9d8n73mabjpi6zbx"))))
(inputs (build-system gnu-build-system)
`(("neural-network" (inputs
,(origin `(("neural-network"
(method url-fetch) ,(origin
(uri "https://tests.stockfishchess.org/api/nn/nn-3475407dc199.nnue") (method url-fetch)
(sha256 (uri (string-append "https://tests.stockfishchess.org/api/nn/nn-"
(base32 "11zci5kgwdw9rh8w2w4p84764g82rr666y3n8r2flwwrq5yl0x9l")))))) neural-network-revision ".nnue"))
(arguments (sha256
`(#:tests? #f (base32
#:make-flags (list "-C" "src" "11zci5kgwdw9rh8w2w4p84764g82rr666y3n8r2flwwrq5yl0x9l"))))))
"build" (arguments
(string-append "PREFIX=" `(#:tests? #f
(assoc-ref %outputs "out")) #:make-flags (list "-C" "src"
(string-append "ARCH=" "build"
,(match (%current-system) (string-append "PREFIX="
("x86_64-linux" "x86-64") (assoc-ref %outputs "out"))
("i686-linux" "x86-32") (string-append "ARCH="
("aarch64-linux" "general-64") ,(match (%current-system)
("armhf-linux" "armv7") ("x86_64-linux" "x86-64")
("mips64el-linux" "general-64") ("i686-linux" "x86-32")
(_ "general-32")))) ("aarch64-linux" "general-64")
#:phases (modify-phases %standard-phases ("armhf-linux" "armv7")
(delete 'configure) ("mips64el-linux" "general-64")
;; The official neural network file is needed for building (_ "general-32"))))
;; and is embedded in the resulting binary. #:phases (modify-phases %standard-phases
(add-after 'unpack 'copy-net (delete 'configure)
(lambda* (#:key inputs #:allow-other-keys) ;; The official neural network file is needed for building
(copy-file (assoc-ref inputs "neural-network") ;; and is embedded in the resulting binary.
"src/nn-3475407dc199.nnue") (add-after 'unpack 'copy-net
#t))))) (lambda* (#:key inputs #:allow-other-keys)
(synopsis "Strong chess engine") (copy-file (assoc-ref inputs "neural-network")
(description (format #f "src/nn-~a.nnue"
"Stockfish is a very strong chess engine. It is much stronger than the ,neural-network-revision)))))))
(synopsis "Strong chess engine")
(description
"Stockfish is a very strong chess engine. It is much stronger than the
best human chess grandmasters. It can be used with UCI-compatible GUIs like best human chess grandmasters. It can be used with UCI-compatible GUIs like
ChessX.") ChessX.")
(home-page "https://stockfishchess.org/") (home-page "https://stockfishchess.org/")
(license license:gpl3+))) (license license:gpl3+))))
(define-public barrage (define-public barrage
(package (package