Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lomiri: init basic development stuff #236282

Merged
merged 11 commits into from
Jul 5, 2023
9 changes: 9 additions & 0 deletions maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ with lib.maintainers; {
enableFeatureFreezePing = true;
};

lomiri = {
members = [
OPNA2608
];
scope = "Maintain Lomiri desktop environment and related packages.";
shortName = "Lomiri";
enableFeatureFreezePing = true;
};

lumiguide = {
# Verify additions by approval of an already existing member of the team.
members = [
Expand Down
16 changes: 16 additions & 0 deletions pkgs/desktops/lomiri/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ lib
, pkgs
, libsForQt5
}:

let
packages = self: let
inherit (self) callPackage;
in {
#### Development tools / libraries
cmake-extras = callPackage ./development/cmake-extras { };
gmenuharness = callPackage ./development/gmenuharness { };
lomiri-api = callPackage ./development/lomiri-api { };
};
in
lib.makeScope libsForQt5.newScope packages
49 changes: 49 additions & 0 deletions pkgs/desktops/lomiri/development/cmake-extras/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ stdenvNoCC
, lib
, fetchFromGitLab
, cmake
, qtbase
}:

stdenvNoCC.mkDerivation {
pname = "cmake-extras";
version = "unstable-2022-11-21";

src = fetchFromGitLab {
owner = "ubports";
repo = "development/core/cmake-extras";
rev = "99aab4514ee182cb7a94821b4b51e4d8cb9a82ef";
hash = "sha256-axj5QxgDrHy0HiZkfrbm22hVvSCKkWFoQC8MdQMm9tg=";
};

postPatch = ''
# We have nothing to build here, no need to depend on a C compiler
substituteInPlace CMakeLists.txt \
--replace 'project(cmake-extras)' 'project(cmake-extras NONE)'

# This is in a function that reverse dependencies use to determine where to install their files to
substituteInPlace src/QmlPlugins/QmlPluginsConfig.cmake \
--replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
'';

strictDeps = true;

# Produces no binaries
dontWrapQtApps = true;

nativeBuildInputs = [
cmake
];

buildInputs = [
qtbase
];

meta = with lib; {
description = "A collection of add-ons for the CMake build tool";
homepage = "https://gitlab.com/ubports/development/core/cmake-extras/";
license = licenses.gpl3Only;
maintainers = teams.lomiri.members;
platforms = platforms.all;
};
}
96 changes: 96 additions & 0 deletions pkgs/desktops/lomiri/development/gmenuharness/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{ stdenv
, lib
, fetchFromGitLab
, fetchpatch
, gitUpdater
, testers
, cmake
, cmake-extras
, dbus
, dbus-test-runner
, glib
, gtest
, libqtdbustest
, lomiri-api
, pkg-config
, qtbase
}:

stdenv.mkDerivation (finalAttrs: {
pname = "gmenuharness";
version = "0.1.4";

src = fetchFromGitLab {
owner = "ubports";
repo = "development/core/gmenuharness";
rev = finalAttrs.version;
hash = "sha256-MswB8cQvz3JvcJL2zj7szUOBzKRjxzJO7/x+87m7E7c=";
};

patches = [
# Remove when version > 0.1.4
(fetchpatch {
name = "0001-gmenuharness-Rename-type-attribute-from-x-canonical-type-to-x-lomiri-type.patch";
url = "https://gitlab.com/ubports/development/core/gmenuharness/-/commit/70e9ed85792a6ac1950faaf26391ce91e69486ab.patch";
hash = "sha256-jeue0qrl2JZCt/Yfj4jT210wsF/E+MlbtNT/yFTcw5I=";
})
];

strictDeps = true;

nativeBuildInputs = [
cmake
pkg-config
];

buildInputs = [
cmake-extras
glib
lomiri-api
qtbase
];

nativeCheckInputs = [
dbus
dbus-test-runner
];

checkInputs = [
gtest
libqtdbustest
];

cmakeFlags = [
"-Denable_tests=${lib.boolToString finalAttrs.doCheck}"
];

dontWrapQtApps = true;

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

enableParallelChecking = false;

checkPhase = ''
runHook preCheck

dbus-test-runner -t make -p test -p "''${enableParallelChecking:+-j $NIX_BUILD_CORES}"

runHook postCheck
'';

passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
updateScript = gitUpdater { };
};

meta = with lib; {
description = "Library to test GMenuModel structures";
homepage = "https://gitlab.com/ubports/development/core/gmenuharness";
license = licenses.gpl3Only;
maintainers = teams.lomiri.members;
platforms = platforms.unix;
pkgConfigModules = [
"libgmenuharness"
];
};
})
106 changes: 106 additions & 0 deletions pkgs/desktops/lomiri/development/lomiri-api/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{ stdenv
, lib
, fetchFromGitLab
, gitUpdater
, makeFontsConf
, testers
, cmake
, cmake-extras
, dbus
, doxygen
, glib
, graphviz
, gtest
, libqtdbustest
, pkg-config
, python3
, qtbase
, qtdeclarative
}:

stdenv.mkDerivation (finalAttrs: {
pname = "lomiri-api";
version = "0.2.1";

src = fetchFromGitLab {
owner = "ubports";
repo = "development/core/lomiri-api";
rev = finalAttrs.version;
hash = "sha256-UTl0vObSlEvHuLmDt7vS3yEqZWGklJ9tVwlUAtRSTlU=";
};

outputs = [ "out" "dev" "doc" ];

postPatch = ''
patchShebangs $(find test -name '*.py')

substituteInPlace data/*.pc.in \
--replace "\''${prefix}/@CMAKE_INSTALL_LIBDIR@" "\''${prefix}/lib"

# Variable is queried via pkg-config by reverse dependencies
# TODO This is likely not supposed to be the regular Qt QML import prefix
# but otherwise i.e. lomiri-notifications cannot be found in lomiri
substituteInPlace CMakeLists.txt \
--replace 'SHELL_PLUGINDIR ''${CMAKE_INSTALL_LIBDIR}/lomiri/qml' 'SHELL_PLUGINDIR ${qtbase.qtQmlPrefix}'
'';

strictDeps = true;

nativeBuildInputs = [
cmake
doxygen
graphviz
pkg-config
];

buildInputs = [
cmake-extras
glib
gtest
libqtdbustest
qtbase
qtdeclarative
];

nativeCheckInputs = [
dbus
python3
];

dontWrapQtApps = true;

FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };

preBuild = ''
# Makes fontconfig produce less noise in logs
export HOME=$TMPDIR
'';

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

preCheck = ''
# needs minimal plugin and QtTest QML
export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
export QML2_IMPORT_PATH=${lib.getBin qtdeclarative}/${qtbase.qtQmlPrefix}
'';

passthru = {
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
updateScript = gitUpdater { };
};

meta = with lib; {
description = "Lomiri API Library for integrating with the Lomiri shell";
homepage = "https://gitlab.com/ubports/development/core/lomiri-api";
license = with licenses; [ lgpl3Only gpl3Only ];
maintainers = teams.lomiri.members;
platforms = platforms.linux;
pkgConfigModules = [
"liblomiri-api"
"lomiri-shell-api"
"lomiri-shell-application"
"lomiri-shell-launcher"
"lomiri-shell-notifications"
];
};
})
93 changes: 93 additions & 0 deletions pkgs/development/libraries/libqtdbusmock/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{ stdenv
, lib
, fetchbzr
, testers
, cmake
, cmake-extras
, dbus
, dbus-test-runner
, gtest
, libqtdbustest
, networkmanager
, pkg-config
, procps
, python3
, qtbase
}:

stdenv.mkDerivation (finalAttrs: {
pname = "libqtdbusmock";
version = "unstable-2017-03-16";

src = fetchbzr {
url = "lp:libqtdbusmock";
rev = "49";
sha256 = "sha256-q3jL8yGLgcNxXHPh9M9cTVtUvonrBUPNxuPJIvu7Q/s=";
};

postPatch = ''
# Look for the new(?) name
substituteInPlace CMakeLists.txt \
--replace 'NetworkManager' 'libnm'

# Workaround for "error: expected unqualified-id before 'public'" on "**signals"
sed -i -e '/add_definitions/a -DQT_NO_KEYWORDS' CMakeLists.txt
'' + lib.optionalString (!finalAttrs.doCheck) ''
# Don't build tests when we're not running them
sed -i -e '/add_subdirectory(tests)/d' CMakeLists.txt
'';

strictDeps = true;

nativeBuildInputs = [
cmake
pkg-config
];

buildInputs = [
cmake-extras
libqtdbustest
networkmanager
qtbase
];

nativeCheckInputs = [
dbus
dbus-test-runner
procps
(python3.withPackages (ps: with ps; [
python-dbusmock
]))
];

checkInputs = [
gtest
];

dontWrapQtApps = true;

doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

enableParallelChecking = false;

checkPhase = ''
runHook preCheck

dbus-test-runner -t make -p test -p "''${enableParallelChecking:+-j $NIX_BUILD_CORES}"

runHook postCheck
'';

passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;

meta = with lib; {
description = "Library for mocking DBus interactions using Qt";
homepage = "https://launchpad.net/libqtdbusmock";
license = licenses.lgpl3Only;
platforms = platforms.unix;
maintainers = teams.lomiri.members;
pkgConfigModules = [
"libqtdbusmock-1"
];
};
})
Loading