pavouk/lgi — pull request #25 by jasperla (2012-09-20 20:45:14+00:00)
Title: Unbreak loading of modules on OpenBSD (eg, libcairo.so.2)

Libaries are named differently on OpenBSD. So instead of building up a filename, trying to open it, and fail as can be seen from this ktrace:

14820 lua51 NAMI "libcairo.so.2"
14820 lua51 RET stat -1 errno 2 No such file or directory
14820 lua51 CALL stat(0x621bfa2ebe0,0x7f7fffff9600)
14820 lua51 NAMI "libcairo.so.2.so"
14820 lua51 RET stat -1 errno 2 No such file or directory
14820 lua51 CALL stat(0x621bfa2e740,0x7f7fffff9600)
14820 lua51 NAMI "libcairo.so.2.la"
14820 lua51 RET stat -1 errno 2 No such file or directory

On OpenBSD one can just try to open libcairo.so and the loader will search for the library with the highest version (libcairo.so.12.0 in our case right now) and load that.

The attached patch fixes this on OpenBSD.