libnatpmp
libnatpmp copied to clipboard
Add natpmp.pc.in (pkg-config)
Hi,
To discover libraries, various systems uses pkg-config. For now, libnatpmp is not discoverable with this method.
pkg-config --libs natpmp
Package natpmp was not found in the pkg-config search path.
Perhaps you should add the directory containing `natpmp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'natpmp' found
the Makefile creates and installs natpmp.pc, now it really depends on how you install it
Distros install to a certain dir with make DESTDIR=xxx install, this doesn't work as expected in libnatpmp, only the .pc file is installed where it should, all the other files are installed to the system
INSTALLPREFIX ?= $(PREFIX)/usr
This is the DESTDIR = INSTALLPREFIX, fixing this issue is easy but may confuse people
If you want a standard behavior, the CMake stuff now implements (almost everything)
natpmp.pc.in was created, it's the input file for cmake to replace strings, that's probably what you want to use then
So both cmake & the Makefile (not cmake) create natpmp.pc in different ways, but the contents are essentially the same
the Makefile creates and installs natpmp.pc, now it really depends on how you install it
@wdlkmpx How? Using the release from https://miniupnp.tuxfamily.org/files/libnatpmp-20230423.tar.gz, I don't see any .pc or .pc.in file in it, and installing with 'make install INSTALLPREFIX=$MY_PREFIX' doesn't install any .pc file to anywhere under $MY_PREFIX.
https://github.com/miniupnp/libnatpmp/blob/master/natpmp.pc.in
That seems to be installed only since recently, and for the CMake build system, right?
I just tested it; the .pc is installed correctly with CMake, but it seems the version it gets from CMake is outdated; it comes from:
https://github.com/miniupnp/libnatpmp/blob/master/VERSION
and is currently defined to 20120821:
$ cat /gnu/store/a7nhb5ylp36mh6j1716if9hk7lamw5b5-libnatpmp-20230423-0.6a850fd/lib/pkgconfig/natpmp.pc
prefix=/gnu/store/a7nhb5ylp36mh6j1716if9hk7lamw5b5-libnatpmp-20230423-0.6a850fd
exec_prefix=${prefix}
libdir=/gnu/store/a7nhb5ylp36mh6j1716if9hk7lamw5b5-libnatpmp-20230423-0.6a850fd/lib
includedir=/gnu/store/a7nhb5ylp36mh6j1716if9hk7lamw5b5-libnatpmp-20230423-0.6a850fd/include
Name: libnatpmp
Description: NAT-PMP client library
Version: 20120821
Libs: -L${libdir} -lnatpmp
Cflags: -I${includedir}