From patchwork Mon Jun 3 13:06:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guillaume Le Vaillant X-Patchwork-Id: 14207 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2BD1E17091; Mon, 3 Jun 2019 15:50:41 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 66A451708F for ; Mon, 3 Jun 2019 15:50:40 +0100 (BST) Received: from localhost ([127.0.0.1]:36088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXoIJ-0004DD-JU for patchwork@mira.cbaines.net; Mon, 03 Jun 2019 10:50:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXoID-0003Vk-OU for guix-patches@gnu.org; Mon, 03 Jun 2019 10:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXnwS-0001nz-KX for guix-patches@gnu.org; Mon, 03 Jun 2019 10:28:48 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hXnwR-0001mx-Vi for guix-patches@gnu.org; Mon, 03 Jun 2019 10:28:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hXnwR-0008SQ-NW for guix-patches@gnu.org; Mon, 03 Jun 2019 10:28:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36071] [PATCH] gnu: Add leela-zero. Resent-From: Guillaume LE VAILLANT Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 03 Jun 2019 14:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36071 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 36071@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155957205932477 (code B ref -1); Mon, 03 Jun 2019 14:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Jun 2019 14:27:39 +0000 Received: from localhost ([127.0.0.1]:42646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hXnw1-0008Ri-Ov for submit@debbugs.gnu.org; Mon, 03 Jun 2019 10:27:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hXmg1-000253-D1 for submit@debbugs.gnu.org; Mon, 03 Jun 2019 09:07:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:50313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXmfw-0008D6-An for submit@debbugs.gnu.org; Mon, 03 Jun 2019 09:06:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXmfu-000420-En for guix-patches@gnu.org; Mon, 03 Jun 2019 09:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXmfs-00087R-Pm for guix-patches@gnu.org; Mon, 03 Jun 2019 09:06:54 -0400 Received: from mout02.posteo.de ([185.67.36.66]:49675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXmfr-0007vk-Gn for guix-patches@gnu.org; Mon, 03 Jun 2019 09:06:52 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id E659F2400E5 for ; Mon, 3 Jun 2019 15:06:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1559567205; bh=7oamglKfagQMBvyGNfwKXZ0EwDnmuBHII/1gplajYfY=; h=From:To:Cc:Subject:Date:From; b=GIKndGNY+7vcguQX3gfBELgwRX7RVjfd0Ec7veNryNDJhNndnAllNyRMKAGyfj4zx is88S6J2cf9gu8+bJIGvqbuVvfFnqKz632xnPVdjqInm7GsK2eL4Aj+RygIJckBMii KSamT2sVxrsNc2tgDyvu+AI+xoqp/u3Et3Hmj/6FZ338y/UH6eYHT11JY5XeYc154R Idy5GS8/esCK/9haWPFtgJgK3Uk4pWuGgTZHV8zJe4H6QcgpNqoE5KVhGKXImf3S+s /28fBuW37z/nVYLVKJvvYvaXP9+2GNFGp/bMuhZAEkCovJQIe4gK8OCZYDkTuE1SQh eHegECf6DyzNw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 45Hb0w6rTKz9rxK; Mon, 3 Jun 2019 15:06:40 +0200 (CEST) Received: from yamatai.local (unknown [IPv6:2a01:e34:ed03:c7d0:d9da:d3a6:ed5f:e716]) by vps530281.ovh.net (Postfix) with ESMTPSA id 9B82D401B0; Mon, 3 Jun 2019 15:06:39 +0200 (CEST) From: Guillaume LE VAILLANT Date: Mon, 3 Jun 2019 15:06:11 +0200 Message-Id: <20190603130611.32142-1-glv@posteo.net> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Mon, 03 Jun 2019 10:27:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guillaume LE VAILLANT Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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. --- gnu/local.mk | 2 + gnu/packages/games.scm | 51 +++++++++++++++++++++ gnu/packages/patches/leela-zero-gtest.patch | 40 ++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 gnu/packages/patches/leela-zero-gtest.patch diff --git a/gnu/local.mk b/gnu/local.mk index 55a8fcd361..19cab48aff 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -20,6 +20,7 @@ # Copyright © 2018 Oleg Pykhalov # Copyright © 2018 Stefan Stefanović # Copyright © 2018 Maxim Cournoyer +# Copyright © 2019 Guillaume Le Vaillant # # This file is part of GNU Guix. # @@ -969,6 +970,7 @@ dist_patch_DATA = \ %D%/packages/patches/lcms-CVE-2018-16435.patch \ %D%/packages/patches/ldc-bootstrap-disable-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-link-with-libm.patch \ %D%/packages/patches/liba52-set-soname.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 4fdc9b01e6..ee8cc69273 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -40,6 +40,7 @@ ;;; Copyright © 2019 Oleg Pykhalov ;;; Copyright © 2019 Pierre Langlois ;;; Copyright © 2019 Julien Lepiller +;;; Copyright © 2019 Guillaume Le Vaillant ;;; ;;; This file is part of GNU Guix. ;;; @@ -128,6 +129,7 @@ #:use-module (gnu packages netpbm) #:use-module (gnu packages networking) #:use-module (gnu packages ocaml) + #:use-module (gnu packages opencl) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages perl-check) @@ -7336,3 +7338,52 @@ Unfortunately, Hacker is not aware of Drascula's real ambitions: DOMINATING the World and demonstrating that he is even more evil than his brother Vlad.") ;; Drascula uses a BSD-like license. (license (license:non-copyleft "file:///readme.txt")))) + +(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 _ + (zero? (system* "./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 https://zero.sjeng.org/best-network.") + (license license:gpl3+))) diff --git a/gnu/packages/patches/leela-zero-gtest.patch b/gnu/packages/patches/leela-zero-gtest.patch new file mode 100644 index 0000000000..7291b4ab72 --- /dev/null +++ b/gnu/packages/patches/leela-zero-gtest.patch @@ -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)