[bug#78102] gnu: Add redumper.

Message ID 9966a347ee398a118b13a1febfcf62d7f77d0cc8.1745808541.git.maxim.cournoyer@gmail.com
State New
Headers
Series [bug#78102] gnu: Add redumper. |

Commit Message

Maxim Cournoyer April 28, 2025, 2:49 a.m. UTC
* gnu/packages/audio.scm (redumper): New variable.

Change-Id: I3740c6941d1ab11ac38993775a8004618636513c
---
 gnu/packages/audio.scm | 71 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)


base-commit: 56999614a45449c4b93c8614540210b609c2b356
  

Comments

Gabriel Wicki April 29, 2025, 7:57 a.m. UTC | #1
LGTM

but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
cross-compilation context.  do you think it is possible to get this to
work?  that would be really awesome.

the error i'm getting says:
> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 

thanks for your time and effort!
g
  
Maxim Cournoyer April 29, 2025, 3:37 p.m. UTC | #2
Hi,

Gabriel Wicki <gabriel@erlikon.ch> writes:

> LGTM

Thanks for the review.

> but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
> cross-compilation context.  do you think it is possible to get this to
> work?  that would be really awesome.

The problem was cross-compiling libcxx, which I've now resolved (see the
v2 I just sent).

> the error i'm getting says:
>> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
>> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 

Now we actually get to the cross-compilation of redumper, and it fails.
clang seems unable to locate what it needs from the glibc, as in this
bug report: <https://github.com/llvm/llvm-project/issues/72256>.

I'll punt on the cross-compilation part.  Let me know what you think of
the other changes in v2!
  
Gabriel Wicki April 29, 2025, 6:02 p.m. UTC | #3
Hey Maxim and Greg

On Wed, Apr 30, 2025 at 12:37:22AM +0900, Maxim Cournoyer wrote:
> > but unfortunately the 'adjust-CPLUS_INCLUDE_PATH phase does not work in
> > cross-compilation context.  do you think it is possible to get this to
> > work?  that would be really awesome.
> 
> The problem was cross-compiling libcxx, which I've now resolved (see the
> v2 I just sent).
Looks good, though I must admit that reviewing changes in our cmake
build system is somewhat out of my realm - maybe some other devs want to
chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?

> > the error i'm getting says:
> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 
> 
> Now we actually get to the cross-compilation of redumper, and it fails.
> clang seems unable to locate what it needs from the glibc, as in this
> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
>
> I'll punt on the cross-compilation part.
So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
clang version bump, since it seems to affect various cross-compilation
contexts and is not tied to our project?

Thanks for your time and effort!
g
  
Maxim Cournoyer April 29, 2025, 11:38 p.m. UTC | #4
Hi Gabriel,

Gabriel Wicki <gabriel@erlikon.ch> writes:

[...]

>> The problem was cross-compiling libcxx, which I've now resolved (see the
>> v2 I just sent).
> Looks good, though I must admit that reviewing changes in our cmake
> build system is somewhat out of my realm - maybe some other devs want to
> chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?

Note that, interestingly, this doesn't cause a world rebuild because the
change lives on the 'host' side and the default values means the same
usual inputs are used, which means the existing derivations don't
change.

>> > the error i'm getting says:
>> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
>> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f) 
>> 
>> Now we actually get to the cross-compilation of redumper, and it fails.
>> clang seems unable to locate what it needs from the glibc, as in this
>> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
>>
>> I'll punt on the cross-compilation part.
> So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
> clang version bump, since it seems to affect various cross-compilation
> contexts and is not tied to our project?

That's my expectation, yes.

> Thanks for your time and effort!

No worries!  I'll wait a couple days for Greg to chime in, and otherwise
push.
  
Greg Hogan May 1, 2025, 4:09 p.m. UTC | #5
On Tue, Apr 29, 2025 at 7:38 PM Maxim Cournoyer
<maxim.cournoyer@gmail.com> wrote:
>
> Hi Gabriel,
>
> Gabriel Wicki <gabriel@erlikon.ch> writes:
>
> [...]
>
> >> The problem was cross-compiling libcxx, which I've now resolved (see the
> >> v2 I just sent).
> > Looks good, though I must admit that reviewing changes in our cmake
> > build system is somewhat out of my realm - maybe some other devs want to
> > chime in on the issue (C++ team, maybe - I CC you, Greg, for that)?
>
> Note that, interestingly, this doesn't cause a world rebuild because the
> change lives on the 'host' side and the default values means the same
> usual inputs are used, which means the existing derivations don't
> change.
>
> >> > the error i'm getting says:
> >> >> error: in phase 'adjust-CPLUS_INCLUDE_PATH': uncaught exception:
> >> >> wrong-type-arg "string-append" "Wrong type (expecting ~A): ~S" ("string" #f) (#f)
> >>
> >> Now we actually get to the cross-compilation of redumper, and it fails.
> >> clang seems unable to locate what it needs from the glibc, as in this
> >> bug report: <https://github.com/llvm/llvm-project/issues/72256>.
> >>
> >> I'll punt on the cross-compilation part.
> > So, IIUC, the bug may (hopefully) eventually be fixed by an upstream
> > clang version bump, since it seems to affect various cross-compilation
> > contexts and is not tied to our project?
>
> That's my expectation, yes.
>
> > Thanks for your time and effort!
>
> No worries!  I'll wait a couple days for Greg to chime in, and otherwise
> push.
>
> --
> Thanks,
> Maxim

This is fantastic. I had not come across implicit-inputs but I am now
using this to build clang-toolchain with an updated gcc.

I can't speak to the cross-compilation but have added some comments
(questions) on the libcxx patch.

Greg
  
Maxim Cournoyer May 2, 2025, 1:23 a.m. UTC | #6
Hi Greg,

Greg Hogan <code@greghogan.com> writes:

[...]

> This is fantastic. I had not come across implicit-inputs but I am now
> using this to build clang-toolchain with an updated gcc.
>
> I can't speak to the cross-compilation but have added some comments
> (questions) on the libcxx patch.

Glad it will be useful outside of libcxx.  I wasn't sure of the added
value.  Thanks for your input!

I've now push this series, taking into account your comments about
libcxx; see commit 94593917394.

Thanks to both of you for the reviews!
  

Patch

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 03867b2da36..178818d1f68 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,7 @@  (define-module (gnu packages audio)
   #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -4082,6 +4083,76 @@  (define-public libshout-idjc
     ;; GNU Library (not Lesser) General Public License.
     (license license:lgpl2.0+)))
 
+(define-public redumper
+  (package
+    (name "redumper")
+    (version "561")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/superg/redumper")
+                    (commit (string-append "build_" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1r0wfi0fn3rq7s28p89rkgpgf567akd8z25l8r9sj7p4p3xp9m91"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:cmake cmake-next
+      #:build-type "Release"
+      ;; The build system uses CMake modules features that are only available
+      ;; when using Ninja.
+      #:configure-flags #~(list "-GNinja"
+                                "-DREDUMPER_CLANG_USE_LIBCPP=ON"
+                                (string-append "-DREDUMPER_VERSION_BUILD="
+                                               #$version)
+                                "-DCMAKE_BUILD_TYPE=Release")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+            ;; The libcxx include/c++/v1 directory is not exposed via
+            ;; CPLUS_INCLUDE_PATH by default, causing errors like
+            ;; "fatal error: 'format' file not found".
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (let ((gcc (assoc-ref (or native-inputs inputs) "gcc")))
+                (setenv "CPLUS_INCLUDE_PATH"
+                        (string-append
+                         (search-input-directory inputs
+                                                 "/include/c++/v1") ":"
+                         (getenv "CPLUS_INCLUDE_PATH"))))))
+          (replace 'build
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (invoke "cmake" "--build" "."
+                      "-j" (number->string
+                            (if parallel-build?
+                                (parallel-job-count)
+                                1)))))
+          (replace 'check
+            (lambda* (#:key build-type parallel-tests? tests?
+                      #:allow-other-keys)
+              (when tests?
+                (invoke "ctest" "-C" build-type
+                        "-j" (number->string
+                              (if parallel-tests?
+                                  (parallel-job-count)
+                                  1))))))
+          (replace 'install
+            (lambda _
+              ;; There is no CMake install target; manually install the
+              ;; binary.
+              (install-file "redumper"
+                            (string-append #$output "/bin")))))))
+    (native-inputs (list ninja clang-toolchain-19))
+    (inputs (list libcxx))
+    (home-page "https://github.com/superg/redumper")
+    (synopsis "Low-level CD/DVD dumper")
+    (description "@command{redumper} is a low-level byte perfect CD disc
+dumper.  It supports incremental dumps, advanced SCSI/C2 repair, intelligent
+audio CD offset detection, among other features.  @command{redumper} is also a
+general purpose DVD/HD-DVD/Blu-ray disc dumper.")
+    (license license:gpl3+)))
+
 (define-public resample
   (package
     (name "resample")