Merge pull request #245029 from linsui/apktool
apktool: 2.8.0 -> 2.8.1 and use free aapt
This commit is contained in:
commit
2c7a4ee9f9
4 changed files with 67 additions and 18 deletions
48
pkgs/development/tools/aapt/default.nix
Normal file
48
pkgs/development/tools/aapt/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ lib
|
||||
, stdenvNoCC
|
||||
, fetchzip
|
||||
, autoPatchelfHook
|
||||
, libcxx
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "aapt";
|
||||
version = "8.0.2-9289358";
|
||||
|
||||
src =
|
||||
let
|
||||
urlAndHash =
|
||||
if stdenvNoCC.isLinux then {
|
||||
url = "https://dl.google.com/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-linux.jar";
|
||||
hash = "sha256-P8eVIS6zaZGPh4Z7SXUiLtZaX1YIsSmGOdvF6Xb1WHI=";
|
||||
} else if stdenvNoCC.isDarwin then {
|
||||
url = "https://dl.google.com/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-osx.jar";
|
||||
hash = "sha256-hDfEPk3IJt+8FbRVEiHQbn24vsuOe6m36UcQsT6tGsQ=";
|
||||
} else throw "Unsupport platform: ${stdenvNoCC.system}";
|
||||
in
|
||||
fetchzip (urlAndHash // {
|
||||
extension = "zip";
|
||||
stripRoot = false;
|
||||
});
|
||||
|
||||
nativeBuildInputs = lib.optionals stdenvNoCC.isLinux [ autoPatchelfHook ];
|
||||
buildInputs = lib.optionals stdenvNoCC.isLinux [ libcxx ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D aapt2 $out/bin/aapt2
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A build tool that compiles and packages Android app's resources";
|
||||
homepage = "https://developer.android.com/tools/aapt2";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ linsui ];
|
||||
platforms = lib.platforms.unix;
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,15 +1,21 @@
|
|||
{ lib, stdenv, fetchurl, makeWrapper, jre, build-tools }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, makeWrapper
|
||||
, jdk_headless
|
||||
, aapt
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "apktool";
|
||||
version = "2.8.0";
|
||||
version = "2.8.1";
|
||||
|
||||
src = fetchurl {
|
||||
urls = [
|
||||
"https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_${version}.jar"
|
||||
"https://github.com/iBotPeaches/Apktool/releases/download/v${version}/apktool_${version}.jar"
|
||||
];
|
||||
sha256 = "sha256-szEyPr8yXWPhM3WmFHkV+drASPDx+GeDgG+SWUF0jbw=";
|
||||
hash = "sha256-e0qOFwPiKNIG2ylkS3EUFofYoRG1WwObCLAt+kQ6sPk=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
@ -19,23 +25,20 @@ stdenv.mkDerivation rec {
|
|||
sourceRoot = ".";
|
||||
|
||||
installPhase =
|
||||
let
|
||||
tools = builtins.head build-tools;
|
||||
in ''
|
||||
''
|
||||
install -D ${src} "$out/libexec/apktool/apktool.jar"
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper "${jre}/bin/java" "$out/bin/apktool" \
|
||||
makeWrapper "${jdk_headless}/bin/java" "$out/bin/apktool" \
|
||||
--add-flags "-jar $out/libexec/apktool/apktool.jar" \
|
||||
--prefix PATH : "${tools}/libexec/android-sdk/build-tools/${tools.version}"
|
||||
--prefix PATH : ${lib.getBin aapt}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool for reverse engineering Android apk files";
|
||||
homepage = "https://ibotpeaches.github.io/Apktool/";
|
||||
homepage = "https://ibotpeaches.github.io/Apktool/";
|
||||
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
||||
license = licenses.asl20;
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ offline ];
|
||||
platforms = with platforms; unix;
|
||||
platforms = with platforms; unix;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
, dtc
|
||||
, e2fsprogs
|
||||
, enableBloat ? true
|
||||
, enableUnfree ? false
|
||||
, enjarify
|
||||
, fetchurl
|
||||
, file
|
||||
|
@ -174,6 +173,7 @@ python3.pkgs.buildPythonApplication rec {
|
|||
abootimg
|
||||
apksigcopier
|
||||
apksigner
|
||||
apktool
|
||||
cbfstool
|
||||
colord
|
||||
enjarify
|
||||
|
@ -214,8 +214,6 @@ python3.pkgs.buildPythonApplication rec {
|
|||
++ lib.optionals stdenv.isLinux [ oggvideotools ]
|
||||
# This doesn't work on aarch64-darwin
|
||||
++ lib.optionals (stdenv.hostPlatform != "aarch64-darwin") [ gnumeric ]
|
||||
# apktool depend on build-tools which requires Android SDK acceptance, therefore, the whole thing is unfree
|
||||
++ lib.optionals enableUnfree [ apktool ]
|
||||
));
|
||||
|
||||
nativeCheckInputs = with python3.pkgs; [
|
||||
|
|
|
@ -3055,9 +3055,7 @@ with pkgs;
|
|||
|
||||
apksigner = callPackage ../development/tools/apksigner { };
|
||||
|
||||
apktool = callPackage ../development/tools/apktool {
|
||||
inherit (androidenv.androidPkgs_9_0) build-tools;
|
||||
};
|
||||
apktool = callPackage ../development/tools/apktool { };
|
||||
|
||||
appimage-run = callPackage ../tools/package-management/appimage-run { };
|
||||
appimage-run-tests = callPackage ../tools/package-management/appimage-run/test.nix {
|
||||
|
@ -39819,6 +39817,8 @@ with pkgs;
|
|||
|
||||
aaphoto = callPackage ../tools/graphics/aaphoto { };
|
||||
|
||||
aapt = callPackage ../development/tools/aapt { };
|
||||
|
||||
flam3 = callPackage ../tools/graphics/flam3 { };
|
||||
|
||||
glee = callPackage ../tools/graphics/glee { };
|
||||
|
|
Loading…
Reference in a new issue