Skip to content

build: Fix handling of datadir, etc. as absolute paths

Calvin Walton requested to merge kepstin/tracker:meson-abs-dirs into master

There were several places in the meson files where path building was done incorrectly, which causes breakage when some directories are passed as absolute paths; for example on Exherbo we use -Dprefix=/usr/x86_64-pc-linux-gnu -Ddatadir=/usr/share in our cross-prefix configuration.

There's two classes of errors that I've fixed here:

  • Incorrect use of the / operator. The / operator is the correct operator to use when building paths, since it has special handling for absolute paths. If the right hand side of the operator is an absolute path, then it is returned; the left hand side is discarded. But there are some places in tracker where the left side of the / operator was not a path, for example in pkgconfig "variables", which resulted in an error from meson when the string no longer matched the right pattern. This is fixed by accounting for order of operations.

  • Assuming that directory arguments are relative paths, and using them in string concatenation. The settings for LOCALEDIR and SHAREDIR were built by concatenating the prefix and specific dir variables with a / in between, which failed with absolute paths. Switch them to use the / operator, and the set_quoted function to avoid needing any string formatting.

While I was fixing these problems, I also noticed that the tracker-testutils pc file was using absolute paths for the python_path and command variables (rather than substituting in the ${prefix} or ${libdir} variables), which meant that it wasn't relocatable. I have fixed that.

The corresponding changes to tracker-miners are in tracker-miners!455 (merged)

Edited by Calvin Walton

Merge request reports