Skip to content
  • Ralf Habacker's avatar
    cmake: Optionally create relocatable dbus-1.pc file · 21662782
    Ralf Habacker authored
    Relocatable pkgconfig files are necessary when using packages installed to
    a location that does not match the location for which they were compiled.
    
    However, using ${pcfiledir} is problematic for system installations
    in standard locations, because it interferes with pkg-config's
    ability to filter out -I, -L options that are redundant with compiler
    defaults (which is important if you are trying to use a newer version
    of a library than the system copy).
    
    In practice operating system vendors installing dbus to standard
    locations use Autotools, so we enable relocatable builds by default
    when building with CMake.
    
    For simplicity, we're also not relocatable if the library directory
    is something more complicated than lib or lib64 (e.g. under Debian
    multiarch); we don't want to have to compute how many ../ to add.
    This is non-trivial to determine in an Autotools build, so for now
    there is no support for relocation when built with Autotools,
    even as an opt-in feature.
    
    Going via the ${original_prefix} variable is because under Autotools,
    both ${prefix} and ${exec_prefix} technically default to NONE, with
    NONE replaced with their real defaults of /usr/local and '${prefix}'
    (respectively) later on. If we tried to expand ${prefix} at the time
    that we choose the value of ${pkgconfig_prefix}, that would cause
    a broken value "prefix=NONE" to be hard-coded.
    
    [smcv: no relocation on Autotools, make it optional in CMake,
    expand commit message]
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721
    
    
    Reviewed-by: default avatarSimon McVittie <smcv@collabora.com>
    Reviewed-by: default avatarRalf Habacker <ralf.habacker@freenet.de>
    Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
    21662782