Getting MakeMKV Working with Guix

The place to discuss linux version of MakeMKV
Post Reply
blah1989z
Posts: 5
Joined: Wed Jan 05, 2022 1:13 am

Getting MakeMKV Working with Guix

Post by blah1989z »

Hello!

I wanted to create a package for Guix so others could use MakeMKV on Guix easily; and I've gotten really close. Just in case it's useful for anyone, I'll put the package code at the bottom of this post.

The makemkvcon executable seems to work perfectly, as far as I can tell; but the application doesn't seem to be able to recognize whether the beta is still within the key or, if a registration key is even used, it seems to not store the key in any way that it can remember and check against, in the future.
Screenshot from 2022-01-14 23-03-31.png
Screenshot from 2022-01-14 23-03-31.png (42.77 KiB) Viewed 6171 times
Launching the app. immediately states that it's not the latest version (which, as viewable in the screenshot, shouldn't be true as it identifies itself as version 1.16.5.

But, in any case, I figure, "O. K.; well, – if I put in the key for the beta, manually – I should get around the weird behavior as any version can be used with a registration key."
Screenshot from 2022-01-14 23-04-08.png
Screenshot from 2022-01-14 23-04-08.png (63.09 KiB) Viewed 6171 times
The app. seems to recognize the key and the expiry date as the first of February so I think this should suffice and hit O. K. but that just causes the app. to close; running the makemkv command from the command line and doing this again doesn't display any kind of error in the terminal so I'm not sure if this is crashing or otherwise. Reopening the app. just results in the same behavior as before in every way except that clicking Register automatically loads the key, again, so I don't have to type/paste it in, again.

Anyway, the short of this post is that if I could get some insight into how MakeMKV verifies (and marks as valid, for future use) the key, that'd be great as I'd, then, be able to get this working for others on Guix to easily use.

Guix is somewhat different from the average Linux distro is that it stores all programs it installs under unique paths of the path /gnu/store; part of what I resolve in the package definition is where programs can expect to find dependencies it may need. I'm pretty sure I've resolved all of the dependency locations as nothing generates errors of not being able to find things like Bash, anymore, and I'm pretty certain makemkvcon is working flawlessly.

I wouldn't expect MakeMKV to write whether someone's using a valid key to the root, any, and would expect it to mark such things in the user's home directory but my first thought is that, perhaps, this setup for installed programs may be causing the app. to not be able to verify registration keys, at all; store them but not be able to properly register that they're valid or something.

Code: Select all

(use-modules ((guix licenses) #:prefix license:)
             (guix utils)
             (guix packages)
             (guix download)
             (guix build-system gnu)
             (gnu  packages     bootstrap)
             (gnu  packages     elf)
             (gnu  packages     pkg-config)
             (gnu  packages     compression)
             (gnu  packages     tls)
             (gnu  packages     xml)
             (gnu  packages     video)
             (gnu  packages     qt))

(define makemkvcon (package
                     (name         "makemkvcon")
                     (version      "1.16.5")
                     (source       (origin
                                     (method url-fetch)
                                     (uri    (string-append "https://www.makemkv.com/download/"
                                                            "makemkv-bin-" version ".tar.gz"))
                                     (sha256 (base32
                                               "1y14yxhjj0sdq0s24qr58m0ddhna2rf0q0w3ny888as4wbqiwvm0"))))
                     (build-system gnu-build-system)
                     (arguments    `(#:tests?            #f
                                     #:validate-runpath? #f
                                     #:phases            (modify-phases %standard-phases
                                                           (delete     'configure)
                                                           (delete     'build)
                                                           (add-before 'install 'adjust-makefile
                                                             (lambda* (#:key outputs #:allow-other-keys)
                                                               (let ([out (assoc-ref outputs "out")])
                                                                 (substitute* "Makefile"
                                                                   [("PREFIX=/usr")                     (string-append "PREFIX=" out)]
                                                                   [("install: tmp/eula_accepted bin/") "install: bin/"]))))
                                                           (delete     'strip))))
                     (home-page    "https://www.makemkv.com/")
                     (synopsis     "Executable for MakeMKV to handle disc operations")
                     (description  "")
                     (license      license:non-copyleft)))

(package
  (name          "makemkv")
  (version       "1.16.5")
  (source        (origin
                   (method url-fetch)
                   (uri    (string-append "https://www.makemkv.com/download/"
                                          name "-oss-" version ".tar.gz"))
                   (sha256 (base32
                             "131vdi4gyc996z77rrcqb9nfbd62j8314ai4ib1jnilmrsrk93p5"))))
  (build-system  gnu-build-system)
  (arguments     `(#:modules ((guix  build  gnu-build-system)
                              (guix  build  utils)
                              (ice-9 popen)
                              (ice-9 rdelim))
                   #:tests?  #f
                   #:phases  (modify-phases %standard-phases
                               (add-before 'configure 'set-ldconfig-cache
                                 (lambda _
                                   (substitute* "Makefile.in"
                                     [("ldconfig") "ldconfig -C /tmp/ld.so.cache~"])

                                   (substitute* "makemkvgui/src/api_linux.cpp"
                                     [("\"/usr/local/bin\",") "\"/run/current-system/profile/bin\", \"~/.guix-profile/bin\","])))
                               (add-after  'strip 'fix-rpath
                                 (lambda* (#:key inputs outputs #:allow-other-keys)
                                   (let* ([out            (assoc-ref outputs "out")]
                                          [makemkvcon-bin (string-append out "/bin")]
                                          [makemkvcon-exc (string-append
                                                            makemkvcon-bin
                                                            "/makemkvcon")])
                                     (install-file
                                       (string-append
                                         (assoc-ref inputs "makemkvcon")
                                         "/bin/makemkvcon")
                                       makemkvcon-bin)

                                     (invoke "chmod" "u+w" makemkvcon-exc)

                                     (invoke "patchelf"                 "--set-interpreter"
                                             (search-input-file
                                               inputs
                                               ,(glibc-dynamic-linker)) makemkvcon-exc)

                                     (invoke "patchelf" "--set-rpath"
                                             (string-append out "/lib")
                                             makemkvcon-exc)))))))
  (native-inputs (list pkg-config patchelf makemkvcon))
  (inputs        (list zlib openssl expat ffmpeg qtbase-5))
  (home-page     "https://www.makemkv.com/")
  (synopsis      "Helper files for MakeMKV")
  (description   "MakeMKV allows for creating MKV files from the chapters of a
DVD.

This package provides the MakeMKV GUI, libmakemkv multiplexer library, and
libdriveio MMC drive interrogation library")
  (license       license:lgpl2.1))
bmillham
Posts: 155
Joined: Mon Mar 27, 2017 12:42 am

Re: Getting MakeMKV Working with Guix

Post by bmillham »

Normally MakeMKV saves the settings in $HOME/.MakeMKV/settings.conf

As a test, try creating that file with this line:

app_Key = "your_secret_key"

and see if it works. Or, just search your system for the .MakeMKV directory to find out where Guix thinks the users home is.
blah1989z
Posts: 5
Joined: Wed Jan 05, 2022 1:13 am

Re: Getting MakeMKV Working with Guix

Post by blah1989z »

Looks like MakeMKV generated both the directory and settings.conf file:
Screenshot from 2022-01-15 19-40-45.png
Screenshot from 2022-01-15 19-40-45.png (133.13 KiB) Viewed 6147 times
I'm guessing this is why it knows how to load that particular key every time I go back to Register? So no dice there, unfortunately.
blah1989z
Posts: 5
Joined: Wed Jan 05, 2022 1:13 am

Re: Getting MakeMKV Working with Guix

Post by blah1989z »

Giving this a bump in the hope that there's interest in allowing this pretty nifty program to run on yet another platform, opening up the opportunity for more users.
Post Reply