Unverified Commit 0f1e7c9e authored by Morgan Jones's avatar Morgan Jones Committed by GitHub
Browse files

android-translation-layer: 0-unstable-2025-08-06 -> 0-unstable-2025-09-14 (#442288)

parents d7bcba20 e46d41e3
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
diff --git a/meson.build b/meson.build
index 8f525118..ba8027c2 100644
--- a/meson.build
+++ b/meson.build
@@ -9,22 +9,15 @@ add_project_dependencies(incdir_dep, language: 'c')
 cc = meson.get_compiler('c')
 dir_base = meson.current_source_dir()
 builddir_base = meson.current_build_dir()
-# FIXME: make art install a pkgconfig file
-libart_dep = [
-	cc.find_library('art', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
-     	cc.find_library('nativebridge', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ])
-]
+libart_dep = dependency('art-standalone')
 libdl_bio_dep = [
 	cc.find_library('dl_bio')
 ]
 libc_bio_dep = [
 	cc.find_library('c_bio')
 ]
-libandroidfw_dep = [
-	cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
-]
-if fs.is_file('/usr' / get_option('libdir') / 'java/core-all_classes.jar')
-  bootclasspath_dir = '/usr' / get_option('libdir') / 'java'
+if fs.is_file('@artStandalonePackageDir@' / get_option('libdir') / 'java/core-all_classes.jar')
+  bootclasspath_dir = '@artStandalonePackageDir@' / get_option('libdir') / 'java'
 elif fs.is_file('/usr/local' / get_option('libdir') / 'java/core-all_classes.jar')
   bootclasspath_dir = '/usr/local' / get_option('libdir') / 'java'
 elif fs.is_file(get_option('prefix') / get_option('libdir') / 'java/core-all_classes.jar')
@@ -179,7 +172,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
                                                                   	dependency('gtk4', version: '>=4.14'), dependency('gl'), dependency('egl'), dependency('wayland-client'), dependency('jni'),
                                                                   	dependency('libportal'), dependency('sqlite3'), dependency('libavcodec', version: '>=59'), dependency('libdrm'),
                                                                   	dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'),
-                                                                  	libandroidfw_dep, wayland_protos_dep
+                                                                        libart_dep, wayland_protos_dep
                                                                   ],
                                                                   link_with: [ libandroid_so ],
                                                                   link_args: [
+16 −0
Original line number Diff line number Diff line
diff --git a/src/main-executable/main.c b/src/main-executable/main.c
index 545da00f..2f87447d 100644
--- a/src/main-executable/main.c
+++ b/src/main-executable/main.c
@@ -390,7 +390,10 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
 
 	ret = stat(MICROG_APK_PATH_LOCAL, &dont_care);
 	errno_localdir = errno;
-	if (!ret) {
+	char *env_microg = getenv("MICROG_APK_PATH");
+	if (env_microg && access(env_microg, F_OK) == 0) {
+	    microg_apk = strdup(env_microg);
+	} else if (stat(MICROG_APK_PATH_LOCAL, &dont_care) == 0) {
 		microg_apk = strdup(MICROG_APK_PATH_LOCAL); // for running out of builddir; using strdup so we can always safely call free on this
 	} else {
 		char *microg_install_dir = malloc(strlen(dex_install_dir) + strlen(REL_MICROG_APK_INSTALL_PATH) + 1); // +1 for NULL
+17 −10
Original line number Diff line number Diff line
@@ -30,27 +30,24 @@

stdenv.mkDerivation {
  pname = "android-translation-layer";
  version = "0-unstable-2025-08-06";
  version = "0-unstable-2025-09-14";

  src = fetchFromGitLab {
    owner = "android_translation_layer";
    repo = "android_translation_layer";
    rev = "d52985a6df81d73a8f6dfbdee337f7ff90b724cb";
    hash = "sha256-fJ8S04YucoCzHiIQdiQd+Il0YGNFsOkSiGWjZKNMTIM=";
    rev = "9de91586994af5078decda17db92ce50c5673951";
    hash = "sha256-iRjP++WzLsV7oDGNdF3m9JJJS7zLrG5W46U3h39H5uk=";
  };

  patches = [
    # meson: use pkg-config from art-standalone instead of manual library search
    # See: https://gitlab.com/android_translation_layer/android_translation_layer/-/merge_requests/164
    (replaceVars ./configure-art-path.patch {
      artStandalonePackageDir = "${art-standalone}";
    })

    # Required gio-unix dependency is missing in meson.build
    ./add-gio-unix-dep.patch

    # Patch custon Dex install dir
    ./configure-dex-install-dir.patch

    # Patch atl to load microg apk from custom path
    ./configure-microg-path.patch
  ];

  postPatch = ''
@@ -85,10 +82,20 @@ stdenv.mkDerivation {
    webkitgtk_6_0
  ];

  postInstall = ''
    install -D $src/com.google.android.gms.apk $out/share/com.google.android.gms.apk
  '';

  postFixup = ''
    wrapProgram $out/bin/android-translation-layer \
      --prefix LD_LIBRARY_PATH : ${art-standalone}/lib/art \
      --prefix PATH : ${lib.makeBinPath [ bintools ]}
      --prefix PATH : ${
        lib.makeBinPath [
          art-standalone # dex2oat
          bintools # addr2line
        ]
      } \
      --set MICROG_APK_PATH "$out/share/com.google.android.gms.apk"
  '';

  passthru.tests = {
+6 −9
Original line number Diff line number Diff line
@@ -23,28 +23,25 @@
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "art-standalone";
  version = "0-unstable-2025-07-09";
  version = "0-unstable-2025-09-03";

  src = fetchFromGitLab {
    owner = "android_translation_layer";
    repo = "art_standalone";
    rev = "1eee3dce3ba6f324bb7a32a170b2da14889af39d";
    hash = "sha256-OAO0k/LkQ+MKqR4HkFXD18LSXQZNPogjjRot4UVoE5A=";
    rev = "10d60509c9073791f9eca1d2b8443d40a40edc05";
    hash = "sha256-Xg6s58jymma1sNb6P7pwWFpYq1O6GoynrgPeLZRD+rI=";
  };

  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 = ''
    chmod +x dalvik/dx/etc/{dx,dexmerger}
    patchShebangs .
    sed -i "s|/bin/bash|${runtimeShell}|" build/core/config.mk build/core/main.mk
    substituteInPlace build/core/config.mk build/core/main.mk \
      --replace-fail "/bin/bash" "${runtimeShell}"
  '';

  enableParallelBuilding = true;
@@ -102,7 +99,7 @@ stdenv.mkDerivation (finalAttrs: {
    homepage = "https://gitlab.com/android_translation_layer/art_standalone";
    # No license specified yet
    license = lib.licenses.unfree;
    platforms = lib.platforms.all;
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ onny ];
  };
})
+0 −45
Original line number Diff line number Diff line
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