summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/el/elftool/package.nix
blob: 50808853d60f7893303916853c55164b39b7b401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
  lib,
  stdenv,
  fetchFromGitHub,
}:
stdenv.mkDerivation {
  pname = "elftool";
  version = "0-unstable-2022-11-10";

  src = fetchFromGitHub {
    owner = "osm0sis";
    repo = "elftool";
    rev = "363653ee89d7b4e1cd5e1f2c878d71acd75fc072";
    hash = "sha256-nMJhMzzvXtrezZbKdsBq24/El2n7ubiBd5XEYFg3C00=";
  };

  strictDeps = true;

  # Needed to fix `collect2: error: ld returned 1 exit status`
  env.NIX_LDFLAGS = if stdenv.hostPlatform.isDarwin then "-lc++" else "-lstdc++";

  makeFlags = [ "CC=c++" ];

  installPhase = ''
    runHook preInstall
    install -Dm555 elftool -t $out/bin
    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/osm0sis/elftool";
    description = "Program for packing and unpacking boot images from Sony mobile devices";
    # No license specified in the repository
    license = lib.licenses.free;
    sourceProvenance = with lib.sourceTypes; [ fromSource ];
    maintainers = with lib.maintainers; [ ungeskriptet ];
    teams = [ lib.teams.android ];
    mainProgram = "elftool";
  };
}