diff options
author | OPNA2608 <opna2608@protonmail.com> | 2024-01-23 18:21:11 +0100 |
---|---|---|
committer | OPNA2608 <opna2608@protonmail.com> | 2024-02-21 19:32:42 +0100 |
commit | 7371ea36e7ebc0ff65fa75269ce9cb087e34f3de (patch) | |
tree | eb95eddeb69c8c16843c71d38da707f840e3e5b6 /pkgs/desktops | |
parent | 8421b4c5339ce0950b5904f9660998e29fd32544 (diff) |
lomiri.morph-browser: init at 1.0.3
Diffstat (limited to 'pkgs/desktops')
-rw-r--r-- | pkgs/desktops/lomiri/applications/morph-browser/default.nix | 134 | ||||
-rw-r--r-- | pkgs/desktops/lomiri/default.nix | 1 |
2 files changed, 135 insertions, 0 deletions
diff --git a/pkgs/desktops/lomiri/applications/morph-browser/default.nix b/pkgs/desktops/lomiri/applications/morph-browser/default.nix new file mode 100644 index 0000000000000..643609694804f --- /dev/null +++ b/pkgs/desktops/lomiri/applications/morph-browser/default.nix @@ -0,0 +1,134 @@ +{ stdenv +, lib +, fetchFromGitLab +, fetchpatch +, gitUpdater +, cmake +, content-hub +, gettext +, libapparmor +, lomiri-action-api +, lomiri-ui-extras +, lomiri-ui-toolkit +, pkg-config +, python3 +, qtbase +, qtdeclarative +, qtquickcontrols2 +, qtsystems +, qtwebengine +, wrapQtAppsHook +, xvfb-run +}: + +let + listToQtVar = suffix: lib.makeSearchPathOutput "bin" suffix; +in +stdenv.mkDerivation (finalAttrs: { + pname = "morph-browser"; + version = "1.0.3"; + + src = fetchFromGitLab { + owner = "ubports"; + repo = "development/core/morph-browser"; + rev = finalAttrs.version; + hash = "sha256-gzrNIIRTnIiL5T1HYy2x9mGawZwW6vhCt3b5k3NhpKI="; + }; + + 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 + qtquickcontrols2 + qtsystems + ]; + + nativeCheckInputs = [ + (python3.withPackages (ps: with ps; [ + flake8 + ])) + xvfb-run + ]; + + cmakeFlags = [ + (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [ + # Exclude tests + "-E" (lib.strings.escapeShellArg "(${lib.concatStringsSep "|" [ + # 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 { }; + + 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; + }; +}) diff --git a/pkgs/desktops/lomiri/default.nix b/pkgs/desktops/lomiri/default.nix index f62bd5746023f..1936e436f35fd 100644 --- a/pkgs/desktops/lomiri/default.nix +++ b/pkgs/desktops/lomiri/default.nix @@ -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 { }; |