guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: pokerth: Fix build and modernize package.


From: guix-commits
Subject: 02/02: gnu: pokerth: Fix build and modernize package.
Date: Tue, 12 Jul 2022 11:20:50 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit f0c8abe85787a0018c0adeb0bc4a6672d46686e4
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Tue Jul 12 11:08:42 2022 -0400

    gnu: pokerth: Fix build and modernize package.
    
    Fixes <https://issues.guix.gnu.org/51093>.
    
    * gnu/packages/games.scm (pokerth) [source]: Apply patch
    [inputs]: Use new style.
    [phases]: Delete trailing #t.  Use gexps.
    {fix-paths}: Remove the gsasl and libircclient related substitutions.
---
 gnu/local.mk                             |  1 +
 gnu/packages/games.scm                   | 84 +++++++++++++++-----------------
 gnu/packages/patches/pokerth-boost.patch | 38 +++++++++++++++
 3 files changed, 79 insertions(+), 44 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 6d30109a35..c567c3d519 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1598,6 +1598,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/pciutils-hurd-fix.patch                 \
   %D%/packages/patches/pjproject-install-libpjsua2.patch       \
   %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
+  %D%/packages/patches/pokerth-boost.patch                     \
   %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch           \
   %D%/packages/patches/pthreadpool-system-libraries.patch      \
   %D%/packages/patches/python-chai-drop-python2.patch          \
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index c6ed6eed00..713f9339b2 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -72,6 +72,7 @@
 ;;; Copyright © 2022 Roman Riabenko <roman@riabenko.com>
 ;;; Copyright © 2022 zamfofex <zamfofex@twdb.moe>
 ;;; Copyright © 2022 Gabriel Arazas <foo.dogsquared@gmail.com>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -12248,53 +12249,48 @@ game.")  ;thanks to Debian for description
            (delete-file-recursively "src/third_party/websocketpp")
            (substitute* "pokerth_lib.pro"
              (("src/third_party/websocketpp")
-              ""))
-           #t))))
+              ""))))
+       (patches (search-patches "pokerth-boost.patch"))))
     (build-system qt-build-system)
     (inputs
-     `(("boost" ,boost)
-       ("curl" ,curl)
-       ("gsasl" ,gsasl)
-       ("libgcrypt" ,libgcrypt)
-       ("libircclient" ,libircclient)
-       ("protobuf" ,protobuf-2)         ; remove package when no longer needed
-       ("qtbase" ,qtbase-5)
-       ("sdl" ,(sdl-union (list sdl sdl-mixer)))
-       ("sqlite" ,sqlite)
-       ("tinyxml" ,tinyxml)
-       ("websocketpp" ,websocketpp)
-       ("zlib" ,zlib)))
+     (list boost
+           curl
+           gsasl
+           libgcrypt
+           libircclient
+           protobuf-2                   ;remove package when no longer needed
+           qtbase-5
+           (sdl-union (list sdl sdl-mixer))
+           sqlite
+           tinyxml
+           websocketpp
+           zlib))
     (arguments
-     `(#:tests? #f ; No test suite
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-paths
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* (find-files "." "\\.pro$")
-               (("/opt/gsasl")
-                (assoc-ref inputs "gsasl"))
-               (("\\$\\$\\{PREFIX\\}/include/libircclient")
-                (search-input-directory inputs "/include/libircclient"))
-               (("LIB_DIRS =")
-                (string-append "LIB_DIRS = "
-                               (assoc-ref inputs "boost") "/lib")))
-             #t))
-         (add-after 'unpack 'fix-build
-           (lambda _
-             ;; Fixes for Boost versions >= 1.66.
-             (substitute* '("src/net/common/clientthread.cpp"
-                            "src/net/serveraccepthelper.h")
-               (("boost::asio::socket_base::non_blocking_io 
command\\(true\\);")
-                "")
-               (("newSock->io_control\\(command\\);")
-                "newSock->non_blocking(true);")
-               (("acceptedSocket->io_control\\(command\\);")
-                "acceptedSocket->non_blocking(true);"))
-             #t))
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (invoke "qmake" "pokerth.pro" "CONFIG+=client"
-                     (string-append "PREFIX=" (assoc-ref outputs "out"))))))))
+     (list
+      #:tests? #f                       ; No test suite
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* (find-files "." "\\.pro$")
+                (("LIB_DIRS =")
+                 (string-append "LIB_DIRS = "
+                                #$(this-package-input "boost") "/lib")))))
+          (add-after 'unpack 'fix-build
+            (lambda _
+              ;; Fixes for Boost versions >= 1.66.
+              (substitute* '("src/net/common/clientthread.cpp"
+                             "src/net/serveraccepthelper.h")
+                (("boost::asio::socket_base::non_blocking_io 
command\\(true\\);")
+                 "")
+                (("newSock->io_control\\(command\\);")
+                 "newSock->non_blocking(true);")
+                (("acceptedSocket->io_control\\(command\\);")
+                 "acceptedSocket->non_blocking(true);"))))
+          (replace 'configure
+            (lambda _
+              (invoke "qmake" "pokerth.pro" "CONFIG+=client"
+                      (string-append "PREFIX=" #$output)))))))
     (home-page "https://www.pokerth.net";)
     (synopsis "Texas holdem poker game")
     (description
diff --git a/gnu/packages/patches/pokerth-boost.patch 
b/gnu/packages/patches/pokerth-boost.patch
new file mode 100644
index 0000000000..85d32df299
--- /dev/null
+++ b/gnu/packages/patches/pokerth-boost.patch
@@ -0,0 +1,38 @@
+Retrieved from 
https://patch-diff.githubusercontent.com/raw/pokerth/pokerth/pull/396.patch
+
+From a769887330a317d55e7f64c71a32ad130ffb9307 Mon Sep 17 00:00:00 2001
+From: Stefan Strogin <steils@gentoo.org>
+Date: Mon, 18 May 2020 03:30:53 +0300
+Subject: [PATCH] Fix using boost placeholders (#395)
+
+---
+ src/net/common/serveracceptwebhelper.cpp | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/net/common/serveracceptwebhelper.cpp 
b/src/net/common/serveracceptwebhelper.cpp
+index f61d4d779..8701e1e99 100644
+--- a/src/net/common/serveracceptwebhelper.cpp
++++ b/src/net/common/serveracceptwebhelper.cpp
+@@ -29,6 +29,7 @@
+  * as that of the covered work.                                              *
+  
*****************************************************************************/
+ 
++#include <boost/bind/bind.hpp>
+ #include <net/serveracceptwebhelper.h>
+ #include <net/sessiondata.h>
+ #include <net/webreceivebuffer.h>
+@@ -58,10 +59,10 @@ ServerAcceptWebHelper::Listen(unsigned serverPort, bool 
/*ipv6*/, const std::str
+ 
+       m_webSocketServer->init_asio(m_ioService.get());
+ 
+-      
m_webSocketServer->set_validate_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::validate),
 this, _1));
+-      
m_webSocketServer->set_open_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_open),
 this, _1));
+-      
m_webSocketServer->set_close_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_close),
 this, _1));
+-      
m_webSocketServer->set_message_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_message),
 this, _1, _2));
++      
m_webSocketServer->set_validate_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::validate),
 this, boost::placeholders::_1));
++      
m_webSocketServer->set_open_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_open),
 this, boost::placeholders::_1));
++      
m_webSocketServer->set_close_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_close),
 this, boost::placeholders::_1));
++      
m_webSocketServer->set_message_handler(boost::bind(boost::mem_fn(&ServerAcceptWebHelper::on_message),
 this, boost::placeholders::_1, boost::placeholders::_2));
+ 
+       m_webSocketServer->listen(serverPort);
+       m_webSocketServer->start_accept();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]