MacPorts support for missing functions in legacy macOS versions

conda install -c conda-forge macports-legacy-support


MacPorts Support for Legacy OSX Versions

Installs wrapper headers and library functions that add common functions missing in various older OSX releases to bring them approximately up to current expected standards.

Three different libraries are provided

  • libMacportsLegacySupport.a - A static library with the missing functions for the given OS.
  • libMacportsLegacySupport.dylib - A dynamic library with the missing functions for the given OS.
  • libMacportsLegacySystem.B.dylib - Similar to libMacportsLegacySupport.dylib but in addition re-exports the symbols from libSystem.B.dylib.

To use this library within MacPorts add the legacysupport PortGroup to the Portfile. This will add the required include paths and libraries to allow the library to do it's magic with most build systems.

Wrapped headers and replaced functions are:

Header File Feature Max Version Needing Feature
cmath Adds the same functions as those provided by the herein math.h, in namespace std::. see math.h
dirent.h Adds fdopendir function OSX10.9
math.h Adds declaration of various long long methods (OSX10.6) and __sincos (macOS10.8) OSX10.6(8), GCC 8
netdb.h Adds declaration of AI_NUMERICSERV OSX10.5
stdio.h Adds getline and getdelim functions OSX10.6
stdlib.h Adds posix_memalign functional replacement, and wraps realpath to accept a NULL buffer argument OSX10.5
Adds arc4random_uniform and arc4random_buf functions OSX10.6
string.h Adds strnlen, strndup and memmem functions OSX10.6
strings.h Adds fls,flsl,ffsl(OSX10.4) and flsll,ffsll(macOS10.8) functions OSX10.4(8)
time.h Adds clock_gettime function OSX10.11
wchar.h Adds wcsdup, wcsnlen, wcpcpy, wcpncpy, wcscasecmp, and wcsncasecmp functions OSX10.6
net/if.h Adds include sys/socket.h, expected on current macOS systems OSX10.8
xlocale/_wchar.h Adds wcscasecmp_l, wcsncasecmp_l functions OSX10.6
sys/aio.h Adjusts includes and defines to match SDK 10.5+ OSX10.4
sys/fcntl.h Adds missing O_CLOEXEC, AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, and AT_REMOVEDIR definitions as required (?)
Adds openat function OSX10.9
sys/fsgetpath.h Adds missing fsgetpath function OSX10.12
sys/mman.h Adds missing MAP_ANONYMOUS definition OSX10.10
sys/stdio.h Adds renameat function OSX10.9
sys/stat.h Adds fchmodat, fstatat, fstatat64 (if required, and on 10.5+), and mkdirat functions OSX10.9
Adds lchmod function OSX10.4
sys/time.h Adds lutimes function OSX10.4
sys/unistd.h Adds getattrlistat, readlinkat, faccessat, fchownat, linkat, symlinkat, and unlinkat functions OSX10.9
Wraps sysconf to support _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN OSX10.4
Wraps sysconf to support _SC_PHYS_PAGES OSX10.10
OpenGL/gliDispatch.h Wraps gliDispatch.h to prevent including glext.h and thereby match behaviour of newer systems. OSX10.6
TargetConditionals.h Adds definitions for TARGET_CPU_ARM, TARGET_CPU_ARM64, TARGET_OS_SIMULATOR and TARGET_OS_OSX if needed. OSX10.10

For information on building this library outside MacPorts, see BUILDING.txt.