The idea is this: Have a dedicated Mac for building the ports. This Mac has HomeBrew, or MacPorts, or Fink installed. Compile a port on this Mac, and produce a binary package that can be distributed to other Macs (of the same architecture). The distributed binary should function on the target Mac without HomeBrew, or MacPorts, or Fink ever being present.
For clarification: when I say "produce a binary package", I don't really care about the type of that "package". It does not need to be a proper PKG. I am happy with a tgz or zip archive as well, as long as it contains everything delivered for the right directories for the tool to work fine (including config file, sample, man, libs, etc) and nothing more. Sources and headers are not needed to run the tool, so those should be exluded from the package if possible.
Manually assembling all the necessary files for such a package is something I would not attempt. So I wonder if there is a recipe in any of HomeBrew/MacPorts/Fink to do something like this.
Take Midnight Commander as an example. The goal is to build it on one computer, then distribute and use on many target Macs. However, those target Macs would not have HomeBrew/MacPorts/Fink, nor Xcode or gcc. Those are just regular Macs with macOS installed, nothing else. But I would like to run my build of Midnight Commander on all of them. A week or so later I may also want to add MariaDB, or any other tool that can be built from source using HomeBrew/MacPorts/Fink. Again, I would build it on one Mac, but intend to run it on many other.
The target Macs are managed computers. Their users are just that, users. Tools required would be built from source on the dedicated Mac, and provided as binary for the target Macs. Yes, I could install MacPorts or HomeBrew on those Macs too and compile what is needed, in place. But I hope this can be avoided. If I remember correctly, MacPorts offers something like "make package" or "make pkg". Which is what gave me the idea to investigate this possibility further.
Any pointers or suggestions are welcome.
Supplemental: I found the below documentation very useful. If you can point me to similar readings, please do so. Particularly if that covers a similar function in HomeBrew or Fink.
MacPorts howto - CreateInstallers
Instructions on github
The focus is NOT on how to create a package. The focus is on WHAT files go into the package.