libnatpmp icon indicating copy to clipboard operation
libnatpmp copied to clipboard

Add natpmp.pc.in (pkg-config)

Open AmarOk1412 opened this issue 2 years ago • 6 comments

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

AmarOk1412 avatar May 19 '23 13:05 AmarOk1412

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

wdlkmpx avatar Jun 18 '23 18:06 wdlkmpx

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

wdlkmpx avatar Jun 18 '23 18:06 wdlkmpx

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.

Apteryks avatar Aug 18 '23 05:08 Apteryks

https://github.com/miniupnp/libnatpmp/blob/master/natpmp.pc.in

miniupnp avatar Aug 20 '23 13:08 miniupnp

That seems to be installed only since recently, and for the CMake build system, right?

Apteryks avatar Aug 21 '23 02:08 Apteryks

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}

Apteryks avatar Aug 21 '23 03:08 Apteryks