From a660f5bcb50fcf01e71f96360cd08be66c961a0e Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 23 Jul 2023 20:39:40 +0800 Subject: [PATCH 1/3] aapt: init at 8.0.2-9289358 --- pkgs/development/tools/aapt/default.nix | 48 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 50 insertions(+) create mode 100644 pkgs/development/tools/aapt/default.nix diff --git a/pkgs/development/tools/aapt/default.nix b/pkgs/development/tools/aapt/default.nix new file mode 100644 index 000000000000..0d59f3ae6f8a --- /dev/null +++ b/pkgs/development/tools/aapt/default.nix @@ -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 ]; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b56b102989a3..1984b3890d75 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39811,6 +39811,8 @@ with pkgs; aaphoto = callPackage ../tools/graphics/aaphoto { }; + aapt = callPackage ../development/tools/aapt { }; + flam3 = callPackage ../tools/graphics/flam3 { }; glee = callPackage ../tools/graphics/glee { }; From ef8e1c480e7b57c60c5e5e5d4d2b260da11dba49 Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 23 Jul 2023 20:40:09 +0800 Subject: [PATCH 2/3] apktool: 2.8.0 -> 2.8.1 --- pkgs/development/tools/apktool/default.nix | 27 ++++++++++++---------- pkgs/top-level/all-packages.nix | 4 +--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pkgs/development/tools/apktool/default.nix b/pkgs/development/tools/apktool/default.nix index abf9bbb48653..99ee4d101b29 100644 --- a/pkgs/development/tools/apktool/default.nix +++ b/pkgs/development/tools/apktool/default.nix @@ -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; }; - } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1984b3890d75..74b581e33fa9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { From 0c626b147d9ca6e03c8f42686f986fe744e7f899 Mon Sep 17 00:00:00 2001 From: linsui Date: Sun, 23 Jul 2023 20:46:01 +0800 Subject: [PATCH 3/3] diffoscope: no more unfree dep --- pkgs/tools/misc/diffoscope/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/tools/misc/diffoscope/default.nix b/pkgs/tools/misc/diffoscope/default.nix index d4e8c538b8e7..8ccce5375d55 100644 --- a/pkgs/tools/misc/diffoscope/default.nix +++ b/pkgs/tools/misc/diffoscope/default.nix @@ -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; [