├── .gitignore ├── README.md ├── io.gitlab.android_translation_layer.BaseApp.yml └── patches ├── android_translation_layer_appid.patch └── vixl_meson_support.patch /.gitignore: -------------------------------------------------------------------------------- 1 | .flatpak-builder/ 2 | build-dir/ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Translation Layer Base App 2 | 3 | This is a Flatpak base app for [Android Translation Layer](https://gitlab.com/android_translation_layer/android_translation_layer). It can be used to repackage Android apps as Flatpaks. For an example of doing this see the manifest of the [NewPipe Flatpak](https://github.com/flathub/net.newpipe.NewPipe). 4 | 5 | ## Usage as commandline application 6 | 7 | The BaseApp can also be used directly as a commandline application with the following commands. 8 | 9 | - To install the Flatpak run the following command: 10 | 11 | ``` 12 | flatpak install io.gitlab.android_translation_layer.BaseApp 13 | ``` 14 | 15 | - To launch an app run the following command: 16 | 17 | ``` 18 | flatpak run io.gitlab.android_translation_layer.BaseApp ~/Downloads/application.apk 19 | ``` 20 | 21 | Keep in mind that the API implementation is far from complete, so any random untested application is unlikely to work out of the box. 22 | -------------------------------------------------------------------------------- /io.gitlab.android_translation_layer.BaseApp.yml: -------------------------------------------------------------------------------- 1 | id: io.gitlab.android_translation_layer.BaseApp 2 | runtime: org.gnome.Platform 3 | runtime-version: '49' 4 | sdk: org.gnome.Sdk 5 | sdk-extensions: 6 | - org.freedesktop.Sdk.Extension.openjdk17 7 | # default command and finish-args only for using as commandline application. They are ignored when used as base app 8 | command: android-translation-layer 9 | finish-args: 10 | - --share=network 11 | - --share=ipc 12 | - --socket=wayland 13 | - --socket=fallback-x11 14 | - --device=dri 15 | - --socket=pulseaudio 16 | - --filesystem=home 17 | cleanup: 18 | - /include 19 | - /bin/dx 20 | - '*.a' 21 | - '*.la' 22 | - '/lib/libopenxr_loader.so*' 23 | - '/lib/libportal-*' 24 | - /lib/cmake 25 | - /lib/girepository-1.0 26 | - /lib/java/core-all_classes.jar 27 | - /lib/java/core-junit_classes.jar 28 | - /lib/java/junit-runner_classes.jar 29 | - /lib/java/dx.jar 30 | - /lib/pkgconfig 31 | - /share/doc 32 | - /share/gir-1.0 33 | - /share/man 34 | - /share/vala 35 | - /etc/ssl/certs/java/cacerts.bks 36 | modules: 37 | - name: libmd 38 | buildsystem: autotools 39 | sources: 40 | - type: archive 41 | url: https://archive.hadrons.org/software/libmd/libmd-1.1.0.tar.xz 42 | sha256: 1bd6aa42275313af3141c7cf2e5b964e8b1fd488025caf2f971f43b00776b332 43 | 44 | - name: libbsd 45 | buildsystem: autotools 46 | sources: 47 | - type: git 48 | url: https://gitlab.freedesktop.org/libbsd/libbsd.git 49 | tag: '0.12.2' 50 | 51 | - name: libportal 52 | buildsystem: meson 53 | sources: 54 | - type: git 55 | url: https://github.com/flatpak/libportal.git 56 | tag: '0.9.1' 57 | 58 | - name: openxr 59 | buildsystem: cmake-ninja 60 | sources: 61 | - type: git 62 | url: https://github.com/KhronosGroup/OpenXR-SDK.git 63 | tag: 'release-1.1.52' 64 | 65 | - name: wolfssl 66 | buildsystem: autotools 67 | config-opts: 68 | - --enable-shared 69 | - --disable-opensslall 70 | - --disable-opensslextra 71 | - --enable-aescbc-length-checks 72 | - --enable-curve25519 73 | - --enable-ed25519 74 | - --enable-ed25519-stream 75 | - --enable-oldtls 76 | - --enable-base64encode 77 | - --enable-tlsx 78 | - --enable-scrypt 79 | - --disable-examples 80 | - --enable-crl 81 | - --enable-jni 82 | - --enable-sessioncerts 83 | sources: 84 | - type: git 85 | url: https://github.com/wolfSSL/wolfssl.git 86 | tag: v5.8.2-stable 87 | 88 | - name: vixl 89 | buildsystem: meson 90 | build-options: 91 | config-opts: 92 | - -Dsimulator=none 93 | only-arches: 94 | - aarch64 95 | sources: 96 | - type: archive 97 | url: https://github.com/Linaro/vixl/archive/refs/tags/8.0.0.tar.gz 98 | sha256: 6aebbebcd9b66686ea246b450af529e1fc50fe25209522cc9ab42beae2377d38 99 | - type: patch 100 | path: patches/vixl_meson_support.patch 101 | 102 | - name: bionic_translation 103 | buildsystem: meson 104 | sources: 105 | - type: git 106 | url: https://gitlab.com/android_translation_layer/bionic_translation.git 107 | commit: 0d41c7f52a8c09d672dddf1a7bf5d8419492ecb3 108 | 109 | - name: art_standalone 110 | no-autogen: true 111 | build-options: 112 | make-args: 113 | - ____PREFIX=/app 114 | - ____LIBDIR=lib 115 | make-install-args: 116 | - ____PREFIX=/app 117 | - ____LIBDIR=lib 118 | - ____INSTALL_ETC=/app/etc 119 | append-path: /usr/lib/sdk/openjdk17/bin 120 | env: 121 | JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 122 | LIBRARY_PATH: /app/lib 123 | sources: 124 | - type: git 125 | url: https://gitlab.com/android_translation_layer/art_standalone.git 126 | commit: 52e4bcda9c62bcc1654b554ace5869c58e6d3760 127 | 128 | - name: android-translation-layer 129 | buildsystem: meson 130 | build-options: 131 | append-path: /usr/lib/sdk/openjdk17/bin 132 | env: 133 | JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 134 | sources: 135 | - type: git 136 | url: https://gitlab.com/android_translation_layer/android_translation_layer.git 137 | commit: 2c64b6b345afe188d8045f809dc38400c5777c74 138 | - type: patch 139 | path: patches/android_translation_layer_appid.patch 140 | 141 | - name: cacerts 142 | buildsystem: simple 143 | build-commands: 144 | - mkdir -p /app/share/java_home/lib/security 145 | - install -D /usr/lib/sdk/openjdk17/jvm/openjdk-17/lib/security/cacerts /app/share/ssl/certs/java/cacerts 146 | 147 | - name: libopensles-standalone 148 | buildsystem: meson 149 | build-options: 150 | append-path: /usr/lib/sdk/openjdk17/bin 151 | env: 152 | JAVA_HOME: /usr/lib/sdk/openjdk17/jvm/openjdk-17 153 | sources: 154 | - type: git 155 | url: https://gitlab.com/android_translation_layer/libopensles-standalone 156 | commit: bdb857a4baadbc8c036db85a5da26c5269a751c5 157 | -------------------------------------------------------------------------------- /patches/android_translation_layer_appid.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/main-executable/main.c b/src/main-executable/main.c 2 | index 691a72b9..59f9d040 100644 3 | --- a/src/main-executable/main.c 4 | +++ b/src/main-executable/main.c 5 | @@ -617,7 +617,7 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h 6 | if (supported_mime_types) 7 | g_string_append_printf(desktop_entry, "MimeType=%s\n", supported_mime_types); 8 | struct dynamic_launcher_callback_data *cb_data = g_new(struct dynamic_launcher_callback_data, 1); 9 | - cb_data->desktop_file_id = g_strdup_printf("%s.desktop", package_name); 10 | + cb_data->desktop_file_id = g_strdup_printf("io.gitlab.android_translation_layer.BaseApp.%s.desktop", package_name); 11 | cb_data->desktop_entry = g_string_free(desktop_entry, FALSE); 12 | printf("installing %s\n\n%s\n", cb_data->desktop_file_id, cb_data->desktop_entry); 13 | xdp_portal_dynamic_launcher_prepare_install(portal, NULL, app_label, icon_serialized, XDP_LAUNCHER_APPLICATION, NULL, TRUE, TRUE, NULL, dynamic_launcher_ready_callback, cb_data); 14 | @@ -743,7 +743,7 @@ int main(int argc, char **argv) 15 | callback_data->extra_jvm_options = NULL; 16 | callback_data->extra_string_keys = NULL; 17 | 18 | - app = gtk_application_new("com.example.demo_application", G_APPLICATION_NON_UNIQUE | G_APPLICATION_HANDLES_OPEN | G_APPLICATION_CAN_OVERRIDE_APP_ID); 19 | + app = gtk_application_new("io.gitlab.android_translation_layer.BaseApp", G_APPLICATION_NON_UNIQUE | G_APPLICATION_HANDLES_OPEN | G_APPLICATION_CAN_OVERRIDE_APP_ID); 20 | 21 | // cmdline related setup 22 | init_cmd_parameters(G_APPLICATION(app), callback_data); 23 | -------------------------------------------------------------------------------- /patches/vixl_meson_support.patch: -------------------------------------------------------------------------------- 1 | diff --git a/doc/aarch32/meson.build b/doc/aarch32/meson.build 2 | new file mode 100644 3 | index 00000000..6baf8d57 4 | --- /dev/null 5 | +++ b/doc/aarch32/meson.build 6 | @@ -0,0 +1,13 @@ 7 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 8 | +# 9 | +# SPDX-License-Identifier: BSD-3-Clause 10 | + 11 | +custom_target( 12 | + 'doc_aarch32', 13 | + command: [markdown, '@INPUT@'], 14 | + input: 'getting-started-aarch32.md', 15 | + output: '@BASENAME@.html', 16 | + capture: true, 17 | + install: true, 18 | + install_dir: doc_dir/'aarch32' 19 | +) 20 | diff --git a/doc/aarch64/meson.build b/doc/aarch64/meson.build 21 | new file mode 100644 22 | index 00000000..d6fe068d 23 | --- /dev/null 24 | +++ b/doc/aarch64/meson.build 25 | @@ -0,0 +1,22 @@ 26 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 27 | +# 28 | +# SPDX-License-Identifier: BSD-3-Clause 29 | + 30 | +doc_aarch64_files = [ 31 | + 'getting-started-aarch64', 32 | + 'supported-instructions-aarch64' 33 | +] 34 | + 35 | +foreach file : doc_aarch64_files 36 | + custom_target( 37 | + 'doc_aarch64_' + file, 38 | + command: [markdown, '@INPUT@'], 39 | + input: file + '.md', 40 | + output: file + '.html', 41 | + capture: true, 42 | + install: true, 43 | + install_dir: doc_dir/'aarch64' 44 | + ) 45 | +endforeach 46 | + 47 | +subdir('topics') 48 | diff --git a/doc/aarch64/topics/meson.build b/doc/aarch64/topics/meson.build 49 | new file mode 100644 50 | index 00000000..40a4f7df 51 | --- /dev/null 52 | +++ b/doc/aarch64/topics/meson.build 53 | @@ -0,0 +1,18 @@ 54 | +doc_aarch64_topics_files = [ 55 | + 'extending-the-disassembler', 56 | + 'index', 57 | + 'state-trace', 58 | + 'ycm' 59 | +] 60 | + 61 | +foreach file : doc_aarch64_topics_files 62 | + custom_target( 63 | + 'doc_aarch64_topics_' + file, 64 | + command: [markdown, '@INPUT@'], 65 | + input: file + '.md', 66 | + output: file + '.html', 67 | + capture: true, 68 | + install: true, 69 | + install_dir: doc_dir/'aarch64'/'topics' 70 | + ) 71 | +endforeach 72 | diff --git a/doc/meson.build b/doc/meson.build 73 | new file mode 100644 74 | index 00000000..f23f5c94 75 | --- /dev/null 76 | +++ b/doc/meson.build 77 | @@ -0,0 +1,22 @@ 78 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 79 | +# 80 | +# SPDX-License-Identifier: BSD-3-Clause 81 | + 82 | +doc_dir = get_option('datadir')/'doc'/meson.project_name() 83 | + 84 | +custom_target( 85 | + 'doc', 86 | + command: [markdown, '@INPUT@'], 87 | + input: '..'/'README.md', 88 | + output: '@BASENAME@.html', 89 | + capture: true, 90 | + install: true, 91 | + install_dir: doc_dir 92 | +) 93 | + 94 | +if build_a32 or build_t32 95 | + subdir('aarch32') 96 | +endif 97 | +if build_a64 98 | + subdir('aarch64') 99 | +endif 100 | diff --git a/meson.build b/meson.build 101 | new file mode 100644 102 | index 00000000..1f4e5646 103 | --- /dev/null 104 | +++ b/meson.build 105 | @@ -0,0 +1,151 @@ 106 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 107 | +# 108 | +# SPDX-License-Identifier: BSD-3-Clause 109 | + 110 | +project( 111 | + 'vixl', 112 | + 'cpp', 113 | + default_options: [ 114 | + 'cpp_std=c++17', 115 | + 'buildtype=release', 116 | + 'warning_level=3', 117 | + 'werror=false', 118 | + 'd_ndebug=if-release', 119 | + 'b_lto=true' 120 | + ], 121 | + license: 'BSD-3-Clause', 122 | + meson_version: '>=0.49.0', 123 | + version: '5.1.0', 124 | +) 125 | + 126 | +extra_args = [] 127 | + 128 | +if get_option('debug') 129 | + extra_args += '-DVIXL_DEBUG' 130 | +endif 131 | + 132 | +hosts_32bit = ['arc', 'arm', 'c2000', 'csky', 'mips', 'ppc', 'riscv32', 'rx', 'sparc', 'wasm32', 'x86'] 133 | +can_target_aarch64 = not (host_machine.cpu_family() in hosts_32bit) 134 | + 135 | +build_a32 = false 136 | +build_t32 = false 137 | +build_a64 = false 138 | + 139 | +targets = get_option('target') 140 | +if 'auto' in targets or 'all' in targets 141 | + if can_target_aarch64 or 'all' in targets 142 | + extra_args += [ 143 | + '-DVIXL_INCLUDE_TARGET_A32', 144 | + '-DVIXL_INCLUDE_TARGET_T32', 145 | + '-DVIXL_INCLUDE_TARGET_A64' 146 | + ] 147 | + build_a32 = true 148 | + build_t32 = true 149 | + build_a64 = true 150 | + else 151 | + extra_args += [ 152 | + '-DVIXL_INCLUDE_TARGET_A32', 153 | + '-DVIXL_INCLUDE_TARGET_T32' 154 | + ] 155 | + build_a32 = true 156 | + build_t32 = true 157 | + endif 158 | +else 159 | + if 'a32' in targets or 'aarch32' in targets 160 | + extra_args += [ 161 | + '-DVIXL_INCLUDE_TARGET_A32' 162 | + ] 163 | + build_a32 = true 164 | + endif 165 | + if 't32' in targets or 'aarch32' in targets 166 | + extra_args += [ 167 | + '-DVIXL_INCLUDE_TARGET_T32' 168 | + ] 169 | + build_t32 = true 170 | + endif 171 | + if 'a64' in targets or 'aarch64' in targets 172 | + extra_args += [ 173 | + '-DVIXL_INCLUDE_TARGET_A64' 174 | + ] 175 | + build_a64 = true 176 | + endif 177 | +endif 178 | + 179 | +target_sources = [] 180 | +if build_a32 or build_t32 181 | + subdir('src'/'aarch32') 182 | +endif 183 | +if build_a64 184 | + subdir('src'/'aarch64') 185 | +endif 186 | + 187 | +if get_option('simulator') == 'auto' 188 | + if not (host_machine.cpu_family() == 'aarch64') and can_target_aarch64 189 | + extra_args += '-DVIXL_INCLUDE_SIMULATOR_AARCH64' 190 | + endif 191 | +elif get_option('simulator') == 'aarch64' 192 | + if can_target_aarch64 and build_a64 193 | + extra_args += '-DVIXL_INCLUDE_SIMULATOR_AARCH64' 194 | + else 195 | + error('Building an AArch64 simulator implies that VIXL targets AArch64. Set `target` to include `aarch64` or `a64`.') 196 | + endif 197 | +endif 198 | + 199 | +allocator = get_option('code_buffer_allocator') 200 | +if (allocator == 'auto' and host_machine.system() == 'linux') or allocator == 'mmap' 201 | + extra_args += '-DVIXL_CODE_BUFFER_MMAP' 202 | +else 203 | + extra_args += '-DVIXL_CODE_BUFFER_MALLOC' 204 | +endif 205 | + 206 | +markdown = find_program('markdown', required: get_option('doc')) 207 | +if markdown.found() 208 | + subdir('doc') 209 | +endif 210 | + 211 | +libvixl = library( 212 | + 'vixl', 213 | + 'src'/'code-buffer-vixl.cc', 214 | + 'src'/'compiler-intrinsics-vixl.cc', 215 | + 'src'/'cpu-features.cc', 216 | + 'src'/'utils-vixl.cc', 217 | + cpp_args: extra_args, 218 | + include_directories: 'src', 219 | + install: true, 220 | + sources: target_sources, 221 | + version: meson.project_version() 222 | +) 223 | + 224 | +vixl_dep = declare_dependency( 225 | + compile_args: extra_args, 226 | + include_directories: 'src', 227 | + link_with: libvixl 228 | +) 229 | + 230 | +if meson.version().version_compare('>=0.54.0') 231 | + meson.override_dependency('vixl', vixl_dep) 232 | +endif 233 | + 234 | +install_headers( 235 | + 'src'/'assembler-base-vixl.h', 236 | + 'src'/'code-buffer-vixl.h', 237 | + 'src'/'code-generation-scopes-vixl.h', 238 | + 'src'/'compiler-intrinsics-vixl.h', 239 | + 'src'/'cpu-features.h', 240 | + 'src'/'globals-vixl.h', 241 | + 'src'/'invalset-vixl.h', 242 | + 'src'/'macro-assembler-interface.h', 243 | + 'src'/'platform-vixl.h', 244 | + 'src'/'pool-manager-impl.h', 245 | + 'src'/'pool-manager.h', 246 | + 'src'/'utils-vixl.h', 247 | + subdir: 'vixl' 248 | +) 249 | + 250 | +import('pkgconfig').generate( 251 | + libvixl, 252 | + description: 'ARMv8 Runtime Code Generation Library', 253 | + extra_cflags: extra_args, 254 | + subdirs: 'vixl', 255 | + url: 'https://github.com/Linaro/vixl' 256 | +) 257 | diff --git a/meson_options.txt b/meson_options.txt 258 | new file mode 100644 259 | index 00000000..602d4c82 260 | --- /dev/null 261 | +++ b/meson_options.txt 262 | @@ -0,0 +1,34 @@ 263 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 264 | +# 265 | +# SPDX-License-Identifier: BSD-3-Clause 266 | + 267 | +option( 268 | + 'target', 269 | + type: 'array', 270 | + choices: ['auto', 'all', 'aarch32', 'a32', 't32', 'aarch64', 'a64'], 271 | + value: ['auto'], 272 | + description: 'Target ISA/Architecture' 273 | +) 274 | + 275 | +option( 276 | + 'simulator', 277 | + type: 'combo', 278 | + choices: ['auto', 'aarch64', 'none'], 279 | + value: 'auto', 280 | + description: 'Simulators to include' 281 | +) 282 | + 283 | +option( 284 | + 'code_buffer_allocator', 285 | + type: 'combo', 286 | + choices: ['auto', 'malloc', 'mmap'], 287 | + value: 'auto', 288 | + description: 'Configure the allocation mechanism in the CodeBuffer' 289 | +) 290 | + 291 | +option( 292 | + 'doc', 293 | + type: 'feature', 294 | + value: 'auto', 295 | + description: 'Convert documentation to HTML (requires the `markdown` program)' 296 | +) 297 | diff --git a/src/aarch32/meson.build b/src/aarch32/meson.build 298 | new file mode 100644 299 | index 00000000..f4997860 300 | --- /dev/null 301 | +++ b/src/aarch32/meson.build 302 | @@ -0,0 +1,31 @@ 303 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 304 | +# 305 | +# SPDX-License-Identifier: BSD-3-Clause 306 | + 307 | +# Need to wrap the filenames in files() otherwise this array would be treated 308 | +# as a simple array of strings, and when used in the master meson.build they 309 | +# would refer to nonexistent paths. Wrapping in files() ensures that the 310 | +# filenames will be always relative to this directory, even if referenced in 311 | +# a different one. As a general rule, when I need to refer to a file from a 312 | +# different build directory I should wrap it in files(). 313 | + 314 | +target_sources += files( 315 | + 'assembler-aarch32.cc', 316 | + 'constants-aarch32.cc', 317 | + 'disasm-aarch32.cc', 318 | + 'instructions-aarch32.cc', 319 | + 'location-aarch32.cc', 320 | + 'macro-assembler-aarch32.cc', 321 | + 'operands-aarch32.cc' 322 | +) 323 | + 324 | +install_headers( 325 | + 'assembler-aarch32.h', 326 | + 'constants-aarch32.h', 327 | + 'disasm-aarch32.h', 328 | + 'instructions-aarch32.h', 329 | + 'location-aarch32.h', 330 | + 'macro-assembler-aarch32.h', 331 | + 'operands-aarch32.h', 332 | + subdir: 'vixl'/'aarch32' 333 | +) 334 | diff --git a/src/aarch64/meson.build b/src/aarch64/meson.build 335 | new file mode 100644 336 | index 00000000..9eaf0f9d 337 | --- /dev/null 338 | +++ b/src/aarch64/meson.build 339 | @@ -0,0 +1,47 @@ 340 | +# SPDX-FileCopyrightText: 2021 Andrea Pappacoda 341 | +# 342 | +# SPDX-License-Identifier: BSD-3-Clause 343 | + 344 | +# Need to wrap the filenames in files() otherwise this array would be treated 345 | +# as a simple array of strings, and when used in the master meson.build they 346 | +# would refer to nonexistent paths. Wrapping in files() ensures that the 347 | +# filenames will be always relative to this directory, even if referenced in 348 | +# a different one. As a general rule, when I need to refer to a file from a 349 | +# different build directory I should wrap it in files(). 350 | + 351 | +target_sources += files( 352 | + 'assembler-aarch64.cc', 353 | + 'assembler-sve-aarch64.cc', 354 | + 'cpu-aarch64.cc', 355 | + 'cpu-features-auditor-aarch64.cc', 356 | + 'decoder-aarch64.cc', 357 | + 'disasm-aarch64.cc', 358 | + 'instructions-aarch64.cc', 359 | + 'logic-aarch64.cc', 360 | + 'macro-assembler-aarch64.cc', 361 | + 'macro-assembler-sve-aarch64.cc', 362 | + 'operands-aarch64.cc', 363 | + 'pointer-auth-aarch64.cc', 364 | + 'registers-aarch64.cc', 365 | + 'simulator-aarch64.cc' 366 | +) 367 | + 368 | +install_headers( 369 | + 'abi-aarch64.h', 370 | + 'assembler-aarch64.h', 371 | + 'constants-aarch64.h', 372 | + 'cpu-aarch64.h', 373 | + 'cpu-features-auditor-aarch64.h', 374 | + 'debugger-aarch64.h', 375 | + 'decoder-aarch64.h', 376 | + 'decoder-constants-aarch64.h', 377 | + 'decoder-visitor-map-aarch64.h', 378 | + 'disasm-aarch64.h', 379 | + 'instructions-aarch64.h', 380 | + 'macro-assembler-aarch64.h', 381 | + 'operands-aarch64.h', 382 | + 'registers-aarch64.h', 383 | + 'simulator-aarch64.h', 384 | + 'simulator-constants-aarch64.h', 385 | + subdir: 'vixl'/'aarch64' 386 | +) 387 | 388 | --------------------------------------------------------------------------------