[aur-general] How to pkg-config (Was: TU application: Daurnimator)

Daurnimator quae at daurnimator.com
Tue Dec 18 02:28:29 UTC 2018


On Mon, 17 Dec 2018 at 16:40, Eli Schwartz <eschwartz at archlinux.org> wrote:
> If you take a closer look at the manual page for pkg-config, it actually
> says the exact opposite, defining "--libs" as "linker flags". In fact,
> there are even three dedicated *subvariants* to get, depending on your
> highly customized needs,
>
> --libs-only-L
> --libs-only-l
> --libs-only-other
>
> This is clearly a case of libs-only-other.

Ah ha! I didn't know about these.
--libs-only-other seems to be missing from
https://linux.die.net/man/1/pkg-config
However according to
https://bz.apache.org/bugzilla/show_bug.cgi?id=46168 they're available
since 2003

------------------------------

Does this sound like a reasonable proposal then?:
The .pc should contain:

```
V=5.3
R=${V}.5

prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
LIB=lua
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Cflags: -I${includedir}
Libs: -L${libdir} -l${LIB}
Libs.private: -lm -Wl,-E
```

If you're compiling a application that dynamically embeds lua then you'd use:
CFLAGS="$(pkgconf lua --cflags)"  LDFLAGS="$(pkgconf lua --libs)"

If you're compiling a application that statically embeds lua then you'd use:
CFLAGS="$(pkgconf lua --cflags --static)"  LDFLAGS="$(pkgconf lua
--libs --static)"

If you're compiling a lua library dynamically then your makefile would use
CFLAGS+="$(shell pkgconf lua --cflags)"
Your .so file should be installed to
$(DESTDIR)/$(shell pkgconf lua --variable=INSTALL_CMOD)

If you're compiling a lua library statically then your makefile would use
CFLAGS+="$(shell pkgconf lua --cflags --static)"
Your .so file should be installed to
$(DESTDIR)/$(libdir)


With no use of LDFLAGS for the last two cases.


Now to come up with a migration story:
  - existing distributions do not currently supply
-Wl,--export-dynamic in their pkg-config files
  - existing projects do not know to use pkg-config with lua in this manner.

If upstream started shipping an adjusted pkg-config file, best case it
would only be available for the 5.4 release.


More information about the aur-general mailing list