Merge pull request #262433 from OPNA2608/init/lomiri/morph-browser

lomiri.morph-browser: init at 1.1.0
This commit is contained in:
Peder Bergebakken Sundt 2024-02-22 18:34:55 +01:00 committed by GitHub
commit b775c0299d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 194 additions and 0 deletions

View File

@ -539,6 +539,7 @@ in {
mongodb = handleTest ./mongodb.nix {};
moodle = handleTest ./moodle.nix {};
moonraker = handleTest ./moonraker.nix {};
morph-browser = handleTest ./morph-browser.nix { };
morty = handleTest ./morty.nix {};
mosquitto = handleTest ./mosquitto.nix {};
moosefs = handleTest ./moosefs.nix {};

View File

@ -0,0 +1,53 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "morph-browser-standalone";
meta.maintainers = lib.teams.lomiri.members;
nodes.machine = { config, pkgs, ... }: {
imports = [
./common/x11.nix
];
services.xserver.enable = true;
environment = {
systemPackages = with pkgs.lomiri; [
suru-icon-theme
morph-browser
];
variables = {
UITK_ICON_THEME = "suru";
};
};
i18n.supportedLocales = [ "all" ];
fonts.packages = with pkgs; [
# Intended font & helps with OCR
ubuntu_font_family
];
};
enableOCR = true;
testScript =
''
machine.wait_for_x()
with subtest("morph browser launches"):
machine.execute("morph-browser >&2 &")
machine.wait_for_text(r"Web Browser|New|sites|Bookmarks")
machine.screenshot("morph_open")
with subtest("morph browser displays HTML"):
machine.send_chars("file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html\n")
machine.wait_for_text("Valgrind Documentation")
machine.screenshot("morph_htmlcontent")
machine.succeed("pkill -f morph-browser")
with subtest("morph browser localisation works"):
machine.execute("env LANG=de_DE.UTF-8 morph-browser >&2 &")
machine.wait_for_text(r"Web-Browser|Neuer|Seiten|Lesezeichen")
machine.screenshot("morph_localised")
'';
})

View File

@ -0,0 +1,139 @@
{ stdenv
, lib
, fetchFromGitLab
, fetchpatch
, gitUpdater
, nixosTests
, cmake
, content-hub
, gettext
, libapparmor
, lomiri-action-api
, lomiri-ui-extras
, lomiri-ui-toolkit
, pkg-config
, qqc2-suru-style
, qtbase
, qtdeclarative
, qtquickcontrols2
, qtsystems
, qtwebengine
, wrapQtAppsHook
, xvfb-run
}:
let
listToQtVar = suffix: lib.makeSearchPathOutput "bin" suffix;
in
stdenv.mkDerivation (finalAttrs: {
pname = "morph-browser";
version = "1.1.0";
src = fetchFromGitLab {
owner = "ubports";
repo = "development/core/morph-browser";
rev = finalAttrs.version;
hash = "sha256-C5iXv8VS8Mm1ryxK7Vi5tVmiM01OSIFiTyH0vP9B/xA=";
};
patches = [
# Remove when https://gitlab.com/ubports/development/core/morph-browser/-/merge_requests/575 merged & in release
(fetchpatch {
name = "0001-morph-browser-tst_SessionUtilsTests-Set-permissions-on-temporary-xdg-runtime-directory.patch";
url = "https://gitlab.com/ubports/development/core/morph-browser/-/commit/e90206105b8b287fbd6e45ac37ca1cd259981928.patch";
hash = "sha256-5htFn+OGVVBn3mJQaZcF5yt0mT+2QRlKyKFesEhklfA=";
})
# Remove when https://gitlab.com/ubports/development/core/morph-browser/-/merge_requests/576 merged & in release
(fetchpatch {
name = "0002-morph-browser-Call-i18n-bindtextdomain-with-buildtime-determined-locale-path.patch";
url = "https://gitlab.com/ubports/development/core/morph-browser/-/commit/0527a1e01fb27c62f5e0011274f73bad400e9691.patch";
hash = "sha256-zx/pP72uNqAi8TZR4bKeONuqcJyK/vGtPglTA+5R5no=";
})
];
postPatch = ''
substituteInPlace src/{Morph,Ubuntu}/CMakeLists.txt \
--replace '/usr/lib/''${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml' "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
# Don't use absolute paths in desktop file
substituteInPlace src/app/webbrowser/morph-browser.desktop.in.in \
--replace 'Icon=@CMAKE_INSTALL_FULL_DATADIR@/morph-browser/morph-browser.svg' 'Icon=morph-browser' \
--replace 'X-Lomiri-Splash-Image=@CMAKE_INSTALL_FULL_DATADIR@/morph-browser/morph-browser-splash.svg' 'X-Lomiri-Splash-Image=lomiri-app-launch/splash/morph-browser.svg'
'' + lib.optionalString (!finalAttrs.doCheck) ''
substituteInPlace CMakeLists.txt \
--replace 'add_subdirectory(tests)' ""
'';
strictDeps = true;
nativeBuildInputs = [
cmake
gettext
pkg-config
wrapQtAppsHook
];
buildInputs = [
libapparmor
qtbase
qtdeclarative
qtwebengine
# QML
content-hub
lomiri-action-api
lomiri-ui-extras
lomiri-ui-toolkit
qqc2-suru-style
qtquickcontrols2
qtsystems
];
nativeCheckInputs = [
xvfb-run
];
cmakeFlags = [
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [
# Exclude tests
"-E" (lib.strings.escapeShellArg "(${lib.concatStringsSep "|" [
# Don't care about linter failures
"^flake8"
# Runs into ShapeMaterial codepath in lomiri-ui-toolkit which needs OpenGL, see LUITK for details
"^tst_QmlTests"
]})")
]))
];
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
preCheck = ''
export HOME=$TMPDIR
export QT_PLUGIN_PATH=${listToQtVar qtbase.qtPluginPrefix [ qtbase ]}
export QML2_IMPORT_PATH=${listToQtVar qtbase.qtQmlPrefix ([ lomiri-ui-toolkit qtwebengine qtdeclarative qtquickcontrols2 qtsystems ] ++ lomiri-ui-toolkit.propagatedBuildInputs)}
'';
postInstall = ''
mkdir -p $out/share/{icons/hicolor/scalable/apps,lomiri-app-launch/splash}
ln -s $out/share/{morph-browser,icons/hicolor/scalable/apps}/morph-browser.svg
ln -s $out/share/{morph-browser/morph-browser-splash.svg,lomiri-app-launch/splash/morph-browser.svg}
'';
passthru = {
updateScript = gitUpdater { };
tests.standalone = nixosTests.morph-browser;
};
meta = with lib; {
description = "Lightweight web browser tailored for Ubuntu Touch";
homepage = "https://gitlab.com/ubports/development/core/morph-browser";
changelog = "https://gitlab.com/ubports/development/core/morph-browser/-/blob/${finalAttrs.version}/ChangeLog";
license = with licenses; [ gpl3Only cc-by-sa-30 ];
mainProgram = "morph-browser";
maintainers = teams.lomiri.members;
platforms = platforms.linux;
};
})

View File

@ -9,6 +9,7 @@ let
in {
#### Core Apps
lomiri-terminal-app = callPackage ./applications/lomiri-terminal-app { };
morph-browser = callPackage ./applications/morph-browser { };
#### Data
lomiri-schemas = callPackage ./data/lomiri-schemas { };