For a simple package where you just want to pack up one folder (or three) of files, you can use a quick and easy tool and often make good packages.
For something more on the complicated side, you may need a book or couple of tutorials as well as the ability to have a virtual OS so you can test your package on a clean macOS or test Mac.
The best book I know on how to package is this one by Armin Briegel
Packages on macOS can contain pre-install scripts, several layers of files and post-install scripts and the second chapter of the book goes over all of those in detail.
In your case, I would try to leverage a community packaging resource like AutoPKG recipe for every dependency you can find and hopefully mesos itself:
Here is a very nice list of starte recipes you can examine and inspect to learn how to layer in many files or take apart a simple package vs a complex one:
If all this git and scripting and tools is too much learning (for ever or just for now), you could also do far worse than get a great tool to help you just build the package manually using an app to guide you in the process: