PFA a few patches for NetBSD and a few generic.
A few generic comments (Not related to NetBSD alone):
- The build area and install area needs to be cleanly separated. (For example see the configure patch, how top_dir and prefix are mixed up.) The same applies to XSB packages. The package make files need install target, instead of just copying the built directory to install. (I haven't patched for this as there are too many packages.)
- There is a typo on line 1 of version.sh
- It seems the build process assumes write access to installation area. For example, even xsb_configuration.P is compiled the first time you launch xsb (and so for possibly other P files from packages etc.) for which there may not be write access. It depends on whether the xwam looks newer than P to xsb which can't be guaranteed in a build process as they often end up bearing the same time stamp. I have worked around this in NetBSD package by deleting xsb_configuration.P.
- The file MSVC.sh somehow appears as a hard link and some tar tools refuse to process the archive. I worked around this by using GNU tar on NetBSD, but would be good to clean it up in the archive.
PS: Kindly ignore the emu/thread_xsb.c patch. It is no more required. It is taken care of by patch ../emu/thread_xsb.h
done