Towards an official MakeMKV port (link inside)

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

MakeMKV has been on the WantedPorts list for a very long time. I see there's some attempt linked which hasn't seen a commit for 7 years. That one just builds the GUI, which is IMHO the wrong approach, because the GUI can't do anything without the closed source binary.

Starting from my own HOWTO, which I had to update and make it more and more complex, I created my own port. This one doesn't support GUI at all, because I can't get the closed source binary ( makemkvcon) to work correctly in the "guiserver" mode on FreeBSD, which is needed for the GUI. But console-only usage is still better than nothing ...

Now it might be worthwile to improve that port so it could be adopted in the official ports tree? So, I'm looking for review/input here.

Some issues I already think about are:
  • libmakemkv.so must be built for Linux, so makemkvcon can use it, and depends on libavcodec. I'm not aware of any linux-c6 or linux-c7 port providing this, so my current solution is to build fdk-aac and ffmpeg in the "pre-configure" target and install static libraries in a temporary directory, these are later used to build libmakemkv.so. Do you think this is a good approach? An alternative would be to create separate "linux-fdk-aac" and "linux-ffmpeg" ports that install in /compat/linux, but I don't think that is a good idea, as all the files there should come from repackaged centos packages?
  • In general, the linux-c6 / linux-c7 ports do not provide any headers. Right now, I use the system's headers for zlib and expat together with the libs in /compat/linux while for OpenSSL, I let the port download the exact source version matching the Linux library and use the headers from the source tree when building. Any thoughts on this?
  • The port's PREFIX is ${LOCALBASE}, but it still installs binaries and libs in /opt/makemkv. This allows to clearly separate the makemkv libs and also to provide some fake sysfs entries below /opt/makemkv needed for makemkvcon to find the drive (created by a bundled script). Is this a viable approach?
  • makemkvcon always segfaults after doing its work. Should we provide a wrapper that disables core dumping here?
Please share any thoughts and improvements on the port, thank you!

 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Anyone tried it? Did it work for you? Any comment on the "unusual" building process, do you think this might be acceptable for FreeBSD ports?

BTW, for getting the GUI to work as well, I asked on the MakeMKV forums for help with no luck so far. Looks like noone over there is interested in having their software work on FreeBSD :(
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

There are some minor updates to the port, it now also includes a (very incomplete) manpage for makemkvcon.

Without any suggestions what to improve so far, I decided to submit this current state, so we will see what ports committers think of it :) Of course I'm still open to feedback here.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Port has been updated to new upstream version 1.14.4 -- still waiting for feedback on inclusion in the official ports tree.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Recent changes in Mk/Uses/linux.mk broke the build. An updated version is available in my repository as well as in the PR trying to get this in the tree (but so far, only concerns were raised about the unusual build, that I don't see a way to address, so it might never end up in the tree unless there's a native FreeBSD version some day...).

I didn't update the port revision as it isn't official anyways.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

New upstream version 1.14.5 is in my repo.

Also fixed the build with linux-c6 after receiving a report of build failure.
 

joplass

Active Member

Reaction score: 15
Messages: 132

It seems there is no GUI, I could be wrong on that, if so where are the commands for cli? I haven't used MakeMKV without GUI.
 

lmm

New Member


Messages: 1

Is there an easy way to install the not-yet-official port? I'm eager to try your makemkv port but not familiar with poudriere; from the documentation it seems pretty complicated.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,926
Messages: 33,312

Just download the port and put everything in a directory. You don't need poudriere to build a port (new or old). See ports(7).
 

joplass

Active Member

Reaction score: 15
Messages: 132

I had the same question because I am highly interested in that program.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

UPDATE: makemkv 1.15.0 is now available in my Git repository, and also in the FreeBSD PR

Unfortunately, I expect the port to be finally rejected now. The reason is I now have to build a whole temporary GNU toolchain, just to get a newer libstdc++.so.6 I can bundle in the package, because the version installed by the linux-c7 ports is now too old for makemkv :( Of course, this makes the port huge, slow to build, and fragile. Unless makemkv provides FreeBSD binaries or the Linuxulator ports move to something newer, this is the only way to have makemkv working on FreeBSD.

Is there an easy way to install the not-yet-official port?
Also joplass -- Assuming you have a recent ports tree on your system in the standard location, all you have to do is get the port (e.g. by git cloning my repository at https://github.com/Zirias/zfbsd-ports or by just downloading the files of the port individually to the same directory) and then type make install clean in this directory.

I recommend installing these packages beforehand to avoid building all of them as dependencies:

linux_base-c7
linux-c7-openssl
linux-c7-expat
gcc9
pkgconfig
perl5
nasm
expat
gawk
gsed
patchelf

In order to use makemkv, you need a linux-compatible sg device that's disabled in the GENERIC kernel configuration, so you have to compile your own kernel. This is pretty simple as well. I called my kernel "DESKTOP" and as I'm on amd64, added the following config file as /usr/src/sys/amd64/conf/DESKTOP:
Code:
include GENERIC
ident DESKTOP

device          sg
Then just follow the instructions in the handbook
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Well, I worked a good 2 days to get this update running with a temporary GNU toolchain -- porting linux-c8 (that's a LOT of ports) would probably take much longer :) But it's sure the way forward to stay compatible with more recent Linux software...
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

And more good news: Finally we have a package, thanks to Mike Chen allowing me to distribute a binary slightly patched for FreeBSD :) Users of the "latest" pkg repository should be able to install it.
There's still no GUI and still the need for building a kernel with "device sg" (this won't change unless there's a native FreeBSD version), but this should be much easier/faster than compiling the port locally :)
 

joplass

Active Member

Reaction score: 15
Messages: 132

I got this return. Is there something I shall do prior?

Code:
root@luna:~ # cd /usr/ports/multimedia/makemkv/ && make install clean
/usr/ports/multimedia/makemkv/: No such file or directory.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Update your ports tree? Or, if you use packages, just do pkg install makemkv.
But remember, you still need a kernel with "device sg" for it to work.
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

Yes, it means just that. FreeBSD has support for Linux-style "sg" devices, but they aren't in the GENERIC kernel configuration.

For the general procedure, refer to https://www.freebsd.org/doc/handbook/kernelconfig-config.html and https://www.freebsd.org/doc/handbook/kernelconfig-building.html

To include "sg", all you need is a config file like this:
Code:
include GENERIC
ident MYKERNEL

device sg
Use whatever you like instead of MYKERNEL and call the file the same (I personally use DESKTOP for my kernel config including sg).
 
OP
Zirias

Zirias

Aspiring Daemon

Reaction score: 391
Messages: 868

It should be simple indeed, you just need to have the source matching your running system installed, and make sure to read the linked chaptes of the handbook :)

I forgot to mention, if you're using packages, the package is not yet in the quarterly repo, so you have to use "latest". If you're compiling yourself, your ports tree should follow "head".
In the long run, using makemkv with "quarterly" will probably be a bit troublesome as "outdated" versions stop working pretty soon.
 
Top