README: streamline development instructions

This commit is contained in:
plata
2024-05-10 12:40:25 +00:00
committed by Mis012
parent 5a8dba4064
commit 0202e0389d
2 changed files with 135 additions and 46 deletions

View File

@@ -1,52 +1,53 @@
### A translation layer that allows running android apps on a Linux system A translation layer that allows running Android apps on a Linux system
--- ![Angry Birds 3.2.0, Worms 2 Armageddon, and Gravity Defied running side by side by side](https://gitlab.com/android_translation_layer/android_translation_layer/-/raw/master/screenshot_2.png)
dependencies on debian: ### Build
`sudo apt install libglib2.0-dev libgtk-4-dev libasound2-dev libopenxr-dev libportal-dev libsqlite3-dev libcap-dev libavcodec-dev libdrm-dev libgudev-1.0-dev` see [build documentation](https://gitlab.com/android_translation_layer/android_translation_layer/-/blob/master/doc/Build.md)
dependencies you might have to build from source: ### Run in builddir
- https://github.com/Mis012/skia/tree/with-patches-applied ```sh
(can also use the prebuilt in https://www.nuget.org/api/v2/package/SkiaSharp.NativeAssets.Linux/2.88.5 if it's compatible with your distro) cd builddir
```
For an example of a full game working that can be distributed along this:
```sh
RUN_FROM_BUILDDIR= LD_LIBRARY_PATH=./ ./android-translation-layer /path/to/test_apks/org.happysanta.gd_29.apk -l org/happysanta/gd/GDActivity
```
Or for a sample app using OpenGL from native code to do it's rendering:
```sh
RUN_FROM_BUILDDIR= LD_LIBRARY_PATH=./ ./android-translation-layer path/to/test_apks/gles3jni.apk -l com/android/gles3jni/GLES3JNIActivity
```
Note: the test apks are available at https://gitlab.com/android_translation_layer/atl_test_apks.
some apps depend on the following (though the translation layer itself currently does not): ### Run after installation
- https://gitlab.com/android_translation_layer/libopensles-standalone/ ```sh
cd builddir
meson install
```
build instructions: To run with the default data dir `~/.local/share/android_translation_layer/`:
1. compile and install https://gitlab.com/android_translation_layer/dalvik_standalone (art branch) (you can run it from builddir, but it requires some additional env variables) ```sh
2. `mkdir builddir` android-translation-layer [path to apk] [-l activity to launch]
3. `meson builddir` ```
4. `ninja -C builddir` For custom data dir:
```sh
ANDROID_APP_DATA_DIR=[data dir] android-translation-layer [path to apk] [-l activity to launch]
```
then, to run from builddir: ### Tweaks
`cd builddir` ##### Resolution Changes
and Some apps don't like runtime changes to resolution. To sidestep this, we allow for specifying the initial resolution.
`RUN_FROM_BUILDDIR= LD_LIBRARY_PATH=./ ./android-translation-layer /path/to/test_apks/org.happysanta.gd_29.apk -l org/happysanta/gd/GDActivity` example with custom width/height:
(for an example of a full game working that can be distributed along this) ```sh
or android-translation-layer path/to/org.happysanta.gd_29.apk -l org/happysanta/gd/GDActivity -w 540 -h 960
`RUN_FROM_BUILDDIR= LD_LIBRARY_PATH=./ ./android-translation-layer path/to/test_apks/gles3jni.apk -l com/android/gles3jni/GLES3JNIActivity` ```
(for a sample app using OpenGL from native code to do it's rendering)
the test apks are available at https://gitlab.com/android_translation_layer/atl_test_apks #### GLX on X11
On X11, Gtk might decide to use GLX, which completely messes up our EGL-dependent code.
to install:
`meson install`
to run after installataion:
`ANDROID_APP_DATA_DIR=[data dir] android-translation-layer [path to apk] [-l activity to launch]`
or just
`android-translation-layer [path to apk] [-l activity to launch]`
to use the default data dir of `~/.local/share/android_translation_layer/`
NOTE: some apps don't like runtime changes to resolution.
to sidestep this, we allow for specifying the initial resolution.
example with custom width/height: `android-translation-layer path/to/org.happysanta.gd_29.apk -l org/happysanta/gd/GDActivity -w 540 -h 960`
NOTE: on X11, Gtk might decide to use GLX, which completely messes up our EGL-dependent code.
Use GDK_DEBUG=gl-egl to force the use of EGL. Use GDK_DEBUG=gl-egl to force the use of EGL.
when it doesn't work: ### Contribute
if you are trying to launch a random app, chances are that we are missing implementations for some If you are trying to launch a random app, chances are that we are missing implementations for some
stuff that it needs, and we also don't have (sufficiently real looking) stubs for the stuff it says stuff that it needs, and we also don't have (sufficiently real looking) stubs for the stuff it says
it needs but doesn't really. it needs but doesn't really.
the workflow is basically to see where it fails (usually a Class or Method was not found) and to create the workflow is basically to see where it fails (usually a Class or Method was not found) and to create
@@ -62,11 +63,7 @@ for general description of the architecure, see `doc/Architecture.md`
if you want to contribute, and find the codebase overwhelming, don't hesitate to open an issue if you want to contribute, and find the codebase overwhelming, don't hesitate to open an issue
so we can help you out and possibly write more documentation. so we can help you out and possibly write more documentation.
screenshot: ### Roadmap
![angry birds 3.2.0, Worms 2 Armageddon, and gravity defied running side by side by side](https://gitlab.com/android_translation_layer/android_translation_layer/-/raw/master/screenshot_2.png)
##### Roadmap:
- fix issues mentioned above - fix issues mentioned above
@@ -76,7 +73,7 @@ screenshot:
- explore using bubblewrap to enforce the security policies that google helpfully forces apps to comply with (and our own security policies, like no internet access for apps which really shouldn't need it and are not scummy enough to refuse to launch without it) - explore using bubblewrap to enforce the security policies that google helpfully forces apps to comply with (and our own security policies, like no internet access for apps which really shouldn't need it and are not scummy enough to refuse to launch without it)
##### Tips: ### Tips
- the correct format for changing verbosity of messages going through android's logging library is `ANDROID_LOG_TAGS=*:v` (where `*` is "all tags" and `v` is "verbosity `verbose` or lesser" - the correct format for changing verbosity of messages going through android's logging library is `ANDROID_LOG_TAGS=*:v` (where `*` is "all tags" and `v` is "verbosity `verbose` or lesser"
(note that specifying anything other than `*` as the tag will not work with the host version of liblog) (note that specifying anything other than `*` as the tag will not work with the host version of liblog)

92
doc/Build.md Normal file
View File

@@ -0,0 +1,92 @@
## Dependencies
### Debian
```sh
sudo apt install libasound2-dev libavcodec-dev libcap-dev libdrm-dev libglib2.0-dev libgtk-4-dev libgudev-1.0-dev libopenxr-dev libportal-dev libsqlite3-dev
```
### Fedora
```sh
sudo dnf install java-17-openjdk-devel pkgconfig(gtk4) pkgconfig(libbsd) pkgconfig(libportal) pkgconfig(sqlite3) pkgconfig(libwebp) pkgconfig(liblz4) pkgconfig(openxr)
```
## Additional Dependencies
### Skia
If you distro ships this already (e.g. `skia-sharp` on Alpine), you can just install the package and skip this step.
Install `gn` via your system's package manager.
```sh
git clone https://github.com/Mis012/skia.git -b with-patches-applied
cd skia
cp build/linux-self-hosted/DEPS DEPS
python3 tools/git-sync-deps
export arch=x64
gn gen 'out/linux/$arch' --args='is_official_build=true skia_enable_tools=false target_os="linux" target_cpu="$arch" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_system_harfbuzz=true skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=true skia_enable_gpu=true extra_cflags=[ "-DSKIA_C_DLL" ] linux_soname_version="99.9"'
ninja -C 'out/linux/$arch' SkiaSharp
sudo cp out/linux/$arch/libSkiaSharp.so.99.9 /usr/local/lib64/
sudo ln -s /usr/local/lib64/libSkiaSharp.so.99.9 /usr/local/lib64/libSkiaSharp.so
```
Note:
- You can also use [this nuget package](https://www.nuget.org/api/v2/package/SkiaSharp.NativeAssets.Linux/2.88.5) if it's compatible with your distro. It's an older upstream version before the ABI break which is fixed in our skia repository.
- For `x86` or `aarch64`: set `arch` accordingly.
- On alpine: add `-fpermissive` to `--args`.
### wolfSSL
If you distro ships wolfSSL with JNI enabled already, you can just install the package and skip this step.
```sh
git clone https://github.com/wolfSSL/wolfssl.git
cd wolfssl
git checkout v5.7.0-stable
autoreconf -i
./configure --enable-shared --disable-opensslall --disable-opensslextra --enable-aescbc-length-checks --enable-curve25519 --enable-ed25519 --enable-ed25519-stream --enable-oldtls --enable-base64encode --enable-tlsx --enable-scrypt --disable-examples --enable-crl --with-rsa --enable-certs --enable-session-certs --enable-encrypted-keys --enable-cert-gen --enable-cert-ext --enable-clr-monitor --enable-jni
make
sudo make install
```
### bionic_translation
If you distro ships this already (e.g. `bionic_translation` on Alpine), you can just install the package and skip this step.
```sh
git clone https://gitlab.com/android_translation_layer/bionic_translation.git
cd bionic_translation
meson setup builddir
cd builddir
meson compile
sudo meson install
```
### art_standalone
If you distro ships this already (e.g. `art_standalone` on Alpine), you can just install the package and skip this step.
```sh
git clone https://gitlab.com/android_translation_layer/art_standalone.git
cd art_standalone
make ____LIBDIR=lib
sudo make ____LIBDIR=lib install
```
Note: adjust `____LIBDIR` depending on your distro (e.g some distros use `lib32`,`lib` or `lib`,`lib64` for multilib).
### libOpenSLES
Optional (not required for Android Translation Layer itself but some apps depend on it).
If you distro ships this already (e.g. `libopensles-standalone` on Alpine), you can just install the package and skip this step.
```sh
git clone https://gitlab.com/android_translation_layer/libopensles-standalone.git
cd libopensles-standalone
meson setup builddir
cd builddir
meson compile
sudo meson install
```
## Build
```sh
git clone https://gitlab.com/android_translation_layer/android_translation_layer.git
cd android_translation_layer
meson setup builddir
cd builddir
meson compile
```
## Install
```sh
cd builddir
meson install
```