Skip to content

MacPorts support for missing functions in legacy macOS versions

License

Notifications You must be signed in to change notification settings

macports/macports-legacy-support

Repository files navigation

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:

, fsetattrlist, and fgetattrlist functions.
Header File Feature Max Version Needing Feature
assert.h Adds C11 static_assert definition OSX10.10
cmath Adds the same functions as those provided by the herein math.h, in namespace std::. see math.h
copyfile.h Wraps copyfile_state_get to support COPYFILE_STATE_COPIED OSX10.5
dirent.h Adds fdopendir function. OSX10.9
os/lock.h Adds os_unfair_lock_lock, os_unfair_lock_trylock, and os_unfair_lock_unlock functions OSX10.11
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
pthread.h Adds PTHREAD_RWLOCK_INITIALIZER OSX10.4
Adds pthread_setname_np function OSX10.5
stdio.h Adds dprintf, vdprintf, getline, getdelim, open_memstream, and fmemopen functions OSX10.6, OSX10.12 (open_memstream)
stdlib.h Adds posix_memalign functional replacement OSX10.5
Wraps realpath to accept a NULL buffer argument OSX10.5
Fixes non-POSIX realpath in 10.6 OSX10.6
Adds arc4random_uniform and arc4random_buf functions OSX10.6
string.h Adds stpncpy, 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 functions clock_gettime(macOS10.11) and timespec_get(macOS10.14). Defines TIME_UTC (macOS10.14). Declares asctime_r, ctime_r, gmtime_r, and localtime_r functions that are otherwise hidden in the presence of _ANSI_SOURCE, _POSIX_C_SOURCE, or _XOPEN_SOURCE (OSX10.4) OSX10.4(11,14)
wchar.h Adds wcsdup, wcsnlen, wcpcpy, wcpncpy, wcscasecmp, and wcsncasecmp functions OSX10.6
mach/machine.h Adds missing machine definitions OSX10.13
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 utimensat, fsgetpath and setattrlistat functions OSX10.12
sys/mman.h Adds missing MAP_ANONYMOUS definition OSX10.10
sys/queue.h Adds SLIST_HEAD_INITIALIZER macro OSX10.4
Adds SLIST_REMOVE_AFTER macro OSX10.6
Adds STAILQ_FOREACH macro OSX10.4
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/random.h Adds getentropy function OSX10.11
sys/socket.h Corrects CMSG_DATA definition OSX10.5
sys/time.h Adds lutimes function OSX10.4
sys/types.h Adds definitions for u_char, u_short, u_int, u_long, ushort, and uint types that can be exposed via _DARWIN_C_SOURCE OSX10.4
sys/unistd.h Adds getattrlistat, readlinkat, faccessat, fchownat, linkat, symlinkat, unlinkatOSX10.9
Wraps sysconf to support _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN OSX10.4
Wraps sysconf to support _SC_PHYS_PAGES OSX10.10
uuid/uuid.h Adds typedef of uuid_string_t OSX10.5
CoreFoundation/CoreFoundation.h Adds CFPropertyListCreateWithStream function OSX10.5
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, TARGET_OS_IOS, TARGET_OS_TV, TARGET_OS_WATCH and TARGET_OS_OSX if needed. OSX10.10
- Adds __bzero library symbol OSX10.5
- Adds _dirfd library symbol OSX10.7
- Adds _fstatat$INODE64 library symbol OSX10.9
- Provides a workaround for bug in pthread_get_stacksize_np OSX10.4, OSX10.5, OSX10.9, OSX10.10

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