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.
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:
getopt_long() (and a replacement getopt() function, both use <compat/getopt.h to avoid name collisions)
It also provides an endian.h file.
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
Currently libxg is available at the IRIXCE gitea.