Skip to content

buildsystem: liblc: rework lua link flag

Description

Rework the lua link flag, previously being -llua added to the ndk-build LDFLAGS, so that it doesn't silently make a special case out of lua.

This PR also refactor pkg-config usage behind a bash function, so as to ensure the correct execution environment for pkg-config, and prevent the usage of system pkg-config files to be able to use it for the main point of this PR.

Motivation and Context

In the normal case, contribs like lua should be added to the LDFLAGS via the probing of their contrib pkg-config files. In version libVLC 3.x, lua contrib doesn't export a pkg-config file and such hack was needed to have it linked in the end. It will be fixed in libVLC 4.x, which would expose a liblua$(LUA_VERSION).a library and a liblua.pc and liblua$(LUA_VERSION).pc files.

Thus, moving the hack out of the LDFLAGS and conditionnally adding liblua.a depending on the result of pkg-config probing provides compatibility between the two version, and it makes it clear that the hack with lua can go away as soon as the pkg-config file is also available on libVLC 3.x or whenever this repository switch to using libVLC 4.x by default.

Note that the pkg-config files are not available yet on libVLC 4.x since they cannot be merged without this PR being merged.

How Has This Been Tested?

Build libVLC-jni on 3.x and 4.x.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which cleans up / improves existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the CONTRIBUTING section of the README document.

Merge request reports