blob: a857ed5714163a4e8c744a426ba1953a0ed7d6c8 (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
{ lib
, stdenv
, fetchFromGitHub
, gradle
, jdk
, quark-engine
, makeWrapper
, imagemagick
, makeDesktopItem
, copyDesktopItems
, desktopToDarwinBundle
}:
stdenv.mkDerivation (finalAttrs: {
pname = "jadx";
version = "1.4.7";
src = fetchFromGitHub {
owner = "skylot";
repo = finalAttrs.pname;
rev = "v${finalAttrs.version}";
hash = "sha256-3t2e3WfH/ohkdGWlfV3t9oHJ1Q6YM6nSLOgmzgJEkls=";
};
nativeBuildInputs = [ gradle jdk imagemagick makeWrapper copyDesktopItems ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ desktopToDarwinBundle ];
# Otherwise, Gradle fails with `java.net.SocketException: Operation not permitted`
__darwinAllowLocalNetworking = true;
mitmCache = gradle.fetchDeps {
inherit (finalAttrs) pname;
data = ./deps.json;
};
preBuild = "export JADX_VERSION=${finalAttrs.version}";
gradleBuildTask = "pack";
installPhase = ''
runHook preInstall
mkdir $out $out/bin
cp -R build/jadx/lib $out
for prog in jadx jadx-gui; do
cp build/jadx/bin/$prog $out/bin
wrapProgram $out/bin/$prog \
--set JAVA_HOME ${jdk.home} \
--prefix PATH : "${lib.makeBinPath [ quark-engine ]}"
done
for size in 16 32 48; do
install -Dm444 \
jadx-gui/src/main/resources/logos/jadx-logo-"$size"px.png \
$out/share/icons/hicolor/"$size"x"$size"/apps/jadx.png
done
for size in 64 128 256; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" jadx-gui/src/main/resources/logos/jadx-logo.png $out/share/icons/hicolor/"$size"x"$size"/apps/jadx.png
done
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "jadx";
desktopName = "JADX";
exec = "jadx-gui";
icon = "jadx";
comment = finalAttrs.meta.description;
categories = [ "Development" "Utility" ];
})
];
meta = with lib; {
description = "Dex to Java decompiler";
longDescription = ''
Command line and GUI tools for produce Java source code from Android Dex
and Apk files.
'';
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ emilytrau ];
};
})
|