libxg
libxg, or libxenograft, is a small, compact and portable library for IRIX 6.5 to add commonly used functions in BSD and Linux to IRIX in a lighter weight format than GNULib, and under the permissive BSD 3-clause license.
Characteristics
Libxg uses a simple POSIX makefile and C99 programming standards. It is derived from OmniOS, NetBSD and OpenBSD code.
Libxg provides the following functions as of June 2020:
asprintf() <asprintf.h>
forkpty() <forkpty.h>
getopt_long() (and a replacement getopt() function, both use <compat/getopt.h to avoid name collisions)
setenv() <setenv.h>
strndup() <strndup.h>
strtonum() <strtonum.h>
unsetenv() <setenv.h>
vasprintf() <asprintf.h>
It also provides an endian.h file.
Programming Guide
To link against the shared library, make sure to pass the n32 flag to the program to link against and use -lxg in the link flags alongside other libs.
To compile statically, include the /usr/lib32/libxg.a file in the final build
For including the functions in a project that needs porting, it is necessary to add guards to include the appropriate header files for IRIX
Where to get
Currently libxg is available at the IRIXCE gitea.