unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Faiz via Guix-patches via <guix-patches@gnu.org>
To: 72569@debbugs.gnu.org
Cc: Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: [bug#72569] [PATCH v2 3/4] gnu: openclonk: Fix build.
Date: Wed, 28 Aug 2024 23:34:09 +0800	[thread overview]
Message-ID: <e74ba729-1b24-f1c3-a72c-85b0f61c00ec@disroot.org> (raw)
In-Reply-To: <59b04394-4737-6da3-cf9e-3f181431afa8@disroot.org>

From 499630a22aebe8921f317733143e257b09f08be3 Mon Sep 17 00:00:00 2001
Message-ID: <499630a22aebe8921f317733143e257b09f08be3.1724859175.git.adam.faiz@disroot.org>
In-Reply-To: <91bf9bff2c3c365d006a0e88024db50f416cd436.1724859175.git.adam.faiz@disroot.org>
References: <91bf9bff2c3c365d006a0e88024db50f416cd436.1724859175.git.adam.faiz@disroot.org>
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Sun, 11 Aug 2024 09:25:30 +0800
Subject: [PATCH v2 3/4] gnu: openclonk: Fix build.

* gnu/packages/games.scm (openclonk): Fix build.
[source]<snippet>: Unbundle dependencies and include the <limits> header where
necessary to fix the build.
[arguments]<#:phases>: Remove workarounds for bundled backward-cpp.
[inputs]: Remove dependencies for bundled backward-cpp. Add libb2, pcg-cpp,
and c-template-sort.
---
 gnu/packages/games.scm | 62 ++++++++++++++++++++++--------------------
 1 file changed, 33 insertions(+), 29 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 9ad6eabad2..850d40e66f 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -123,6 +123,7 @@ (define-module (gnu packages games)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -9622,7 +9623,32 @@ (define-public openclonk
                     "openclonk-" version "-src.tar.bz2"))
               (sha256
                (base32
-                "0imkqjp8lww5p0cnqf4k4mb2v682mnsas63qmiz17rspakr7fxik"))))
+                "0imkqjp8lww5p0cnqf4k4mb2v682mnsas63qmiz17rspakr7fxik"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   (delete-file-recursively "thirdparty")
+                   (substitute* "CMakeLists.txt"
+                     (("add_subdirectory\\(thirdparty/.*\\)") "")
+                     (("set_property\\(.*Third-party.*\\)") "")
+                     (("blake2") "b2")
+                     (("thirdparty/timsort/sort\\.h") "")
+                     (("thirdparty/pcg/.*\\.hpp") ""))
+                   (substitute* '("src/lib/C4Random.cpp"
+                                  "src/landscape/C4Particles.h")
+                     (("#include <pcg/pcg_random.hpp>")
+                      "#include <pcg_random.hpp>"))
+                   (substitute* "src/script/C4ScriptLibraries.cpp"
+                     (("blake2b.hash_output.get.., raw_output_length, data, data_length, nullptr, 0.")
+                      "blake2b(hash_output.get(), (const void*)raw_output_length, data, data_length, (size_t)(0), 0)"))
+                   (substitute* '("src/script/C4AulParse.cpp"
+                                  "src/editor/C4EditCursor.cpp"
+                                  "src/gui/C4ScriptGuiWindow.cpp")
+                     (("#include .C4Include\\.h." all)
+                      (string-append "#include <limits>\n" all)))
+                   (substitute* "src/lib/StdMesh.cpp"
+                     (("#include .timsort/sort\\.h.")
+                      "#include <sort.h>"))))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags '("-DAudio_TK=OpenAL")
@@ -9641,30 +9667,7 @@ (define-public openclonk
                (("PATH_SUFFIXES \"src\" \"gtest\"")
                 "PATH_SUFFIXES \"src\""))
              #t))
-         (add-after 'unpack 'adjust-backward-cpp-includes
-           (lambda _
-             ;; XXX: The bundled backward-cpp exports a CMake "interface"
-             ;; that includes external libraries such as libdl from glibc.
-             ;; By default, CMake interface includes are treated as "system
-             ;; headers", and GCC behaves poorly when glibc is passed as a
-             ;; system header (causing #include_next failures).
-
-             ;; Here we prevent targets that consume the Backward::Backward
-             ;; interface from treating it as "system includes".
-             (substitute* "CMakeLists.txt"
-               (("target_link_libraries\\((.+) Backward::Backward\\)" all target)
-                (string-append "set_property(TARGET " target " PROPERTY "
-                               "NO_SYSTEM_FROM_IMPORTED true)\n"
-                               all)))
-             #t))
-         (add-after 'unpack 'add-libiberty
-           ;; Build fails upon linking executables without this.
-           (lambda _
-             (substitute* "thirdparty/backward-cpp/BackwardConfig.cmake"
-               (("set\\(LIBBFD_LIBRARIES (.*?)\\)" _ libraries)
-                (string-append "set(LIBBFD_LIBRARIES " libraries " iberty)")))
-             #t))
-         (add-after 'add-libiberty 'lax-freealut-requirement
+         (add-after 'prepare-gmock 'lax-freealut-requirement
            ;; TODO: We provide freealut 1.1.0, but pkg-config somehow detects
            ;; it as 1.0.1.  Force minimal version.
            (lambda _
@@ -9686,10 +9689,11 @@ (define-public openclonk
        ("googletest" ,googletest)
        ("pkg-config" ,pkg-config)))
     (inputs
-     `(("freealut" ,freealut)
+     `(("c-template-sort" ,c-template-sort)
+       ("freealut" ,freealut)
        ("freetype" ,freetype)
        ("glew" ,glew)
-       ("libiberty" ,libiberty)
+       ("libb2" ,libb2)
        ("libjpeg" ,libjpeg-turbo)
        ("libogg" ,libogg)
        ("libpng" ,libpng)
@@ -9698,11 +9702,11 @@ (define-public openclonk
        ("mesa" ,mesa)
        ("miniupnpc" ,miniupnpc)
        ("openal" ,openal)
+       ("pcg-cpp" ,pcg-cpp)
        ("qtbase" ,qtbase-5)
        ("readline" ,readline)
        ("sdl" ,sdl2)
-       ("tinyxml" ,tinyxml)
-       ("zlib" ,zlib)))
+       ("tinyxml" ,tinyxml)))
     (home-page "https://www.openclonk.org/")
     (synopsis
      "Multiplayer action game where you control small and nimble humanoids")
-- 
2.41.0




  parent reply	other threads:[~2024-08-28 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-11  5:13 [bug#72569] [PATCH 0/4] gnu: openclonk: Fix build Adam Faiz via Guix-patches via
2024-08-11  5:16 ` [bug#72569] [PATCH 1/4] gnu: Add backward-cpp Adam Faiz via Guix-patches via
2024-08-17 12:15   ` Liliana Marie Prikler
2024-08-11  5:17 ` [bug#72569] [PATCH 2/4] gnu: Add sort-h Adam Faiz via Guix-patches via
2024-08-17 12:26   ` Liliana Marie Prikler
2024-08-11  5:18 ` [bug#72569] [PATCH 3/4] gnu: openclonk: Fix build Adam Faiz via Guix-patches via
2024-08-11  5:20 ` [bug#72569] [PATCH 4/4] gnu: openclonk: Use gexps and new input style Adam Faiz via Guix-patches via
2024-08-28 15:25 ` [bug#72569] [PATCH v2 1/4] gnu: Add backward-cpp Adam Faiz via Guix-patches via
2024-08-28 15:27 ` [bug#72569] [PATCH v2 2/4] gnu: Add c-template-sort Adam Faiz via Guix-patches via
2024-08-28 15:34 ` Adam Faiz via Guix-patches via [this message]
2024-08-28 15:36 ` [bug#72569] [PATCH v2 4/4] gnu: openclonk: Use gexps and new input style Adam Faiz via Guix-patches via
2024-08-31 16:32   ` bug#72569: " Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e74ba729-1b24-f1c3-a72c-85b0f61c00ec@disroot.org \
    --to=guix-patches@gnu.org \
    --cc=72569@debbugs.gnu.org \
    --cc=adam.faiz@disroot.org \
    --cc=liliana.prikler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).