android-translation-layer: init at 0-unstable-2025-07-14

This commit is contained in:
Jonas Heinrich 2024-11-19 11:49:20 +01:00
parent 2376074cfe
commit c63522c860
4 changed files with 151 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index 8f525118..658cd9e5 100644
--- a/meson.build
+++ b/meson.build
@@ -178,7 +178,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
extra_deps,
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'),
+ dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'), dependency('gio-unix-2.0'),
libandroidfw_dep, wayland_protos_dep
],
link_with: [ libandroid_so ],

View File

@ -0,0 +1,29 @@
diff --git a/meson.build b/meson.build
index 8f525118..c1761a2d 100644
--- a/meson.build
+++ b/meson.build
@@ -11,8 +11,8 @@ 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' ])
+ cc.find_library('art', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art', '@artStandalonePackageDir@' / 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', '@artStandalonePackageDir@' / get_option('libdir') / 'art' ])
]
libdl_bio_dep = [
cc.find_library('dl_bio')
@@ -21,10 +21,10 @@ 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' ]),
+ cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art', '@artStandalonePackageDir@' / 'lib' / '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')

View File

@ -0,0 +1,12 @@
diff --git a/src/main-executable/main.c b/src/main-executable/main.c
index d7cfbfe8..c542c71a 100644
--- a/src/main-executable/main.c
+++ b/src/main-executable/main.c
@@ -311,6 +311,7 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
} else {
dex_install_dir = "DIDN'T_GET_SO_PATH_WITH_dladdr_SUS"; // in case we print this as part of some other error, it should be clear what the real cause is
}
+ dex_install_dir = "@out@/lib/java/dex";
char *app_data_dir_base = getenv("ANDROID_APP_DATA_DIR");
if (!app_data_dir_base) {

View File

@ -0,0 +1,97 @@
{
stdenv,
fetchFromGitLab,
ffmpeg,
meson,
openjdk17,
lib,
glib,
pkg-config,
wayland-protocols,
wayland,
wayland-scanner,
gtk4,
openxr-loader,
libglvnd,
libportal-gtk4,
sqlite,
libdrm,
libgudev,
webkitgtk_6_0,
ninja,
art-standalone,
bionic-translation,
alsa-lib,
makeWrapper,
replaceVars,
}:
stdenv.mkDerivation {
pname = "android-translation-layer";
version = "0-unstable-2025-07-14";
src = fetchFromGitLab {
owner = "android_translation_layer";
repo = "android_translation_layer";
rev = "828f779c4f7170f608047c500d6d3b64b480df7f";
hash = "sha256-1KYZWlzES3tbskqvA8qSQCegE0uLTLCq4q2CX6uix4o=";
};
patches = [
(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
];
postPatch = ''
# As we need the $out reference, we can't use `replaceVars` here.
substituteInPlace src/main-executable/main.c \
--replace-fail '@out@' "$out"
'';
nativeBuildInputs = [
makeWrapper
meson
ninja
openjdk17
pkg-config
];
buildInputs = [
alsa-lib
art-standalone
bionic-translation
ffmpeg
gtk4
libdrm
libglvnd
libgudev
libportal-gtk4
openxr-loader
sqlite
wayland
wayland-protocols
wayland-scanner
webkitgtk_6_0
];
postFixup = ''
wrapProgram $out/bin/android-translation-layer \
--prefix LD_LIBRARY_PATH : ${art-standalone}/lib/art
'';
meta = {
description = "Translation layer that allows running Android apps on a Linux system";
homepage = "https://gitlab.com/android_translation_layer/android_translation_layer";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ onny ];
mainProgram = "android-translation-layer";
};
}