Wiki2
MiniDLNA (changes)

Showing changes from revision #14 to #15: Added | Removed | Changed

Porting miniDLNA to OpenBSD

Build

To compile and run minidlna the following libraries are needed. See ./minidlna/INSTALL. So first step is to find and install all the packages which includes these libraries. One way is to do some searching in http://www.openports.se.

  • libexif - Package: graphics/libexif
  • libjpeg - Package: graphics/jpeg
  • libid3tag - Package: audio/libid3tag
  • libFLAC - Package: audio/flac
  • libvorbis - Package: audio/libvorbis
  • sqlite3 - Package: databases/sqlite3
  • libavformat (the ffmpeg libraries) - Package: graphics/ffmpeg
  • libuuid - Package: /devel/uuid or ossp-uuid?

I already had a few packages installed on my development machine.

gettext, libiconv, libidn, nano, ruby, wget

So I installed all the dependent packages …

pkg_add libexif jpeg libid3tag flac libvorbis sqlite3 ffmpeg uuid

Next I try to compile the miniDLNA. Make complains about missing header files for the installed packages above. The headers aren’t included in the packages as those are build to work with prebuilt applications. This means that the packages must be compiled locally from ports.

So next step is to install the ports source code. Get the source code from the install CD’s and unpack them.

cd /usr
tar xzf ports.tar.gz
cd /usr/src
tar xzf src.tar.gz
tar xzf xenocara.tar.gz

Because binaries are already installed I would prefer not to recompile everything. First I try to do make fetch to see if headers become available.

cd /usr/ports/graphics/libexif
make fetch
...

I don’t think that was needed. The problem is that base include folder for installed packages in OpenBSD is /usr/local/include instead of /usr/include. So the solution is to change that in Makefile and genconfig.sh.

One difficult problem is that sendfile is used. sendfile is not supported on OpenBSD and need to be replaced by read and write in user space.

Another problem is regarding different network specification in Linux and OpenBSD. minidlna/getifaddr.c calls functions that isn’t supported in OpenBSD. The following functions needs to be reimplemented in OpenBSD.

  • int getifaddr(const char * ifname, char * buf, int len)
  • int getsysaddr(char * buf, int len)
  • int getsyshwaddr(char * buf, int len)
  • int get_remote_mac(struct in_addr ip_addr, unsigned char * mac)

This has been done in FreeBSD port and CVS HEAD.

__NR_clock_gettime syscall can be replaced by CLOCK_GETTIME(2)

  1. 1 branch is now targetting multiple OS support using autoconf. See autoconf and metaauto for more info. 1.1 branch in not stable yet.

To be continued …

References