In case of Linux: the kernel alone does not make an OS, so if you consider the various distributions of Linux OS'es, like Debian for example: Each (well the large ones) distribution comes with their own package management tools.
So currently the "state of the art" is: Create a package for each OS (which means multiple OS'es of flavour "Linux").
I really wish their was a generic tool that would input a source tree and output packages for the most common package management systems.
You could have a look at CPack: https://cmake.org/Wiki/CMake:Packaging_With_CPack
It was created to be used with the C++ build system CMake, but can be used without it too. I use it to automatically build debian packages from Jenkins, but it also supports tarballs, RPMs, NSIS (Windows), PackageMaker (OS X), and cygwin packages. Hope this helps a bit!
That's precisely the point: we already have package managers. Its just 'unfashionable' to use them.
What I would do if my language needed package management: write an abstraction for whatever package managers exist on the platform I'm targeting. So my 'package manager' would just be a smart shell around apt-get, or yum, or whatever.
Okay, this looks like an idea ripe for the attention ..
So currently the "state of the art" is: Create a package for each OS (which means multiple OS'es of flavour "Linux").
I really wish their was a generic tool that would input a source tree and output packages for the most common package management systems.
Anyone?