mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
gnu: Add leela-zero.
* gnu/packages/games.scm (leela-zero): New variable. * gnu/packages/patches/leela-zero-gtest.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
85a411bc28
commit
fbfc07bd86
3 changed files with 93 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
# Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com>
|
# Copyright © 2018, 2019 Oleg Pykhalov <go.wigust@gmail.com>
|
||||||
# Copyright © 2018 Stefan Stefanović <stefanx2ovic@gmail.com>
|
# Copyright © 2018 Stefan Stefanović <stefanx2ovic@gmail.com>
|
||||||
# Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
# Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
|
# Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Guix.
|
# This file is part of GNU Guix.
|
||||||
#
|
#
|
||||||
|
@ -979,6 +980,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/lcms-CVE-2018-16435.patch \
|
%D%/packages/patches/lcms-CVE-2018-16435.patch \
|
||||||
%D%/packages/patches/ldc-bootstrap-disable-tests.patch \
|
%D%/packages/patches/ldc-bootstrap-disable-tests.patch \
|
||||||
%D%/packages/patches/ldc-disable-phobos-tests.patch \
|
%D%/packages/patches/ldc-disable-phobos-tests.patch \
|
||||||
|
%D%/packages/patches/leela-zero-gtest.patch \
|
||||||
%D%/packages/patches/liba52-enable-pic.patch \
|
%D%/packages/patches/liba52-enable-pic.patch \
|
||||||
%D%/packages/patches/liba52-link-with-libm.patch \
|
%D%/packages/patches/liba52-link-with-libm.patch \
|
||||||
%D%/packages/patches/liba52-set-soname.patch \
|
%D%/packages/patches/liba52-set-soname.patch \
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
|
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
|
||||||
;;; Copyright © 2019 Jesse Gibbons <jgibbons2357+guix@gmail.com>
|
;;; Copyright © 2019 Jesse Gibbons <jgibbons2357+guix@gmail.com>
|
||||||
;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
|
;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
|
||||||
|
;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -130,6 +131,7 @@ (define-module (gnu packages games)
|
||||||
#:use-module (gnu packages netpbm)
|
#:use-module (gnu packages netpbm)
|
||||||
#:use-module (gnu packages networking)
|
#:use-module (gnu packages networking)
|
||||||
#:use-module (gnu packages ocaml)
|
#:use-module (gnu packages ocaml)
|
||||||
|
#:use-module (gnu packages opencl)
|
||||||
#:use-module (gnu packages pcre)
|
#:use-module (gnu packages pcre)
|
||||||
#:use-module (gnu packages perl)
|
#:use-module (gnu packages perl)
|
||||||
#:use-module (gnu packages perl-check)
|
#:use-module (gnu packages perl-check)
|
||||||
|
@ -7580,3 +7582,52 @@ (define-public freeorion
|
||||||
;; released under both gpl2 and cc-by-sa3.0. Bundled Gigi library is
|
;; released under both gpl2 and cc-by-sa3.0. Bundled Gigi library is
|
||||||
;; released under lgpl2.1+.
|
;; released under lgpl2.1+.
|
||||||
(license (list license:gpl2 license:cc-by-sa3.0 license:lgpl2.1+))))
|
(license (list license:gpl2 license:cc-by-sa3.0 license:lgpl2.1+))))
|
||||||
|
|
||||||
|
(define-public leela-zero
|
||||||
|
(package
|
||||||
|
(name "leela-zero")
|
||||||
|
(version "0.17")
|
||||||
|
(source
|
||||||
|
(origin
|
||||||
|
(method git-fetch)
|
||||||
|
(uri (git-reference
|
||||||
|
(url "https://github.com/leela-zero/leela-zero.git")
|
||||||
|
(commit (string-append "v" version))))
|
||||||
|
(file-name (git-file-name name version))
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"17px5iny8mql5c01bymcli7zfssswkzvb2i8gnsmjcck6i2n8srl"))
|
||||||
|
(patches (search-patches "leela-zero-gtest.patch"))))
|
||||||
|
(build-system cmake-build-system)
|
||||||
|
(native-inputs
|
||||||
|
`(("googletest" ,googletest)))
|
||||||
|
(inputs
|
||||||
|
`(("boost" ,boost)
|
||||||
|
("ocl-icd" ,ocl-icd)
|
||||||
|
("openblas" ,openblas)
|
||||||
|
("opencl-headers" ,opencl-headers)
|
||||||
|
("qtbase" ,qtbase)
|
||||||
|
("zlib" ,zlib)))
|
||||||
|
(arguments
|
||||||
|
'(#:configure-flags '("-DUSE_BLAS=YES")
|
||||||
|
#:phases (modify-phases %standard-phases
|
||||||
|
(add-before 'configure 'fix-tests
|
||||||
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
|
(let ((home (getcwd)))
|
||||||
|
(setenv "HOME" home)
|
||||||
|
(substitute* "src/tests/gtests.cpp"
|
||||||
|
(("\\.\\./src/tests/0k\\.txt")
|
||||||
|
(string-append home "/src/tests/0k.txt"))
|
||||||
|
(("cfg_gtp_mode = true;")
|
||||||
|
"cfg_gtp_mode = true; cfg_cpu_only = true;")))
|
||||||
|
#t))
|
||||||
|
(replace 'check
|
||||||
|
(lambda _
|
||||||
|
(invoke "./tests"))))))
|
||||||
|
(home-page "https://github.com/leela-zero/leela-zero")
|
||||||
|
(synopsis "Program playing the game of Go")
|
||||||
|
(description
|
||||||
|
"Leela-zero is a Go engine with no human-provided knowledge, modeled after
|
||||||
|
the AlphaGo Zero paper. The current best network weights file for the engine
|
||||||
|
can be downloaded from @url{https://zero.sjeng.org/best-network}.")
|
||||||
|
(license license:gpl3+)))
|
||||||
|
|
40
gnu/packages/patches/leela-zero-gtest.patch
Normal file
40
gnu/packages/patches/leela-zero-gtest.patch
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
Use shared gtest instead of submodule
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 617e4b2..2857875 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -18,7 +18,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
project(leelaz)
|
||||||
|
-add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't want to install gtest, exclude it from `all`
|
||||||
|
|
||||||
|
# Required Packages
|
||||||
|
set(Boost_MIN_VERSION "1.58.0")
|
||||||
|
@@ -27,6 +26,7 @@ find_package(Boost 1.58.0 REQUIRED program_options filesystem)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(OpenCL REQUIRED)
|
||||||
|
+find_package(GTest REQUIRED)
|
||||||
|
# We need OpenBLAS for now, because we make some specific
|
||||||
|
# calls. Ideally we'd use OpenBLAS is possible and fall back to
|
||||||
|
# not doing those calls if it's not present.
|
||||||
|
@@ -93,6 +93,7 @@ include_directories(${IncludePath})
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
include_directories(${OpenCL_INCLUDE_DIRS})
|
||||||
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||||
|
+include_directories(${GTEST_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
if((UNIX AND NOT APPLE) OR WIN32)
|
||||||
|
include_directories(${BLAS_INCLUDE_DIRS})
|
||||||
|
@@ -141,7 +142,8 @@ target_link_libraries(tests ${Boost_LIBRARIES})
|
||||||
|
target_link_libraries(tests ${BLAS_LIBRARIES})
|
||||||
|
target_link_libraries(tests ${OpenCL_LIBRARIES})
|
||||||
|
target_link_libraries(tests ${ZLIB_LIBRARIES})
|
||||||
|
-target_link_libraries(tests gtest_main ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
+target_link_libraries(tests ${GTEST_BOTH_LIBRARIES})
|
||||||
|
+target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
|
include(GetGitRevisionDescription)
|
||||||
|
git_describe(VERSION --tags)
|
Loading…
Reference in a new issue