Hi all.
Just sharing some thoughts of mine.
I would probably do something like this:
For shared libraries...
Create a temporary directory, say /tmp/mypackage/usr/local/mylib
Then do something like copying all shared libraries (dependencies included) to that directory.
For executable...
Create 2 temporary directories, say /tmp/mypackage/usr/local/mybin, /tmp/mypackage/usr/local/myscript
Copy all the original bin files into mybin, then create a wrapper script for environmental variables in myscript.
#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/mylib
exec /usr/local/mybin/myprogram "$@"
Modify PATH in your ~/.ashrc or ~/.profile so you could call your programs more easily
For other entries, you can probably stick to the originals, in case the binaries had path hard-coded during compilation.
/tmp/mypackage/usr/local/share...
Make sure to edit your .desktop shortcut to the wrapper script if available.
Squash up everything (mksquashfs mypackage mypackage.tcz) and try it out in a clean environment.
If you missed something, add that into your package.
Remember to check the environmental variables, some programs need their custom variables set manually.
If no error occur, it should be good.
Kinda like a personal AppImage, more flexible in a way but can be tedious.