macports/macports-legacy-support

MacPorts support for missing functions in legacy macOS versions

60

stars

676

commits

C

primary language

Jul 14, 2026

updated

trac.macports.org

README

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 or enhanced functions for the given OS.
  • libMacportsLegacySupport.dylib - A dynamic library with the missing or enhanced 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 its magic with most build systems.

Wrapped headers and replaced functions are:

Header FileFeatureMax Version Needing Feature
assert.hAdds C11 static_assert definitionOSX10.10
cmathAdds the same functions as those provided by the herein math.h, in namespace std::.see math.h
copyfile.hCompletely redone to provide 10.6 versionOSX10.5
dirent.hAdds fdopendir function. OSX10.9
fcntl.hFixes fcntl(...,F_GETPATH,...) bug on 10.4 ppc64. OSX10.4 ppc64
math.hAdds declaration of various long long methods (OSX10.6) and __sincos (macOS10.8)OSX10.6(8), GCC 8
netdb.hAdds declaration of AI_NUMERICSERVOSX10.5
pthread.hAdds PTHREAD_RWLOCK_INITIALIZEROSX10.4
Adds pthread_setname_np functionOSX10.5
Adds pthread_chdir_np and pthread_fchdir_np functionsOSX10.11
stdio.hAdds dprintf, vdprintf, getline, and getdelim functionsOSX10.6
Adds open_memstream and fmemopen functionsOSX10.12
Adds include of sys/stdio.hOSX10.9
stdlib.hAdds posix_memalign functional replacementOSX10.5
Wraps realpath to accept a NULL buffer argumentOSX10.5
Fixes non-POSIX realpath in 10.6OSX10.6
Adds arc4random_uniform and arc4random_buf functionsOSX10.6
string.hAdds stpncpy, strnlen, strndup and memmem functionsOSX10.6
strings.hAdds fls, flsl, and ffsl functionsOSX10.4
Adds flsll and ffsll functionsOSX10.8
time.hDeclares 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_SOURCEOSX10.4
Adds functions clock_gettime, clock_gettime_nsec_np and clock_settimeOSX10.11
Adds function timespec_getOSX10.14
ucontext.h subincludesAdds definitions and aliases for 10.5+ context names to 10.4OSX10.4
unistd.hAdds fgetattrlist and fsetattrlist functionsOSX10.5
Fixes bug in setattrlist functionOSX10.7
wchar.hAdds wcsdup, wcsnlen, wcpcpy, wcpncpy, wcscasecmp, and wcsncasecmp functionsOSX10.6
Xplugin.hAdds missing Xplugin.h to 10.4OSX10.4
mach/mach_time.hAdds function mach_approximate_timeOSX10.9
Adds functions mach_continuous_time and mach_continuous_approximate_timeOSX10.11
mach/machine.hAdds missing machine definitionsOSX10.13
net/if.hAdds include sys/socket.h, expected on current macOS systemsOSX10.8
net/if_utun.hAdded when missingOSX10.5
os/lock.hAdds os_unfair_lock_lock, os_unfair_lock_trylock, and os_unfair_lock_unlock functionsOSX10.11
sys/aio.hAdjusts includes and defines to match SDK 10.5+OSX10.4
sys/attr.hAdds missing VOL_CAP_INT_CLONE definitionOSX10.11
sys/clonefile.hAdds clonefile, clonefileat, and fclonefileat functionsOSX10.11
sys/fcntl.hAdds missing O_CLOEXEC, AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, and AT_REMOVEDIR definitionsas required (?)
Adds openat functionOSX10.9
sys/fsgetpath.hAdds fsgetpath functionOSX10.12
sys/mman.hAdds missing MAP_ANONYMOUS definitionOSX10.10
sys/queue.hAdds SLIST_HEAD_INITIALIZER macroOSX10.4
Adds SLIST_REMOVE_AFTER macroOSX10.6
Adds STAILQ_FOREACH macroOSX10.4
sys/random.hAdds getentropy functionOSX10.11
sys/socket.hCorrects CMSG_DATA definitionOSX10.5
sys/stat.hAdds fchmodat, fstatat, and mkdirat functionsOSX10.9
Adds setattrlistat and utimensat functionsOSX10.12
Adds lchmod functionOSX10.4
Adds limited stat64 supportOSX10.4
Fixes *stat* bugs on 10.4 ppc64OSX10.4 ppc64
sys/stdio.hAdds renameat functionOSX10.9
sys/time.hAdds lutimes functionOSX10.4
sys/types.hAdds definitions for u_char, u_short, u_int, u_long, ushort, and uint types that can be exposed via _DARWIN_C_SOURCEOSX10.4
sys/unistd.hAdds getattrlistat, readlinkat, faccessat, fchownat, linkat, symlinkat, and unlinkat functions.OSX10.9
Wraps sysconf to support _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLNOSX10.4
Wraps sysconf to support _SC_PHYS_PAGESOSX10.10
uuid/uuid.hAdds typedef of uuid_string_tOSX10.5
xlocale/_wchar.hAdds wcscasecmp_l, wcsncasecmp_l functionsOSX10.6
CoreFoundation/CoreFoundation.hAdds CFPropertyListCreateWithStream functionOSX10.5
CoreFoundation/CFString.hAdds CFStringCreateWithBytesNoCopy prototypeOSX10.4
OpenGL/gl.h, AGL/gl.hUpdates 10.4 gl.h to make types match behaviour of newer systems.OSX10.4
OpenGL/gliDispatch.h, AGL/gliDispatch.hWraps gliDispatch.h to prevent including glext.h and thereby match behaviour of newer systems.OSX10.6
TargetConditionals.hAdds definitions for all TARGET_* definitions as listed in 15.x SDK, if needed.???
-Adds __bzero library symbolOSX10.5
-Adds _dirfd library symbolOSX10.7
-Adds _fstatat$INODE64 library symbolOSX10.9
-Provides a workaround for bug in pthread_get_stacksize_npOSX10.4, OSX10.5, OSX10.9, OSX10.10
-Fixes boottime bug in 64-bit sysctl() and sysctlbyname()OSX10.5
-Fixes ppc64 signal handling in 10.4OSX10.4

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

Contributors

fhgwright

427 commits

kencu

79 commits

cjones051073

76 commits

macports/macports-legacy-support

MacPorts support for missing functions in legacy macOS versions

60

stars

676

commits

C

primary language

Jul 14, 2026

updated

trac.macports.org

README

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 or enhanced functions for the given OS.
  • libMacportsLegacySupport.dylib - A dynamic library with the missing or enhanced 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 its magic with most build systems.

Wrapped headers and replaced functions are:

Header FileFeatureMax Version Needing Feature
assert.hAdds C11 static_assert definitionOSX10.10
cmathAdds the same functions as those provided by the herein math.h, in namespace std::.see math.h
copyfile.hCompletely redone to provide 10.6 versionOSX10.5
dirent.hAdds fdopendir function. OSX10.9
fcntl.hFixes fcntl(...,F_GETPATH,...) bug on 10.4 ppc64. OSX10.4 ppc64
math.hAdds declaration of various long long methods (OSX10.6) and __sincos (macOS10.8)OSX10.6(8), GCC 8
netdb.hAdds declaration of AI_NUMERICSERVOSX10.5
pthread.hAdds PTHREAD_RWLOCK_INITIALIZEROSX10.4
Adds pthread_setname_np functionOSX10.5
Adds pthread_chdir_np and pthread_fchdir_np functionsOSX10.11
stdio.hAdds dprintf, vdprintf, getline, and getdelim functionsOSX10.6
Adds open_memstream and fmemopen functionsOSX10.12
Adds include of sys/stdio.hOSX10.9
stdlib.hAdds posix_memalign functional replacementOSX10.5
Wraps realpath to accept a NULL buffer argumentOSX10.5
Fixes non-POSIX realpath in 10.6OSX10.6
Adds arc4random_uniform and arc4random_buf functionsOSX10.6
string.hAdds stpncpy, strnlen, strndup and memmem functionsOSX10.6
strings.hAdds fls, flsl, and ffsl functionsOSX10.4
Adds flsll and ffsll functionsOSX10.8
time.hDeclares 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_SOURCEOSX10.4
Adds functions clock_gettime, clock_gettime_nsec_np and clock_settimeOSX10.11
Adds function timespec_getOSX10.14
ucontext.h subincludesAdds definitions and aliases for 10.5+ context names to 10.4OSX10.4
unistd.hAdds fgetattrlist and fsetattrlist functionsOSX10.5
Fixes bug in setattrlist functionOSX10.7
wchar.hAdds wcsdup, wcsnlen, wcpcpy, wcpncpy, wcscasecmp, and wcsncasecmp functionsOSX10.6
Xplugin.hAdds missing Xplugin.h to 10.4OSX10.4
mach/mach_time.hAdds function mach_approximate_timeOSX10.9
Adds functions mach_continuous_time and mach_continuous_approximate_timeOSX10.11
mach/machine.hAdds missing machine definitionsOSX10.13
net/if.hAdds include sys/socket.h, expected on current macOS systemsOSX10.8
net/if_utun.hAdded when missingOSX10.5
os/lock.hAdds os_unfair_lock_lock, os_unfair_lock_trylock, and os_unfair_lock_unlock functionsOSX10.11
sys/aio.hAdjusts includes and defines to match SDK 10.5+OSX10.4
sys/attr.hAdds missing VOL_CAP_INT_CLONE definitionOSX10.11
sys/clonefile.hAdds clonefile, clonefileat, and fclonefileat functionsOSX10.11
sys/fcntl.hAdds missing O_CLOEXEC, AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, and AT_REMOVEDIR definitionsas required (?)
Adds openat functionOSX10.9
sys/fsgetpath.hAdds fsgetpath functionOSX10.12
sys/mman.hAdds missing MAP_ANONYMOUS definitionOSX10.10
sys/queue.hAdds SLIST_HEAD_INITIALIZER macroOSX10.4
Adds SLIST_REMOVE_AFTER macroOSX10.6
Adds STAILQ_FOREACH macroOSX10.4
sys/random.hAdds getentropy functionOSX10.11
sys/socket.hCorrects CMSG_DATA definitionOSX10.5
sys/stat.hAdds fchmodat, fstatat, and mkdirat functionsOSX10.9
Adds setattrlistat and utimensat functionsOSX10.12
Adds lchmod functionOSX10.4
Adds limited stat64 supportOSX10.4
Fixes *stat* bugs on 10.4 ppc64OSX10.4 ppc64
sys/stdio.hAdds renameat functionOSX10.9
sys/time.hAdds lutimes functionOSX10.4
sys/types.hAdds definitions for u_char, u_short, u_int, u_long, ushort, and uint types that can be exposed via _DARWIN_C_SOURCEOSX10.4
sys/unistd.hAdds getattrlistat, readlinkat, faccessat, fchownat, linkat, symlinkat, and unlinkat functions.OSX10.9
Wraps sysconf to support _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLNOSX10.4
Wraps sysconf to support _SC_PHYS_PAGESOSX10.10
uuid/uuid.hAdds typedef of uuid_string_tOSX10.5
xlocale/_wchar.hAdds wcscasecmp_l, wcsncasecmp_l functionsOSX10.6
CoreFoundation/CoreFoundation.hAdds CFPropertyListCreateWithStream functionOSX10.5
CoreFoundation/CFString.hAdds CFStringCreateWithBytesNoCopy prototypeOSX10.4
OpenGL/gl.h, AGL/gl.hUpdates 10.4 gl.h to make types match behaviour of newer systems.OSX10.4
OpenGL/gliDispatch.h, AGL/gliDispatch.hWraps gliDispatch.h to prevent including glext.h and thereby match behaviour of newer systems.OSX10.6
TargetConditionals.hAdds definitions for all TARGET_* definitions as listed in 15.x SDK, if needed.???
-Adds __bzero library symbolOSX10.5
-Adds _dirfd library symbolOSX10.7
-Adds _fstatat$INODE64 library symbolOSX10.9
-Provides a workaround for bug in pthread_get_stacksize_npOSX10.4, OSX10.5, OSX10.9, OSX10.10
-Fixes boottime bug in 64-bit sysctl() and sysctlbyname()OSX10.5
-Fixes ppc64 signal handling in 10.4OSX10.4

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

Contributors

fhgwright

427 commits

kencu

79 commits

cjones051073

76 commits

Languages

C

92.6%

Makefile

2.9%

C++

1.6%

Roff

1.4%

Shell

1.0%