roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

Generate and install pkg-config file #271

Closed gavv closed 4 years ago

gavv commented 5 years ago

scons install should generate and install a libroc.pc file for pkg-config.

The file contents should be something like:

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=${prefix}/include

Name: libroc
Requires: libuv libunwind
Version: 0.1.3
Description: Real-time audio streaming over the network.
URL: https://roc-project.github.io

Libs: -L${libdir} -lroc -lrt -lpthread -lnsl -ldl -lm
Cflags: -I${includedir}

But paths (/usr, /usr/lib64), version (0.1.3), and dependencies (libuv libunwind) should be generated dynamically according to the .version file, installation prefix, and enabled dependencies. All this info is already available inside scons.

The file itself should be installed accordingly to the installation prefix and pkg-config default path. On my system it is /usr/lib64/pkgconfig.

The generation function should be added somewhere under site_scons/site_tools/roc. This is our scons plugin which provided various helpers.

This task is needed for our Go bindings: https://github.com/roc-project/roc-go/issues/4

fusuiyi123 commented 4 years ago

if I understand correctly, we need to create a libroc.pc file in PKG_CONFIG_PATH and prefix, libdir requires are from scons options --prefix=PREFIX, --libdir=LIBDIR, not sure where do we get enabled dependencies, is it https://github.com/roc-project/roc/blob/master/SConstruct#L732 ? Thanks!

fusuiyi123 commented 4 years ago

and it's just writing a file to a path like /usr/lib64/pkgconfig not AddDistFile which is installing a target library..?

gavv commented 4 years ago

if I understand correctly, we need to create a libroc.pc file in PKG_CONFIG_PATH and prefix, libdir requires are from scons options --prefix=PREFIX, --libdir=LIBDIR

Yes.

not sure where do we get enabled dependencies, is it https://github.com/roc-project/roc/blob/master/SConstruct#L732 ?

Yes. We should add dependencies which are:

and it's just writing a file to a path like /usr/lib64/pkgconfig not AddDistFile which is installing a target library..?

I think we should add an AlwaysBuild action that generates libroc.pc file somewhere in the build directory and then add this file to the install target using AddDistFile()

fusuiyi123 commented 4 years ago

thank you, I sent a pr #347

gavv commented 4 years ago

Merged.