1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

lomiri.morph-browser: init at 1.0.3

This commit is contained in:
OPNA2608 2024-01-23 18:21:11 +01:00
parent 8421b4c533
commit 7371ea36e7
2 changed files with 135 additions and 0 deletions

View file

@ -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;
};
})

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 { };