miniupnp / macports-legacy-support

MacPorts support for missing functions in legacy macOS versions

Home Page:https://trac.macports.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MacPorts Support for Legacy OSX Versions

Features

Installs a number of wrapper headers around system headers that add functionality missing in various older OSX releases.

Installed headers use the include_next pre-processor feature to add the missing features and then forward include the original header. So using these headers instead of the originals should be transparent.

Missing functions are compiled into a library that must also be linked into any builds using the wrapped headers. This is handled in MacPorts via the legacysupport PortGroup.

Wrapped headers 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
pthread.h Adds PTHREAD_RWLOCK_INITIALIZER OSX10.4
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
time.h Adds clock_gettime function OSX10.11
wchar.h Adds wcsdup, wcsnlen, wcpcpy, wcpncpy, wcscasecmp, and wcsncasecmp functions OSX10.6
xlocale/_wchar.h Adds wcscasecmp_l, wcsncasecmp_l functions OSX10.6
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/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/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

Building

This project does currently not use a configuration phase.

Instead, configuration is supposed to take place by overriding the main Makefile's variables, either via environment variables, command line parameters to the make call itself or modification of the main Makefile.

GNU make is a hard build dependency.

Most variables contain paths to various tools. Unless explicitly stated otherwise, both system (BSD-derived) and GNU coreutils variants should work, with a preference for the native system tools.

Special variables

PLATFORM

Major Darwin (not [Mac] OS X/macOS!) version to target against.

This is typically detected automatically, but can also be overridden manually to test builds for other OS versions.

Some symbols must be built multiple times. Each variant will use a different data layout and have a special postfix appended to it. The data layouts supported and needed depend upon the architecture and (target) OS version.

FORCE_ARCH

Exactly one single architecture to build for.

Older versions of lipo do not support the -archs flag, so automatic architecture detection via binary/object file inspection will not be possible on older platforms.

In order to avoid an additional dependency, and, arguably more importantly, a circular dependency with the cctools port providing newer lipo versions within MacPorts, this variable was introduced. It disables the automatic architecture detection feature and instead hardcodes the contained value as the target architecture.

Within MacPorts, we use it in universal (multi-architecture) builds with one pass per architecture. Eventually, the MacPorts system/muniversal PortGroup will merge the resulting binaries into one fat/universal binary automatically.

This variable takes one single value only. It is not a list.

If your lipo binary is new enough and supports the -archs flag, you will not need to use this variable. Instead, directly build the software universally in one pass via the usual -arch compiler flags. The autodetection, split and merge features will then handle the different architectures automatically.

About

MacPorts support for missing functions in legacy macOS versions

https://trac.macports.org

License:MIT License


Languages

Language:C 85.5%Language:Makefile 9.2%Language:C++ 5.3%