Merge pull request #303595 from OPNA2608/fix/lomiri-pkgconfig-files

lomiri.* Fix lack of output fixup in pkg-config files, update pkg-config calls with new CMake option
This commit is contained in:
Cosima Neidahl 2024-04-13 14:20:04 +02:00 committed by GitHub
commit 5ff628396c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 14 deletions

View File

@ -27,6 +27,12 @@ stdenv.mkDerivation (finalAttrs: {
"bin"
];
postPatch = ''
# For our automatic pkg-config output patcher to work, prefix must be used here
substituteInPlace headers/deviceinfo.pc.in \
--replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}'
'';
strictDeps = true;
nativeBuildInputs = [

View File

@ -44,12 +44,14 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
# pkg-config patching hook expects prefix variable
substituteInPlace data/trust-store.pc.in \
--replace 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
--replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}' \
--replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
substituteInPlace src/core/trust/terminal_agent.h \
--replace '/bin/whiptail' '${lib.getExe' newt "whiptail"}'
--replace-fail '/bin/whiptail' '${lib.getExe' newt "whiptail"}'
'' + lib.optionalString (!finalAttrs.doCheck) ''
sed -i CMakeLists.txt -e '/add_subdirectory(tests)/d'
substituteInPlace CMakeLists.txt \
--replace-fail 'add_subdirectory(tests)' ""
'';
strictDeps = true;

View File

@ -1,6 +1,7 @@
{ stdenv
, lib
, fetchFromGitLab
, fetchpatch
, gitUpdater
, testers
, cmake
@ -27,16 +28,30 @@ stdenv.mkDerivation (finalAttrs: {
"examples"
];
patches = [
# Fixes some issues with the pkg-config file
# Remove when https://gitlab.com/ubports/development/core/u1db-qt/-/merge_requests/7 merged & in release
(fetchpatch {
name = "0001-u1db-qt-Fix-pkg-config-files-includedir-variable.patch";
url = "https://gitlab.com/ubports/development/core/u1db-qt/-/commit/ddafbfadfad6dfc508a866835354a4701dda1fe1.patch";
hash = "sha256-entwjU9TiHuSuht7Cdl0k1v0cP7350a04/FXgTVhGmk=";
})
];
postPatch = ''
patchShebangs tests/strict-qmltestrunner.sh
# QMake query response is broken
# QMake query response is broken, just hardcode the expected location
substituteInPlace modules/U1db/CMakeLists.txt \
--replace "\''${QT_IMPORTS_DIR}" "$out/$qtQmlPrefix"
--replace-fail 'exec_program(''${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML"' 'exec_program(echo ARGS "''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"'
# For our automatic pkg-config output patcher to work, prefix must be used here
substituteInPlace libu1db-qt.pc.in \
--replace-fail 'libdir=''${exec_prefix}/lib' 'libdir=''${prefix}/lib'
'' + lib.optionalString (!finalAttrs.doCheck) ''
# Other locations add dependencies to custom check target from tests
substituteInPlace CMakeLists.txt \
--replace 'add_subdirectory(tests)' 'add_custom_target(check COMMAND "echo check dummy")'
--replace-fail 'add_subdirectory(tests)' 'add_custom_target(check COMMAND "echo check dummy")'
'';
strictDeps = true;
@ -57,8 +72,8 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = [
# Needs qdoc
"-DBUILD_DOCS=OFF"
# Needs qdoc, see https://github.com/NixOS/nixpkgs/pull/245379
(lib.cmakeBool "BUILD_DOCS" false)
];
dontWrapQtApps = true;

View File

@ -38,12 +38,17 @@ stdenv.mkDerivation (finalAttrs: {
];
postPatch = ''
# Uses pkg_get_variable, cannot substitute prefix with that
# Substitute systemd's prefix in pkg-config call
substituteInPlace data/CMakeLists.txt \
--replace 'pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)' 'set(SYSTEMD_SYSTEM_UNIT_DIR "''${CMAKE_INSTALL_PREFIX}/lib/systemd/system")'
--replace-fail 'pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)' 'pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})'
substituteInPlace src/biometry/qml/Biometryd/CMakeLists.txt \
--replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
--replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
# For our automatic pkg-config output patcher to work, prefix must be used here
substituteInPlace data/biometryd.pc.in \
--replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}' \
--replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}' \
'' + lib.optionalString (!finalAttrs.doCheck) ''
sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
'';

View File

@ -55,10 +55,16 @@ stdenv.mkDerivation (finalAttrs: {
];
postPatch = ''
# pkg_get_variable doesn't let us substitute prefix pkg-config variable from systemd
# Substitute systemd's prefix in pkg-config call
substituteInPlace CMakeLists.txt \
--replace 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'set(SYSTEMD_USER_DIR "${placeholder "out"}/lib/systemd/user")' \
--replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
--replace-fail 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})' \
--replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
# For our automatic pkg-config output patcher to work, prefix must be used here
substituteInPlace src/{common/public,downloads/client,downloads/common,uploads/common}/*.pc.in \
--replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}'
substituteInPlace src/downloads/client/lomiri-download-manager-client.pc.in \
--replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
'';
strictDeps = true;