art-standalone: add pkg-config support

+49
+4
pkgs/by-name/ar/art-standalone/package.nix
··· 35 35 patches = [ 36 36 # Do not hardocde addr2line binary path 37 37 ./no-hardcode-path-addr2line.patch 38 + 39 + # Add support for pkg-config 40 + # See: https://gitlab.com/android_translation_layer/art_standalone/-/merge_requests/37 41 + ./pkg-config-support.patch 38 42 ]; 39 43 40 44 postPatch = ''
+45
pkgs/by-name/ar/art-standalone/pkg-config-support.patch
··· 1 + diff --git a/Makefile b/Makefile 2 + index 42df5b18..3321adae 100644 3 + --- a/Makefile 4 + +++ b/Makefile 5 + @@ -32,6 +32,8 @@ ____dalvikvm_bin_64 := $(____TOPDIR)/out/host/linux-x86/bin/dalvikvm64 6 + __RPATH_BIN := \$${ORIGIN}/../$(____LIBDIR)/art/:\$${ORIGIN}/../$(____LIBDIR)/java/dex/art/natives 7 + __RPATH_LIB := \$${ORIGIN} 8 + 9 + +__VERSION ?= 0.0.0 10 + + 11 + # 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. 12 + # Thankfully, google realized that this was a bad idea, and in a typical google fashion, axed the project. 13 + # They experimented with other approaches, but currently (2022) the way to do this is to use d8/r8 instead of dx; 14 + @@ -112,6 +114,15 @@ install: 15 + # our stable C API for libandroidfw, used by ATL 16 + install -Dt $(____INSTALL_INCLUDEDIR)/androidfw $(____TOPDIR)/libandroidfw/include/androidfw/androidfw_c_api.h 17 + 18 + + # install pkg-config file 19 + + mkdir -p $(____INSTALL_LIBDIR)/pkgconfig 20 + + sed -e 's|@prefix@|$(____PREFIX)|g' \ 21 + + -e 's|@libdir@|$(____LIBDIR)|g' \ 22 + + -e 's|@includedir@|$(____INCLUDEDIR)|g' \ 23 + + -e 's|@version@|$(__VERSION)|g' \ 24 + + art-standalone.pc.in > $(____INSTALL_LIBDIR)/pkgconfig/art-standalone.pc 25 + + 26 + + 27 + # TODO: figure out sharing dependencies and have this in a separate repo 28 + install_adbd: 29 + install -Dt $(____INSTALL_BINDIR) $(____TOPDIR)/out/host/linux-x86/bin/adbd 30 + diff --git a/art-standalone.pc.in b/art-standalone.pc.in 31 + new file mode 100644 32 + index 00000000..210cd031 33 + --- /dev/null 34 + +++ b/art-standalone.pc.in 35 + @@ -0,0 +1,10 @@ 36 + +prefix=@prefix@ 37 + +exec_prefix=${prefix} 38 + +libdir=${prefix}/@libdir@ 39 + +includedir=${prefix}/@includedir@ 40 + + 41 + +Name: art-standalone 42 + +Description: Android ART runtime (standalone build, minimal ATL deps) 43 + +Version: @version@ 44 + +Libs: -L${libdir}/art -lart -lnativebridge -landroidfw 45 + +Cflags: -I${includedir} -I${includedir}/androidfw