summary refs log tree commit diff
path: root/pkgs/development/tools/ldid/default.nix
blob: 40cfc1e53ff58be8f3dc0c23eb8788869433d92b (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib
, stdenv
, callPackage
, fetchgit
, libplist
, libxml2
, openssl
, CoreFoundation
, Security
}:

stdenv.mkDerivation rec {
  pname = "ldid";
  version = "2.1.5";

  src = fetchgit {
    url = "git://git.saurik.com/ldid.git";
    rev = "v${version}";
    sha256 = "sha256-RM5pU3mrgyvwNfWKNvCT3UYVGKtVhD7ifgp8fq9xXiM=";
  };

  strictDeps = true;

  buildInputs = [
    libplist
    libxml2
    openssl
  ] ++ lib.optionals stdenv.isDarwin [
    CoreFoundation
    Security
  ];

  NIX_LDFLAGS = [
    "-lcrypto"
    "-lplist-2.0"
    "-lxml2"
  ] ++ lib.optionals stdenv.isDarwin [
    "-framework CoreFoundation"
    "-framework Security"
  ];

  buildPhase = ''
    runHook preBuild

    cc -c -o lookup2.o lookup2.c -I.
    c++ -std=c++11 -o ldid lookup2.o ldid.cpp -I. ${toString NIX_LDFLAGS}

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm755 {,$out/bin/}ldid
    ln -s $out/bin/ldid $out/bin/ldid2

    runHook postInstall
  '';

  meta = with lib; {
    description = "Link Identity Editor";
    homepage = "https://cydia.saurik.com/info/ldid/";
    maintainers = with maintainers; [ wegank ];
    platforms = platforms.unix;
    license = licenses.agpl3Only;
  };
}