Subject: [bug#73278] [PATCH 2/2] gnu: Add ps1 homebrew development kit

From: Liliana Marie Prikler <[email-masked]>
Date: Sun, 15 Sep 2024 21:09:15 +0200

Am Sonntag, dem 15.09.2024 um 22:03 +0300 schrieb [email-masked]:
> From: Manolis Ragkousis <[email-masked]>
> 
> * gnu/packages/game-development.scm (miniaudio): New variable.
>   (miniaudio-0.10.43): New variable.
>   (gulrak-filesystem): New variable.
>   (ThreadPool): New variable.
>   (mkpsxiso): New variable.
>   (psn00bsdk): New variable.
Please only do one package per patch.

> […]
> +     (list #:tests? #f))
Should always be documented (using a comment).

> +    (synopsis "Header-only single-file std::filesystem helper
> library for C++")
Perhaps we can shorten that a little?
> +    (description
> + "This library provides std::filesystem-compatible functionality for
> C++11,
> +C++14, C++17, and C++20.  It is portable, tested on various
> platforms, and
> +resides in the ghc::filesystem namespace to avoid conflicts with
> +std::filesystem.")
> +    (home-page "https://github.com/gulrak/filesystem")
> +    (license license:expat)))
It looks like gulrak-filesystem is actually defined already.

> +(define-public ThreadPool
Use kebab-case.

> […]
> +    (description
> +     "A simple C++11 Thread Pool implementation.")
Avoid marketing speech ("simple" often isn't, particularly with thread
pools 😉).

> +    (home-page "https://github.com/progschj/ThreadPool")
> +    (license license:expat)))
> +
> +(define-public mkpsxiso
> +  (package
> +    (name "mkpsxiso")
> +    (version "v2.04")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/Lameguy64/mkpsxiso")
> +                    (commit version)
> +                    (recursive? #f)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "19cs5i39qhgwabrcklm6dym9p1zqmsgfgv6hcfc5z207yzdc9qhl"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list #:tests? #f  ;no test
> +           #:configure-flags
> +           #~(list "-DCMAKE_CXX_FLAGS=-fpermissive")
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'copy-tinyxml2
> +                 (lambda _
> +                   (copy-recursively
> +                    #$(package-source tinyxml2)
> +                    "tinyxml2")))
> +               (add-after 'copy-tinyxml2 'copy-miniaudio
> +                 (lambda _
> +                   (copy-recursively
> +                    #$(package-source miniaudio-0.10.43)
> +                    "miniaudio")))
> +               (add-after 'copy-miniaudio 'copy-gulrak-filesystem
> +                 (lambda _
> +                   (copy-recursively
> +                    #$(package-source gulrak-filesystem)
> +                    "ghc")))
> +               (add-after 'copy-gulrak-filesystem 'copy-threadpool
> +                 (lambda _
> +                   (copy-recursively
> +                    #$(package-source ThreadPool)
> +                    "ThreadPool")))
> +               (add-after 'copy-threadpool 'copy-flac
> +                 (lambda _
> +                   (mkdir-p "flac")
> +                   (with-directory-excursion "flac"
> +                     (invoke "tar" "xvf" #$(package-source flac)
> +                             "--strip-components=1")))))))
Do actually unbundle those instead of copying their sources.
> +    (inputs (list glfw pulseaudio))
> +    (native-inputs
> +     (list
> +      pkg-config
> +      tinyxml2
> +      miniaudio-0.10.43
> +      gulrak-filesystem
> +      ThreadPool
> +      flac
> +      ninja))
> +    (synopsis "Builds PlayStation CD images from an XML document")
> +    (description
> +     "MKPSXISO is capable of generating 2352 byte per sector ISO
> images with
> +CD-DA audio tracks and mixed-mode CD-XA and interleaved data for
> streaming
> +content.  It also uses XML with very simple to use directives for
> scripting the
> +contents of the image project.")
> +    (home-page "http://lameguy64.net/")
> +    (license license:gpl2)))
> +
> +(define-public psn00bsdk
> +  (package
> +    (name "psn00bsdk")
> +    (version "v0.24")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/Lameguy64/PSn00bSDK")
> +                    (commit
> "702bb601fb5712e2ae962a34b89204c646fe98f5")
> +                    (recursive? #f)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +               
> "1nvy6lff4p54127awc4pl0a73myrgssihksvpaxamadzpk12vvl4"))))
> +    (build-system cmake-build-system)
> +    (arguments
> +     (list #:tests? #f  ;no test
> +           #:configure-flags
> +           #~(list "-DCMAKE_BUILD_TYPE=Release"
> +                   "-DSKIP_EXAMPLES=true"
> +                   (string-append
> +                    "-DCMAKE_ASM_FLAGS=-Wa,-I"
> +                    #$source
> +                    "/libpsn00b/include,-march=r3000"))
> +           #:phases
> +           #~(modify-phases %standard-phases
> +               (add-after 'unpack 'patch-cmake
> +                 (lambda _
> +                   (substitute* "CMakeLists.txt"
> +                     ;; Modify ExternalProject_Add for 'libpsn00b-
> debug'
> +                     (("CMAKE_CACHE_ARGS[^\n]+-
> DCMAKE_BUILD_TYPE:STRING=Debug")
> +                      (string-append
> +                       "CMAKE_CACHE_ARGS ${_libpsn00b_args} -
> DCMAKE_BUILD_TYPE:STRING=Debug "
> +                       "-DCMAKE_ASM_FLAGS:STRING=-Wa,-I"
> +                       #$source "/libpsn00b/include,-march=r3000"))
> +                     ;; Modify ExternalProject_Add for 'libpsn00b-
> release'
> +                     (("CMAKE_CACHE_ARGS[^\n]+-
> DCMAKE_BUILD_TYPE:STRING=Release")
> +                      (string-append
> +                       "CMAKE_CACHE_ARGS ${_libpsn00b_args} -
> DCMAKE_BUILD_TYPE:STRING=Release "
> +                       "-DCMAKE_ASM_FLAGS:STRING=-Wa,-I"
> +                       #$source "/libpsn00b/include,-
> march=r3000")))))
> +               (add-after 'patch-cmake 'copy-mkpsxiso
> +                 (lambda _
> +                   (copy-recursively
> +                    #$(package-source mkpsxiso)
> +                    "tools/mkpsxiso")))
> +               (add-after 'copy-mkpsxiso 'copy-tinyxml2
> +                 (lambda _
> +                   (copy-recursively #$(package-source tinyxml2)
> "tools/tinyxml2")
> +                   (with-directory-excursion "tools/mkpsxiso"
> +                     (copy-recursively
> +                      #$(package-source tinyxml2)
> +                      "tinyxml2"))))
> +               (add-after 'copy-tinyxml2 'copy-miniaudio
> +                 (lambda _
> +                   (with-directory-excursion "tools/mkpsxiso"
> +                     (copy-recursively
> +                      #$(package-source miniaudio-0.10.43)
> +                      "miniaudio"))))
> +               (add-after 'copy-miniaudio 'copy-gulrak-filesystem
> +                 (lambda _
> +                   (with-directory-excursion "tools/mkpsxiso"
> +                     (copy-recursively
> +                      #$(package-source gulrak-filesystem)
> +                      "ghc"))))
> +               (add-after 'copy-gulrak-filesystem 'copy-threadpool
> +                 (lambda _
> +                   (with-directory-excursion "tools/mkpsxiso"
> +                     (copy-recursively
> +                      #$(package-source ThreadPool)
> +                      "ThreadPool"))))
> +               (add-after 'copy-threadpool 'copy-flac
> +                 (lambda _
> +                   (mkdir-p "flac")
> +                   (with-directory-excursion "tools/mkpsxiso/flac"
> +                     (invoke "tar" "xvf" #$(package-source flac)
> +                             "--strip-components=1")))))))
As above.

Cheers