freebsd/pkg — pull request #1113 by landonf (2014-12-23 23:57:45+00:00)
Title: Baseline Mac OS X Support

Howdy,

The patches here add support for building on Mac OS X; with these changes, all included tests (executed via `make check') pass on both Mac OS X and FreeBSD.

I don't anticipate an immediate merge, but I wanted to go ahead and open this to allow for comment.

This patchset primarily consists of:

- Adding compatibility shims for BSD-specific or later POSIX functionality that Mac OS X doesn't support (see `compat/`)
- Adding `pkg_macho.c` with support for Mach-O binary analysis.

For `pkg_macho.c`, I used BSD-licensed Mach-O parsing code written for [MacPorts](http://www.macports.org)' shared library/executable analysis (`external/libmachista`).

The primarily outstanding issues I have yet to tackle:

* Making sure I didn't miss any style(9) bugs.
* Finishing shared library analysis handling (marked with `MACTODO` in pkg_macho.c):
* Universal binary handling. I'm currently stuffing the architecture(s) supported by libraries into their library paths, as a file suffix. This is not the final solution, but I haven't decided how to tackle this yet.
* `dyld` specific features:
* Required/compatibility version fields that must match between the linking image and linked library.
* Relative library path handling via `dyld`'s @loader_path, @executable_path, etc.

Cheers!