Cocoa in the Shell

Building libbluray with BD-Java on Mac OS X

A colleague of mine is currently writing an article on how to play Blu-ray discs with VLC on Mac OS X. This morning he asked me if I could help him to build the lastest version of libbluray. I’m kinda lazy, so I answered him to use homebrew because it rox, and save lazy people lot of time. Turns out that the version of libbluray on homebrew is 0.2.3, and the lastest available is 0.3.0. So, I couldn’t be lazy anymore, crap.

Ok, let’s download the last tarball of libbluray, untar. Before running ./configure, I apparently need to execute the bootstrap script.


Various cases of missing dependencies:

./bootstrap: line 3: autoreconf: command not found

autoreconf: failed to run aclocal: No such file or directory

autoreconf: glibtoolize is needed because this package uses Libtool

God, I’m already fed up, but homebrew to the rescue (I’m giving you all the packages needed at once)

brew install autoconf automake fontconfig freetype libtool libxml2 pkg-config

Sweet, now it’s time to do the usual configure/make dance. But well, I should have known it could not work just like that :’

checking for LIBXML2... no
configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

So, pkg-config doesn’t find libxml2. Assuming your homebrew config is standard, we can do something like this

sudo ln -s /usr/local/Cellar/libxml2/VERSION/lib/pkgconfig/libxml-2.0.pc /usr/local/lib/pkgconfig/libxml-2.0.pc

At the time of this post, VERSION is 2.9.1, so adapt if needed. Then you can check if it worked:

pkg-config --cflags libxml-2.0 libxml-2.0

It should output something like this:


Now let’s re-run ./configure

BD-J support:                  no
Metadata support (libxml2):    yes
Build examples:                yes

Hooray! it’s all good, make works as expected. Now I can do something else, oh wait… My colleague to me:

- Did you have a problem with Java?
- WUT? Java? No, you know my hatred against Java right? Why this question?
- Java is needed for BD-J, to enable menu support.
- Oh right…

What is this?, looking at the config, if we want this we need to pass the –enable-bdjava flag to configure.

So, first I have to download the JDK… Arghh, I feel like quoting Itoshiki Nozomu:

Zetsuboushita! Java watashi ni Zetsuboushita!

After putting the flag ./configure complains that it can’t find the file jni.h. Yeah it couldn’t work just like that, what a hassle.

Looks like jni.h is located here:


Hmmmm, let’s try the usual symlink trick.

ln -s /System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/*.h /usr/local/include/

Awesome, it works.

BD-J support:                  yes
BD-J font support (freetype2): yes
BD-J type:                     j2se
Metadata support (libxml2):    yes
Build examples:                yes

Yeah, this time I have actually done it. Now I can use this lib and libaacs in VLC and perhaps I will see Blu-ray menus. OR NOT.

I don’t own Blu-rays anyway, and I freaking hate VLC so…

Ok, back to watch Fate/Zero, I know it’s cool, already read the books.

PS: You guys should totally look at mpv player, best video player, ever.