From 6f2a943d4f5a69d447d3fb0a9ccab42bd5430c1f Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Mon, 1 Sep 2025 13:04:59 +0200 Subject: [PATCH] art-standalone: add pkg-config support --- pkgs/by-name/ar/art-standalone/package.nix | 4 ++ .../art-standalone/pkg-config-support.patch | 45 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 pkgs/by-name/ar/art-standalone/pkg-config-support.patch diff --git a/pkgs/by-name/ar/art-standalone/package.nix b/pkgs/by-name/ar/art-standalone/package.nix index 0082c97a37c2..ad1809ae242a 100644 --- a/pkgs/by-name/ar/art-standalone/package.nix +++ b/pkgs/by-name/ar/art-standalone/package.nix @@ -35,6 +35,10 @@ stdenv.mkDerivation (finalAttrs: { patches = [ # Do not hardocde addr2line binary path ./no-hardcode-path-addr2line.patch + + # Add support for pkg-config + # See: https://gitlab.com/android_translation_layer/art_standalone/-/merge_requests/37 + ./pkg-config-support.patch ]; postPatch = '' diff --git a/pkgs/by-name/ar/art-standalone/pkg-config-support.patch b/pkgs/by-name/ar/art-standalone/pkg-config-support.patch new file mode 100644 index 000000000000..8b3929572757 --- /dev/null +++ b/pkgs/by-name/ar/art-standalone/pkg-config-support.patch @@ -0,0 +1,45 @@ +diff --git a/Makefile b/Makefile +index 42df5b18..3321adae 100644 +--- a/Makefile ++++ b/Makefile +@@ -32,6 +32,8 @@ ____dalvikvm_bin_64 := $(____TOPDIR)/out/host/linux-x86/bin/dalvikvm64 + __RPATH_BIN := \$${ORIGIN}/../$(____LIBDIR)/art/:\$${ORIGIN}/../$(____LIBDIR)/java/dex/art/natives + __RPATH_LIB := \$${ORIGIN} + ++__VERSION ?= 0.0.0 ++ + # Jack compiler was google's first attempt at a solution for desugaring Java 8 and newer bytecode into bytecode compatible with older dex file formats. + # Thankfully, google realized that this was a bad idea, and in a typical google fashion, axed the project. + # They experimented with other approaches, but currently (2022) the way to do this is to use d8/r8 instead of dx; +@@ -112,6 +114,15 @@ install: + # our stable C API for libandroidfw, used by ATL + install -Dt $(____INSTALL_INCLUDEDIR)/androidfw $(____TOPDIR)/libandroidfw/include/androidfw/androidfw_c_api.h + ++ # install pkg-config file ++ mkdir -p $(____INSTALL_LIBDIR)/pkgconfig ++ sed -e 's|@prefix@|$(____PREFIX)|g' \ ++ -e 's|@libdir@|$(____LIBDIR)|g' \ ++ -e 's|@includedir@|$(____INCLUDEDIR)|g' \ ++ -e 's|@version@|$(__VERSION)|g' \ ++ art-standalone.pc.in > $(____INSTALL_LIBDIR)/pkgconfig/art-standalone.pc ++ ++ + # TODO: figure out sharing dependencies and have this in a separate repo + install_adbd: + install -Dt $(____INSTALL_BINDIR) $(____TOPDIR)/out/host/linux-x86/bin/adbd +diff --git a/art-standalone.pc.in b/art-standalone.pc.in +new file mode 100644 +index 00000000..210cd031 +--- /dev/null ++++ b/art-standalone.pc.in +@@ -0,0 +1,10 @@ ++prefix=@prefix@ ++exec_prefix=${prefix} ++libdir=${prefix}/@libdir@ ++includedir=${prefix}/@includedir@ ++ ++Name: art-standalone ++Description: Android ART runtime (standalone build, minimal ATL deps) ++Version: @version@ ++Libs: -L${libdir}/art -lart -lnativebridge -landroidfw ++Cflags: -I${includedir} -I${includedir}/androidfw