"This has a multitude of problems, however. The terminfo database is part of the ncurses library, and different operating systems and distributions package different versions of ncurses. This was a problem for tmux users on macOS for many years because the version of ncurses packaged with macOS was so old that it did not even include the tmux-256color terminfo entry at all!"
I build static Linux userlands from scratch using only busybox/toybox and a statically-linked GCC.
When compiling programs, e.g., tmux, I have been using netbsd-curses instead of ncurses.
After I compile tmux statically, the terminfo entries needed by tmux, i.e., needed by the curses libraries compiled into it, are contained by default in the directory $HOME/.terminfo. If nothing is found there, tmux then checks /usr/share/terminfo (or whatever path was use when compiling, e.g., /usr/local/share/terminfo).
This directory can of course exist apart from a curses library installed in a directory. In the userlands I make, there is no curses library installed in a directory after I have finished compiling all the programs.
For example, I can make a tarball of the terminfo directory from any suitable up-to-date distribution and untar it on the target computer.
Or I can make a hashed database of only the entries I need.
For me, the terminfo database is not "part of the curses library"; curses libraries provide an example terminfo database and a utility to compile terminfo entries. If the entries were truly part of the library, then one might argue they would be compiled into programs along with the library when compiling statically.
I keep a personalised copy of a terminfo database, i.e., a tarball of a terminfo directory, separate and apart from a curses library.
To be used with whatever curses library I choose. Not to suggest there is a great variety of curses libraries to choose from.
I build static Linux userlands from scratch using only busybox/toybox and a statically-linked GCC.
When compiling programs, e.g., tmux, I have been using netbsd-curses instead of ncurses.
After I compile tmux statically, the terminfo entries needed by tmux, i.e., needed by the curses libraries compiled into it, are contained by default in the directory $HOME/.terminfo. If nothing is found there, tmux then checks /usr/share/terminfo (or whatever path was use when compiling, e.g., /usr/local/share/terminfo).
This directory can of course exist apart from a curses library installed in a directory. In the userlands I make, there is no curses library installed in a directory after I have finished compiling all the programs.
For example, I can make a tarball of the terminfo directory from any suitable up-to-date distribution and untar it on the target computer.
Or I can make a hashed database of only the entries I need.
For me, the terminfo database is not "part of the curses library"; curses libraries provide an example terminfo database and a utility to compile terminfo entries. If the entries were truly part of the library, then one might argue they would be compiled into programs along with the library when compiling statically.
I keep a personalised copy of a terminfo database, i.e., a tarball of a terminfo directory, separate and apart from a curses library.
To be used with whatever curses library I choose. Not to suggest there is a great variety of curses libraries to choose from.