You are not logged in.

#1 2017-06-07 09:48:27

gaelic
Member
Registered: 2010-08-01
Posts: 106

PKGBUILD - optdepends and ./configure|cmake adaptations

Hi there.

I'm wondering if there is a defined procedure on how to check within a PKGBUILD if a package defined in optdepends is installed or not ... and further change the options for configure or cmake accordingly (e.g. WITH_PROGRAM1=TRUE).

Thanks, g

Offline

#2 2017-06-07 10:11:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,531
Website

Re: PKGBUILD - optdepends and ./configure|cmake adaptations

There probably are creative ways to do this, but it most definitely should not be done.  If the software is built against a lib or with any WITH_PROGRAM1=TRUE then that program is no longer an optional dependency, it is a dependency.

You can detect what is present at build time and set the dependencies accordingly.  mpv-git does this.

The "optional" in optional dependencies refers to runtime not buildtime.  If the same built package will work fine without another tool but has added functionality with that other tool, then the other tool is an optional dependency.  However, the situation you describe is that your package needs to either be built against that other tool or not: so it's optional for you, the packager, to decide whether it's a dependency or not, but it cannot be an optional depednency in the package.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-06-07 13:02:20

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD - optdepends and ./configure|cmake adaptations

That is as optional as an Automagic Dependency.

The Arch Way is to enable as many features as possible via ./configure or whatever. If those features need a dependency for building, but at runtime can simply disable the feature if the dependency is not available, use makedepends for building and optdepends for runtime. For example vim can be built with support for various scripting languages, but doesn't actually link against them, instead using dlopen(3) to check if e.g. the python2 shared library is available and loading it if possible.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB