When using toolchain provided via apt (clang, ndk-sysroot, autotools, etc) should I anticipated issues with hardcoded file paths pointing to '/data/data/com.termux/'? This would be easy enough to fix by building packages manually after editing patch files etc, but would rather use apt in device where possible
Sorry, I'm not sure what you're after here! Could you describe a bit more what you want to do?
I want to compile some libs and other binaries on my device using termux terminal as well as other tools provided by apt within the termux environment. However, I don't want the resuting libs/binaries to live within /data/data/com.termux. For example, for zeromq on android you need libzmq. To use libzmq within an independent android app via jni I wouldn't want libzmq to be located at /data/data/com.termux/files/usr/lib but within the apk itself. In other situations I may want executable binaries within my apps /data/data dir, such as /data/data/com.myapp/files/usr/bin etc. I can already do this using build-package.sh on my Ubuntu host, but it would be convenient to do it on my devices as well.
Most packages use $TERMUX_PREFIX in their configuration/patches so changing that env var should take you a long way If you want to cross compile for another prefix.
See for example https://github.com/termux/termux-packages/commit/e0ab589ef9582a9d17ae90c5b1d4309cc0af4c675
Problems with paths are solvable by either changing TERMUX_PREFIX and TERMUX_ANDROID_HOME or by patching.