Profile Picture

Assorted tech

Hi, my name is Spencer. I'm a CS graduate focused on systems programming, Linux, and low-complexity design. Other interests: metal, hiking, guitar, rationality.

feed | contact

How to Enable MPD Track Ratings on Void Linux

Calendar icon October 23, 2020

Clock icon 3 min read

Folder icon #mpd #void #linux #music #ratings in tech

Track Ratings

Some MPD clients such as Cantata support giving tracks ratings as seen below. If you haven’t set up MPD yet, have a look at my other post “How to Set up MPD on Void Linux”.

Ratings in Cantata

Enabling Ratings in Cantata

In Cantata, track ratings are enabled by going to the menu on the right or Edit in the toolbar, then Preferences > Interface > Toolbar > Show Track Ratings. Upon enabling them, I got an error message saying that this version of MPD “does not support stickers”. Here is how I fixed it.

Building and Installing from Source

Void Linux’s MPD package does not support stickers because not everyone wants them, so making everyone install the SQLite database on their system is unnecessary. If we want track ratings, we need to enable SQLite support for MPD and then recompile it from source ourselves.

Setup

Void Linux uses xbps-src to build packages. There is a quickstart for setting up the build environment on Github. As it says, you will need to clone the void-packages repository and then cd into it and run ./xbps-src binary-bootstrap, which might take a few minutes.

Templates

Once that finishes, the srcpkgs/ directory has the tools and recipes to build every piece of software available through xbps (plus a few more even).

Edit the Template

We are messing with the MPD package, so open void-packages/srcpkgs/mpd/template in your text editor. Now there are three lines we need to change:

  1. Add -Dsqlite=enabled to the configure_args setting as follows:
configure_args="-Dopus=enabled -Dmikmod=enabled -Dneighbor=true -Dsqlite=enabled

This tells the build system that we want SQLite support. The -Dsqlite flag is documented here.

  1. Add sqlite-devel to the makedepends option:
makedepends="avahi-glib-libs-devel boost-devel faad2-devel ffmpeg-devel sqlite-devel
  1. Add sqlite to depends:
depends="libcap-progs sqlite"

Having SQLite support won’t do much good without having SQLite installed.

Rebuilding MPD

Now it’s time to actually compile MPD. From the void-packages directory, run ./xbps-src pkg mpd. This may take a few minutes.

Make the Switch

To switch to our version with SQLite support, uninstall the previous package with sudo xbps-remove mpd. Next, install the version we just compiled with sudo xbps-install --repository hostdir/binpkgs mpd. The old version is still probably running on your system, so you may need to pkill mpd so that the new version starts.

Conclusion

As you have seen, Void Linux makes it easy to reconfigure packages and build them yourself. If you ever run into a similar problem with a package not supporting an option you want, try a similar approach.

Comments