lomiri.lomiri-url-dispatcher: Split library into separate output (#351228)

This commit is contained in:
Cosima Neidahl 2024-10-31 23:11:46 +01:00 committed by GitHub
commit 769a6a5661
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,31 +1,32 @@
{ stdenv
, lib
, fetchFromGitLab
, fetchpatch
, gitUpdater
, testers
, cmake
, cmake-extras
, dbus
, dbus-test-runner
, glib
, gtest
, intltool
, json-glib
, libapparmor
, libxkbcommon
, lomiri-app-launch
, lomiri-ui-toolkit
, makeWrapper
, pkg-config
, python3
, qtbase
, qtdeclarative
, qtwayland
, runtimeShell
, sqlite
, systemd
, wrapQtAppsHook
{
stdenv,
lib,
fetchFromGitLab,
fetchpatch,
gitUpdater,
testers,
cmake,
cmake-extras,
dbus,
dbus-test-runner,
glib,
gtest,
intltool,
json-glib,
libapparmor,
libxkbcommon,
lomiri-app-launch,
lomiri-ui-toolkit,
makeWrapper,
pkg-config,
python3,
qtbase,
qtdeclarative,
qtwayland,
runtimeShell,
sqlite,
systemd,
wrapQtAppsHook,
}:
stdenv.mkDerivation (finalAttrs: {
@ -42,6 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
outputs = [
"out"
"dev"
"lib"
];
patches = [
@ -51,21 +53,33 @@ stdenv.mkDerivation (finalAttrs: {
url = "https://gitlab.com/sunweaver/lomiri-url-dispatcher/-/commit/ebdd31b9640ca243e90bc7b8aca7951085998bd8.patch";
hash = "sha256-g4EohB3oDcWK4x62/3r/g6CFxqb7/rdK51+E/Fji1Do=";
})
# Make lomiri-url-dispatcher-gui wrappable
# Remove when https://gitlab.com/ubports/development/core/lomiri-url-dispatcher/-/merge_requests/28 merged & in release
(fetchpatch {
url = "https://gitlab.com/ubports/development/core/lomiri-url-dispatcher/-/commit/6512937e2b388ad1350072b8ed3b4140439b2321.patch";
hash = "sha256-P1A3hi8l7fJWFjGeK5hWYl8BoZMzRfo44MUTeM7vG2A=";
})
];
postPatch = ''
substituteInPlace data/CMakeLists.txt \
--replace "\''${SYSTEMD_USER_UNIT_DIR}" "\''${CMAKE_INSTALL_LIBDIR}/systemd/user"
postPatch =
''
substituteInPlace CMakeLists.txt \
--replace-fail 'pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)' 'pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})' \
substituteInPlace tests/url_dispatcher_testability/CMakeLists.txt \
--replace "\''${PYTHON_PACKAGE_DIR}" "$out/${python3.sitePackages}"
substituteInPlace gui/lomiri-url-dispatcher-gui.desktop.in.in \
--replace-fail '@CMAKE_INSTALL_FULL_DATADIR@/lomiri-url-dispatcher/gui/lomiri-url-dispatcher-gui.svg' 'lomiri-url-dispatcher-gui'
# Update URI handler database whenever new url-handler is installed system-wide
substituteInPlace data/lomiri-url-dispatcher-update-system-dir.*.in \
--replace '@CMAKE_INSTALL_FULL_DATAROOTDIR@' '/run/current-system/sw/share'
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
patchShebangs tests/test-sql.sh
'';
substituteInPlace tests/url_dispatcher_testability/CMakeLists.txt \
--replace-fail "\''${PYTHON_PACKAGE_DIR}" "$out/${python3.sitePackages}"
# Update URI handler database whenever new url-handler is installed system-wide
substituteInPlace data/lomiri-url-dispatcher-update-system-dir.*.in \
--replace-fail '@CMAKE_INSTALL_FULL_DATAROOTDIR@' '/run/current-system/sw/share'
''
+ lib.optionalString finalAttrs.finalPackage.doCheck ''
patchShebangs tests/test-sql.sh
'';
strictDeps = true;
@ -75,11 +89,16 @@ stdenv.mkDerivation (finalAttrs: {
intltool
makeWrapper
pkg-config
(python3.withPackages (ps: with ps; [
setuptools
] ++ lib.optionals finalAttrs.finalPackage.doCheck [
python-dbusmock
]))
(python3.withPackages (
ps:
with ps;
[
setuptools
]
++ lib.optionals finalAttrs.finalPackage.doCheck [
python-dbusmock
]
))
wrapQtAppsHook
];
@ -104,8 +123,8 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = [
"-DLOCAL_INSTALL=ON"
"-Denable_mirclient=OFF"
(lib.cmakeBool "LOCAL_INSTALL" true)
(lib.cmakeBool "enable_mirclient" false)
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
@ -116,34 +135,25 @@ stdenv.mkDerivation (finalAttrs: {
dontWrapQtApps = true;
preFixup = ''
substituteInPlace $out/bin/lomiri-url-dispatcher-dump \
--replace '/bin/sh' '${runtimeShell}'
substituteInPlace $out/bin/lomiri-url-dispatcher-{dump,gui} \
--replace-fail '/bin/sh' '${runtimeShell}'
wrapProgram $out/bin/lomiri-url-dispatcher-dump \
--prefix PATH : ${lib.makeBinPath [ sqlite ]}
# Move from qmlscene call in desktop file to easier-to-wrap script
guiScript=$out/bin/lomiri-url-dispatcher-gui
guiExec=$(grep 'Exec=' $out/share/applications/lomiri-url-dispatcher-gui.desktop | cut -d'=' -f2-)
cat <<EOF >$guiScript
#!${runtimeShell}
$guiExec
EOF
chmod +x $guiScript
mkdir -p $out/share/icons/hicolor/scalable/apps
ln -s $out/share/lomiri-url-dispatcher/gui/lomiri-url-dispatcher-gui.svg $out/share/icons/hicolor/scalable/apps/
substituteInPlace $out/share/applications/lomiri-url-dispatcher-gui.desktop \
--replace "Exec=$guiExec" "Exec=$(basename $guiScript)" \
--replace "Icon=$out/share/lomiri-url-dispatcher/gui/lomiri-url-dispatcher-gui.svg" "Icon=lomiri-url-dispatcher-gui"
# Calls qmlscene from PATH, needs Qt plugins & QML components
qtWrapperArgs+=(
--prefix PATH : ${lib.makeBinPath [ qtdeclarative.dev ]}
)
wrapQtApp $guiScript
wrapQtApp $out/bin/lomiri-url-dispatcher-gui
'';
postFixup = ''
moveToOutput share $out
moveToOutput libexec $out
'';
passthru = {
@ -151,17 +161,20 @@ stdenv.mkDerivation (finalAttrs: {
updateScript = gitUpdater { };
};
meta = with lib; {
meta = {
description = "Lomiri operating environment service for requesting URLs to be opened";
longDescription = ''
Allows applications to request a URL to be opened and handled by another
process without seeing the list of other applications on the system or
starting them inside its own Application Confinement.
Allows applications to request a URL to be opened and handled by another
process without seeing the list of other applications on the system or
starting them inside its own Application Confinement.
'';
homepage = "https://gitlab.com/ubports/development/core/lomiri-url-dispatcher";
license = with licenses; [ lgpl3Only gpl3Only ];
maintainers = teams.lomiri.members;
platforms = platforms.linux;
license = with lib.licenses; [
lgpl3Only
gpl3Only
];
maintainers = lib.teams.lomiri.members;
platforms = lib.platforms.linux;
pkgConfigModules = [
"lomiri-url-dispatcher"
];