Unverified Commit e76cc993 authored by Marcin Serwin's avatar Marcin Serwin Committed by GitHub
Browse files

mtkclient: 2.1.2 -> 2.1.4.1 (+ udev, desktop item) (#497644)

parents 728629d3 03cb46a6
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
{
  lib,
  copyDesktopItems,
  fetchFromGitHub,
  gcc-arm-embedded,
  makeDesktopItem,
  python3Packages,
  udevCheckHook,
}:

python3Packages.buildPythonApplication rec {
  pname = "mtkclient";
  version = "2.1.2";
  version = "2.1.4.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bkerler";
    repo = "mtkclient";
    rev = "v${version}";
    hash = "sha256-mbfuOYJvwHfDvjTtAgMBLi7REIRRcJ9bhkY5oVjxCAM=";
    hash = "sha256-8Y9tyw+dmhhc4tFo3slr4wQIPXIrmIk/wuCK4aM6oLY=";
  };

  build-system = [ python3Packages.hatchling ];
@@ -29,10 +33,38 @@ python3Packages.buildPythonApplication rec {
    shiboken6
  ];

  nativeBuildInputs = [
    udevCheckHook
    copyDesktopItems

    # Dependencies for stage1 kamakiri payloads
    gcc-arm-embedded
  ];

  pythonImportsCheck = [ "mtkclient" ];

  # Note: No need to install mtkclient udev rules, 50-android.rules is covered by
  # Build on-device payloads from source before assembling into a python package.
  preBuild = ''
    make -C src/stage1
  '';

  # Note: No need to install other mtkclient udev rules, 50-android.rules is covered by
  #       systemd 258 or newer and 51-edl.rules only applies to Qualcomm (i.e. not MTK).
  postInstall = ''
    install -Dm444 Setup/Linux/52-mtk.rules -t $out/lib/udev/rules.d
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "mtkclient";
      desktopName = "MTKClient";
      comment = "Mediatek Flash and Repair Utility";
      exec = "mtk_gui";
      categories = [
        "Development"
      ];
    })
  ];

  meta = {
    description = "MTK reverse engineering and flash tool";