Move library files to subdirectory

In order to be able to properly depend on the library target in the test
targets, move library files to `src` subdirectory. See [1] for more
information. Require cabal version >= 1.8.

[1] http://stackoverflow.com/a/18310327
Use getPlatformVersions instead of systemVersion on OSX host

In some cases the installed version of Xcode contains SDKs with
a version lower than the current system version. Use the maximum of the
list returned by `getPlatformVersions` instead of the system version.