andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.92k stars 229 forks source link

Autogenerate a .pc file during build #227

Closed tokyovigilante closed 4 years ago

tokyovigilante commented 4 years ago

Based on https://cmake.org/pipermail/cmake/2018-March/067293.html - generates and installs a .pc file to allow use of pkg-config to incorporate the library in other projects.

KingDuckZ commented 4 years ago

what's preventing this from being merged?

andrewrk commented 4 years ago

This is a packaging thing, it really doesn't belong upstream

KingDuckZ commented 4 years ago

Are you sure? Most projects generate a .pc file, in fact cmake, meson etc have functions to automate this (there is a better way to achieve what @tokyovigilante was doing manually, and besides the includedir was wrong, should've been ${prefix}/include imo).

andrewrk commented 4 years ago

Yeah. What distro are you using? Debian? This is something the Debian package should set up. libsoundio shouldn't have to be aware of linux distributions, just the linux kernel.

Also this project is going to be converted to use the zig build system instead of cmake soon

KingDuckZ commented 4 years ago

I use Gentoo. Honestly I think it's a bit unreasonable to expect that each distro re-implements this. Be it a FindSoundio.cmake, soundio.pc or whatever, the logic to make it should be in one single place, not scattered across all distros. Most importantly, only the build systems holds all the information needed to generate such files.

For the sake of an example, at my previous job I had no root access and the systems were heavily locked down. In order to install packages I compiled them myself using something like ~/opt/ as the prefix. CMake etc all worked because ~/opt/usr/lib64/pkgconfig had all the paths set right by the respective makefiles and scripts that generated them - I didn't create .pc files manually one by one.

If you have a look around you'll see that most libraries generate those files (my own libraries too). You could make it optional but I think it's the build system's responsibility to create those.

Edit have a look at zlib, vorbis, theora, pugixml, portaudio, cairo, opencv... they all make one