From 478f2e062f903b85fc589c11e37c53079fe9d1e1 Mon Sep 17 00:00:00 2001 From: Maxython Date: Thu, 9 Mar 2023 23:26:32 +0300 Subject: [PATCH] mesa: acceleration --- build-package.sh | 2 + packages/libclc/CMakeLists.txt.patch | 11 ++ packages/libclc/build.sh | 59 ++++++ packages/libdrm/build.sh | 10 +- packages/libdrm/threaded.c.patch | 38 ++++ packages/libomxil-bellagio/build.sh | 17 ++ packages/libomxil-bellagio/configure.ac.patch | 10 + packages/libva/build.sh | 16 ++ packages/libvdpau/build.sh | 17 ++ ...{meson.build.patch => 1-meson.build.patch} | 0 packages/mesa/2-meson.build.patch | 10 + packages/mesa/build.sh | 32 ++- packages/mesa/draw_llvm.c.patch | 81 ++++++++ packages/mesa/nine_memory_helper.c.patch | 10 + packages/mesa/set_tmp_dir.patch | 165 ++++++++++++++++ packages/mesa/sfn_memorypool.cpp.patch | 17 ++ ...gallium-drivers-llvmpipe-lp_screen.c.patch | 15 -- packages/mesa/target.c.patch | 11 ++ packages/spirv-headers/build.sh | 13 ++ packages/spirv-llvm-translator/build.sh | 24 +++ packages/spirv-llvm-translator/setlib.patch | 186 ++++++++++++++++++ packages/spirv-tools/build.sh | 21 ++ packages/vulkan-loader-generic/build.sh | 8 +- scripts/build/setup/termux_setup_glslang.sh | 33 ++++ scripts/setup-ubuntu.sh | 4 + 25 files changed, 782 insertions(+), 28 deletions(-) create mode 100644 packages/libclc/CMakeLists.txt.patch create mode 100644 packages/libclc/build.sh create mode 100644 packages/libdrm/threaded.c.patch create mode 100644 packages/libomxil-bellagio/build.sh create mode 100644 packages/libomxil-bellagio/configure.ac.patch create mode 100644 packages/libva/build.sh create mode 100644 packages/libvdpau/build.sh rename packages/mesa/{meson.build.patch => 1-meson.build.patch} (100%) create mode 100644 packages/mesa/2-meson.build.patch create mode 100644 packages/mesa/draw_llvm.c.patch create mode 100644 packages/mesa/nine_memory_helper.c.patch create mode 100644 packages/mesa/set_tmp_dir.patch create mode 100644 packages/mesa/sfn_memorypool.cpp.patch delete mode 100644 packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.patch create mode 100644 packages/mesa/target.c.patch create mode 100644 packages/spirv-headers/build.sh create mode 100644 packages/spirv-llvm-translator/build.sh create mode 100644 packages/spirv-llvm-translator/setlib.patch create mode 100644 packages/spirv-tools/build.sh create mode 100644 scripts/build/setup/termux_setup_glslang.sh diff --git a/build-package.sh b/build-package.sh index ea2b499f58..431506735f 100755 --- a/build-package.sh +++ b/build-package.sh @@ -144,6 +144,8 @@ source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_cmake.sh" # shellcheck source=scripts/build/setup/termux_setup_protobuf.sh source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_protobuf.sh" +source "$TERMUX_SCRIPTDIR/scripts/build/setup/termux_setup_glslang.sh" + # Setup variables used by the build. Not to be overridden by packages. # shellcheck source=scripts/build/termux_step_setup_variables.sh source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_setup_variables.sh" diff --git a/packages/libclc/CMakeLists.txt.patch b/packages/libclc/CMakeLists.txt.patch new file mode 100644 index 0000000000..851156f471 --- /dev/null +++ b/packages/libclc/CMakeLists.txt.patch @@ -0,0 +1,11 @@ +--- libclc-16.0.1.src/CMakeLists.txt 2023-04-05 06:36:38.000000000 +0300 ++++ libclc-16.0.1.src/CMakeLists.txt.patch 2023-04-13 13:43:55.134228201 +0300 +@@ -326,7 +326,7 @@ + + # Add prepare target + add_custom_command( OUTPUT "${obj_suffix}" +- COMMAND prepare_builtins -o ++ COMMAND "./prepare_builtins_hb" -o + "${obj_suffix}" + "builtins.opt.${obj_suffix}" + DEPENDS "opt.${obj_suffix}" diff --git a/packages/libclc/build.sh b/packages/libclc/build.sh new file mode 100644 index 0000000000..7384feb642 --- /dev/null +++ b/packages/libclc/build.sh @@ -0,0 +1,59 @@ +TERMUX_PKG_HOMEPAGE=https://libclc.llvm.org/ +TERMUX_PKG_DESCRIPTION="Library requirements of the OpenCL C programming language" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=16.0.1 +TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/libclc-$TERMUX_PKG_VERSION.src.tar.xz +TERMUX_PKG_SHA256=23e4c684d50200ab6ec2b0120b4da2531ce8144b131a558ba0d42ab4efe0d996 +TERMUX_PKG_BUILD_DEPENDS="libllvm-static, spirv-llvm-translator" +TERMUX_PKG_PLATFORM_INDEPENDENT=true +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_HOSTBUILD=true + +termux_step_host_build() { + termux_setup_cmake + termux_setup_ninja + mkdir -p $TERMUX_PKG_SRCDIR/build + termux_download https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/libclc-$TERMUX_PKG_VERSION.src.tar.xz \ + libclc.src.tar.xz \ + $TERMUX_PKG_SHA256 + tar xJf libclc.src.tar.xz + cd libclc-$TERMUX_PKG_VERSION.src + mkdir build + cd build + cmake .. -G Ninja \ + -DLLVM_SPIRV=/usr/bin/llvm-spirv \ + -DCMAKE_MODULE_PATH=$TERMUX_PREFIX/lib/cmake/llvm + ninja prepare_builtins + mkdir -p $TERMUX_PKG_SRCDIR/build + mv prepare_builtins $TERMUX_PKG_SRCDIR/build/prepare_builtins_hb +} + +termux_step_pre_configure() { + CXXFLAGS+=" -I$TERMUX_PREFIX/include" + LDFLAGS+=" -lz -lzstd -ltinfo" +} + +termux_step_configure() { + cd build + cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \ + -DLLVM_SPIRV=/usr/bin/llvm-spirv \ + -DLLVM_CLANG=$(command -v $CC) \ + -DLLVM_AS=$(command -v llvm-as) \ + -DLLVM_LINK=$(command -v llvm-link) \ + -DLLVM_OPT=/usr/lib/llvm-13/bin/opt \ + -DLLVM_CMAKE_DIR=$TERMUX_PREFIX/lib/cmake/llvm \ + -DCMAKE_MODULE_PATH=$TERMUX_PREFIX/lib/cmake/llvm +} + +termux_step_make() { + cd build + ninja +} + +termux_step_make_install() { + cd build + ninja install +} diff --git a/packages/libdrm/build.sh b/packages/libdrm/build.sh index c1ae132a6a..5421e03e76 100644 --- a/packages/libdrm/build.sh +++ b/packages/libdrm/build.sh @@ -3,16 +3,14 @@ TERMUX_PKG_DESCRIPTION="Userspace interface to kernel DRM services" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=2.4.115 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://dri.freedesktop.org/libdrm/libdrm-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=554cfbfe0542bddb391b4e3e05bfbbfc3e282b955bd56218d21c0616481f65eb TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --Dintel=disabled --Dradeon=disabled --Damdgpu=disabled --Dnouveau=disabled --Dvmwgfx=disabled --Dtests=false +-Dvalgrind=disabled +-Dudev=false +-Dinstall-test-programs=true " termux_step_pre_configure() { diff --git a/packages/libdrm/threaded.c.patch b/packages/libdrm/threaded.c.patch new file mode 100644 index 0000000000..145f4fd41d --- /dev/null +++ b/packages/libdrm/threaded.c.patch @@ -0,0 +1,38 @@ +--- src/tests/nouveau/threaded.c 2023-03-13 10:01:32.898802503 +0300 ++++ src/tests/nouveau/threaded.c.patch 2023-03-13 10:02:05.108802491 +0300 +@@ -31,15 +31,14 @@ + #include "xf86drm.h" + #include "nouveau.h" + +-static __typeof__(ioctl) *old_ioctl; + static int failed; + + static int import_fd; + + #if defined(__GLIBC__) || defined(__FreeBSD__) +-int ioctl(int fd, unsigned long request, ...) ++int ioctl_new(int fd, unsigned long request, ...) + #else +-int ioctl(int fd, int request, ...) ++int ioctl_new(int fd, int request, ...) + #endif + { + va_list va; +@@ -48,7 +47,7 @@ + + va_start(va, request); + arg = va_arg(va, void *); +- ret = old_ioctl(fd, request, arg); ++ ret = ioctl(fd, request, arg); + va_end(va); + + if (ret < 0 && request == DRM_IOCTL_GEM_CLOSE && errno == EINVAL) +@@ -80,8 +79,6 @@ + struct nouveau_bo *bo; + pthread_t t1, t2; + +- old_ioctl = dlsym(RTLD_NEXT, "ioctl"); +- + if (argc < 2) { + fd = drmOpenWithType("nouveau", NULL, DRM_NODE_RENDER); + if (fd >= 0) diff --git a/packages/libomxil-bellagio/build.sh b/packages/libomxil-bellagio/build.sh new file mode 100644 index 0000000000..764c79b861 --- /dev/null +++ b/packages/libomxil-bellagio/build.sh @@ -0,0 +1,17 @@ +TERMUX_PKG_HOMEPAGE=http://omxil.sourceforge.net +TERMUX_PKG_DESCRIPTION="An opensource implementation of the OpenMAX Integration Layer API" +TERMUX_PKG_LICENSE="LGPL-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=0.9.3 +TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/omxil/omxil/Bellagio%200.9.3/libomxil-bellagio-$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=593c0729c8ef8c1467b3bfefcf355ec19a46dd92e31bfc280e17d96b0934d74c +TERMUX_PKG_DEPENDS="libc++" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-static +" + +termux_step_pre_configure() { + sed -e 's/-Werror//' -i configure.ac + sed -e 's/-lomxil-bellagio//' -i src/Makefile.* + CFLAGS+=' -fcommon' +} diff --git a/packages/libomxil-bellagio/configure.ac.patch b/packages/libomxil-bellagio/configure.ac.patch new file mode 100644 index 0000000000..d7d7c4d310 --- /dev/null +++ b/packages/libomxil-bellagio/configure.ac.patch @@ -0,0 +1,10 @@ +--- libomxil-bellagio-0.9.3/configure.ac 2023-03-12 22:17:09.598818625 +0300 ++++ libomxil-bellagio-0.9.3/configure.ac.patch 2023-03-12 22:35:17.768818210 +0300 +@@ -231,7 +231,6 @@ + # Check for library functions # + ################################################################################ + +-AC_FUNC_MALLOC + AC_FUNC_REALLOC + AC_CHECK_FUNCS([gethostbyname gettimeofday memset mkdir socket strdup strerror strndup strrchr]) + diff --git a/packages/libva/build.sh b/packages/libva/build.sh new file mode 100644 index 0000000000..5ed6892deb --- /dev/null +++ b/packages/libva/build.sh @@ -0,0 +1,16 @@ +TERMUX_PKG_HOMEPAGE=https://01.org/linuxmedia/vaapi +TERMUX_PKG_DESCRIPTION="Video Acceleration (VA) API for Linux" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=2.17.0 +TERMUX_PKG_SRCURL=https://github.com/intel/libva/releases/download/$TERMUX_PKG_VERSION/libva-$TERMUX_PKG_VERSION.tar.bz2 +TERMUX_PKG_SHA256=f3e5eb27c305e05a9bb62703d1915a127301cc0c4f9f209025767432230c4eac +TERMUX_PKG_DEPENDS="libdrm, libglvnd, libx11, libxext, libxfixes, libwayland" +TERMUX_PKG_BUILD_DEPENDS="libglvnd" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-static +" + +termux_step_pre_configure() { + CFLAGS+=" -DENABLE_VA_MESSAGING" +} diff --git a/packages/libvdpau/build.sh b/packages/libvdpau/build.sh new file mode 100644 index 0000000000..ea4eafdb47 --- /dev/null +++ b/packages/libvdpau/build.sh @@ -0,0 +1,17 @@ +TERMUX_PKG_HOMEPAGE=libvdpau +TERMUX_PKG_DESCRIPTION="Nvidia VDPAU library" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.5 +TERMUX_PKG_SRCURL=https://gitlab.freedesktop.org/vdpau/libvdpau/-/archive/$TERMUX_PKG_VERSION/libvdpau-$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=66490802f30426d30ff9e8af35263bbbbaa23b52d0a2d797d06959c3d19638fd +TERMUX_PKG_DEPENDS="libxext" +TERMUX_PKG_BUILD_DEPENDS="xorgproto" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--prefix=$TERMUX_PREFIX +" + +termux_step_pre_configure() { + termux_setup_meson + termux_setup_ninja +} diff --git a/packages/mesa/meson.build.patch b/packages/mesa/1-meson.build.patch similarity index 100% rename from packages/mesa/meson.build.patch rename to packages/mesa/1-meson.build.patch diff --git a/packages/mesa/2-meson.build.patch b/packages/mesa/2-meson.build.patch new file mode 100644 index 0000000000..31966875ab --- /dev/null +++ b/packages/mesa/2-meson.build.patch @@ -0,0 +1,10 @@ +--- mesa-23.0.0/meson.build 2023-02-23 05:36:49.000000000 +0300 ++++ mesa-23.0.0/meson.build.patch 2023-03-11 18:38:50.288856581 +0300 +@@ -1178,7 +1178,6 @@ + '-Werror=missing-prototypes', + '-Werror=return-type', + '-Werror=empty-body', +- '-Werror=incompatible-pointer-types', + '-Werror=int-conversion', + '-Wimplicit-fallthrough', + '-Wmisleading-indentation', diff --git a/packages/mesa/build.sh b/packages/mesa/build.sh index 6d01c7d0ab..70df0f9d9a 100644 --- a/packages/mesa/build.sh +++ b/packages/mesa/build.sh @@ -4,13 +4,15 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="docs/license.rst" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=23.0.2 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://archive.mesa3d.org/mesa-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=1b7d3399fc6f16f030361f925d33ebc7600cbf98094582f54775b6a1180529e7 -TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libexpat, libglvnd, libwayland, libx11, libxext, libxfixes, libxshmfence, libxxf86vm, ncurses, zlib, zstd" +TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libexpat, libglvnd, libwayland, libx11, libxext, libxfixes, libxshmfence, libxxf86vm, ncurses, zlib, zstd, glslang, libvdpau, valgrind, libva, libomxil-bellagio, libelf, vulkan-loader-generic" TERMUX_PKG_SUGGESTS="mesa-dev" -TERMUX_PKG_BUILD_DEPENDS="libllvm-static, libwayland-protocols, libxrandr, llvm, llvm-tools, mlir, xorgproto" +TERMUX_PKG_BUILD_DEPENDS="libllvm-static, libwayland-protocols, libxrandr, llvm, llvm-tools, mlir, xorgproto, rust" TERMUX_PKG_CONFLICTS="libmesa, ndk-sysroot (<= 25b)" TERMUX_PKG_REPLACES="libmesa" +TERMUX_PKG_PYTHON_COMMON_DEPS="mako" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --cmake-prefix-path $TERMUX_PREFIX @@ -26,18 +28,36 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -Dllvm=enabled -Dshared-llvm=disabled -Dplatforms=x11,wayland --Dgallium-drivers=swrast,virgl --Dvulkan-drivers=swrast +-Dgallium-drivers=r300,r600,radeonsi,freedreno,nouveau,swrast,virgl,zink,d3d12,etnaviv,kmsro,lima,panfrost,v3d,vc4,asahi,svga,tegra +-Dgallium-extra-hud=true +-Dgallium-nine=true +-Dgallium-omx=bellagio +-Dgallium-va=enabled +-Dgallium-vdpau=enabled +-Dgallium-xa=enabled +-Dvulkan-drivers=amd,swrast,broadcom,panfrost,virtio-experimental +-Dvulkan-layers=overlay -Dosmesa=true -Dglvnd=true -Dxmlconfig=disabled +-Dvalgrind=enabled +-Dshared-glapi=enabled +-Dmicrosoft-clc=disabled +-Db_ndebug=true +-Dgallium-rusticl=true +-Drust_std=none " termux_step_pre_configure() { termux_setup_cmake + termux_setup_rust + termux_setup_glslang - CPPFLAGS+=" -D__USE_GNU" - LDFLAGS+=" -landroid-shmem" + CFLAGS+=' -g1' + CXXFLAGS+=' -g1' + + CPPFLAGS+=" -D__USE_GNU -fno-rtti" + LDFLAGS+=" -landroid-shmem -lexpat" _WRAPPER_BIN=$TERMUX_PKG_BUILDDIR/_wrapper/bin mkdir -p $_WRAPPER_BIN diff --git a/packages/mesa/draw_llvm.c.patch b/packages/mesa/draw_llvm.c.patch new file mode 100644 index 0000000000..253e215191 --- /dev/null +++ b/packages/mesa/draw_llvm.c.patch @@ -0,0 +1,81 @@ +--- mesa-23.0.0/src/gallium/auxiliary/draw/draw_llvm.c 2023-02-23 05:36:49.000000000 +0300 ++++ mesa-23.0.0/src/gallium/auxiliary/draw/draw_llvm.c.patch 2023-03-18 11:33:37.928635601 +0300 +@@ -872,12 +872,15 @@ + variant = MALLOC(sizeof *variant + + shader->variant_key_size - + sizeof variant->key); ++ printf("ok1\n"); + if (!variant) + return NULL; ++ printf("ok2\n"); + + variant->llvm = llvm; + variant->shader = shader; + memcpy(&variant->key, key, shader->variant_key_size); ++ printf("ok3\n"); + + snprintf(module_name, sizeof(module_name), "draw_llvm_vs_variant%u", + variant->shader->variants_cached); +@@ -888,40 +891,59 @@ + shader->variant_key_size, + num_inputs, + ir_sha1_cache_key); ++ printf("ok3.1\n"); + + llvm->draw->disk_cache_find_shader(llvm->draw->disk_cache_cookie, + &cached, + ir_sha1_cache_key); ++ printf("ok3.2\n"); + if (!cached.data_size) + needs_caching = true; + } ++ printf("ok4\n"); + variant->gallivm = gallivm_create(module_name, llvm->context, &cached); ++ printf("ok5\n"); + + create_jit_types(variant); ++ printf("ok6\n"); + + if (gallivm_debug & (GALLIVM_DEBUG_TGSI | GALLIVM_DEBUG_IR)) { +- if (llvm->draw->vs.vertex_shader->state.type == PIPE_SHADER_IR_TGSI) ++ if (llvm->draw->vs.vertex_shader->state.type == PIPE_SHADER_IR_TGSI) { + tgsi_dump(llvm->draw->vs.vertex_shader->state.tokens, 0); +- else ++ printf("ok6.1\n"); ++ } else { + nir_print_shader(llvm->draw->vs.vertex_shader->state.ir.nir, stderr); ++ printf("ok6.2\n"); ++ } + draw_llvm_dump_variant_key(&variant->key); ++ printf("ok6.3\n"); + } ++ printf("ok7\n"); + + variant->vertex_header_type = create_jit_vertex_header(variant->gallivm, num_inputs); ++ printf("ok8\n"); + variant->vertex_header_ptr_type = LLVMPointerType(variant->vertex_header_type, 0); ++ printf("ok9\n"); + + draw_llvm_generate(llvm, variant); ++ printf("ok10\n"); + + gallivm_compile_module(variant->gallivm); ++ printf("ok11\n"); + + variant->jit_func = (draw_jit_vert_func) + gallivm_jit_function(variant->gallivm, variant->function); ++ printf("ok12\n"); + +- if (needs_caching) ++ if (needs_caching) { + llvm->draw->disk_cache_insert_shader(llvm->draw->disk_cache_cookie, + &cached, + ir_sha1_cache_key); ++ printf("ok12.1\n"); ++ } ++ printf("ok13\n"); + gallivm_free_ir(variant->gallivm); ++ printf("ok14\n"); + + variant->list_item_global.base = variant; + variant->list_item_local.base = variant; diff --git a/packages/mesa/nine_memory_helper.c.patch b/packages/mesa/nine_memory_helper.c.patch new file mode 100644 index 0000000000..834082cd7f --- /dev/null +++ b/packages/mesa/nine_memory_helper.c.patch @@ -0,0 +1,10 @@ +--- mesa-23.0.0/src/gallium/frontends/nine/nine_memory_helper.c 2023-02-23 05:36:49.000000000 +0300 ++++ mesa-23.0.0/src/gallium/frontends/nine/nine_memory_helper.c.patch 2023-03-11 20:15:13.458854375 +0300 +@@ -90,7 +90,6 @@ + #include + #include + #include +-#include + #include + + #include "util/list.h" diff --git a/packages/mesa/set_tmp_dir.patch b/packages/mesa/set_tmp_dir.patch new file mode 100644 index 0000000000..26541cc64d --- /dev/null +++ b/packages/mesa/set_tmp_dir.patch @@ -0,0 +1,165 @@ +diff --git a/src/amd/common/ac_rgp.c b/src/amd/common/ac_rgp.c +index ca42f67..a128993 100644 +--- a/src/amd/common/ac_rgp.c ++++ b/src/amd/common/ac_rgp.c +@@ -1178,7 +1178,7 @@ int ac_dump_rgp_capture(struct radeon_info *info, + t = time(NULL); + now = *localtime(&t); + +- snprintf(filename, sizeof(filename), "/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rgp", ++ snprintf(filename, sizeof(filename), "@TERMUX_PREFIX@/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rgp", + util_get_process_name(), 1900 + now.tm_year, now.tm_mon + 1, now.tm_mday, now.tm_hour, + now.tm_min, now.tm_sec); + +diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp +index ecfdb95..6d9480d 100644 +--- a/src/amd/compiler/aco_print_asm.cpp ++++ b/src/amd/compiler/aco_print_asm.cpp +@@ -177,7 +177,7 @@ print_asm_clrx(Program* program, std::vector& binary, unsigned exec_si + #ifdef _WIN32 + return true; + #else +- char path[] = "/tmp/fileXXXXXX"; ++ char path[] = "@TERMUX_PREFIX@/tmp/fileXXXXXX"; + char line[2048], command[128]; + FILE* p; + int fd; +diff --git a/src/amd/vulkan/layers/radv_rra_layer.c b/src/amd/vulkan/layers/radv_rra_layer.c +index 573baf9..657ec61 100644 +--- a/src/amd/vulkan/layers/radv_rra_layer.c ++++ b/src/amd/vulkan/layers/radv_rra_layer.c +@@ -74,7 +74,7 @@ radv_rra_handle_trace(VkQueue _queue) + t = time(NULL); + now = *localtime(&t); + +- snprintf(filename, sizeof(filename), "/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rra", ++ snprintf(filename, sizeof(filename), "@TERMUX_PREFIX@/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rra", + util_get_process_name(), 1900 + now.tm_year, now.tm_mon + 1, now.tm_mday, now.tm_hour, + now.tm_min, now.tm_sec); + +@@ -365,4 +365,4 @@ rra_DestroyAccelerationStructureKHR(VkDevice _device, VkAccelerationStructureKHR + simple_mtx_unlock(&device->rra_trace.data_mtx); + + device->layer_dispatch.rra.DestroyAccelerationStructureKHR(_device, _structure, pAllocator); +-} +\ No newline at end of file ++} +diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c +index a8a0a1c..253565f 100644 +--- a/src/amd/vulkan/radv_debug.c ++++ b/src/amd/vulkan/radv_debug.c +@@ -837,7 +837,7 @@ void + radv_print_spirv(const char *data, uint32_t size, FILE *fp) + { + #ifndef _WIN32 +- char path[] = "/tmp/fileXXXXXX"; ++ char path[] = "@TERMUX_PREIFX@/tmp/fileXXXXXX"; + char command[128]; + int fd; + +diff --git a/src/broadcom/vulkan/v3dv_debug.c b/src/broadcom/vulkan/v3dv_debug.c +index 065e8f6..733f35f 100644 +--- a/src/broadcom/vulkan/v3dv_debug.c ++++ b/src/broadcom/vulkan/v3dv_debug.c +@@ -32,7 +32,7 @@ + void + v3dv_print_spirv(const char *data, uint32_t size, FILE *fp) + { +- char path[] = "/tmp/fileXXXXXX"; ++ char path[] = "@TERMUX_PREFIX@/tmp/fileXXXXXX"; + char line[2048], command[128]; + FILE *p; + int fd; +diff --git a/src/freedreno/decode/replay.c b/src/freedreno/decode/replay.c +index 8001dec..bb361ba 100644 +--- a/src/freedreno/decode/replay.c ++++ b/src/freedreno/decode/replay.c +@@ -462,7 +462,7 @@ static int + override_cmdstream(struct device *dev, struct cmdstream *cs, + const char *cmdstreamgen) + { +- static const char *tmpfilename = "/tmp/cmdstream_override.rd"; ++ static const char *tmpfilename = "@TERMUX_PREFIX@/tmp/cmdstream_override.rd"; + + /* Find a free space for the new cmdstreams and resources we will use + * when overriding existing cmdstream. +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +index 54bc5d5..dfcbb78 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +@@ -233,9 +233,9 @@ lp_profile(LLVMValueRef func, const void *code) + if (getenv("PERF_BUILDID_DIR")) { + pid_t pid = getpid(); + char filename[256]; +- snprintf(filename, sizeof filename, "/tmp/perf-%llu.map", (unsigned long long)pid); ++ snprintf(filename, sizeof filename, "@TERMUX_PREIFX@/tmp/perf-%llu.map", (unsigned long long)pid); + perf_map_file = fopen(filename, "wt"); +- snprintf(filename, sizeof filename, "/tmp/perf-%llu.map.asm", (unsigned long long)pid); ++ snprintf(filename, sizeof filename, "@TERMUX_PREFIX@/tmp/perf-%llu.map.asm", (unsigned long long)pid); + perf_asm_file.open(filename); + } + first_time = FALSE; +diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp +index 7a50fea..ab43146 100644 +--- a/src/gallium/frontends/clover/llvm/invocation.cpp ++++ b/src/gallium/frontends/clover/llvm/invocation.cpp +@@ -355,7 +355,7 @@ namespace { + name, ::llvm::MemoryBuffer::getMemBuffer(source).release()); + + if (headers.size()) { +- const std::string tmp_header_path = "/tmp/clover/"; ++ const std::string tmp_header_path = "@TERMUX_PREFIX@/tmp/clover/"; + + c.getHeaderSearchOpts().AddPath(tmp_header_path, + clang::frontend::Angled, +diff --git a/src/gtest/src/gtest-port.cc b/src/gtest/src/gtest-port.cc +index fc5ba6b..0c81248 100644 +--- a/src/gtest/src/gtest-port.cc ++++ b/src/gtest/src/gtest-port.cc +@@ -1105,9 +1105,9 @@ class CapturedStream { + // The location /data/local/tmp is directly accessible from native code. + // '/sdcard' and other variants cannot be relied on, as they are not + // guaranteed to be mounted, or may have a delay in mounting. +- char name_template[] = "/data/local/tmp/gtest_captured_stream.XXXXXX"; ++ char name_template[] = "@TERMUX_PREFIX@/tmp/gtest_captured_stream.XXXXXX"; + # else +- char name_template[] = "/tmp/captured_stream.XXXXXX"; ++ char name_template[] = "@TERMUX_PREFIX@/tmp/captured_stream.XXXXXX"; + # endif // GTEST_OS_LINUX_ANDROID + const int captured_fd = mkstemp(name_template); + if (captured_fd == -1) { +diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c +index 43a68d1..eccc512 100644 +--- a/src/mesa/main/debug.c ++++ b/src/mesa/main/debug.c +@@ -286,7 +286,7 @@ write_texture_image(struct gl_texture_object *texObj, + GL_RGBA, GL_UNSIGNED_BYTE, buffer, img); + + /* make filename */ +- snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); ++ snprintf(s, sizeof(s), "@TERMUX_PREFIX@/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); + + printf(" Writing image level %u to %s\n", level, s); + write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); +@@ -332,7 +332,7 @@ _mesa_write_renderbuffer_image(const struct gl_renderbuffer *rb) + format, type, &ctx->DefaultPacking, buffer); + + /* make filename */ +- snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name); ++ snprintf(s, sizeof(s), "@TERMUX_PREFIX@/tmp/renderbuffer%u.ppm", rb->Name); + snprintf(s, sizeof(s), "C:\\renderbuffer%u.ppm", rb->Name); + + printf(" Writing renderbuffer image to %s\n", s); +diff --git a/src/vulkan/util/rmv/vk_rmv_exporter.c b/src/vulkan/util/rmv/vk_rmv_exporter.c +index 026441a..dd92f10 100644 +--- a/src/vulkan/util/rmv/vk_rmv_exporter.c ++++ b/src/vulkan/util/rmv/vk_rmv_exporter.c +@@ -1699,7 +1699,7 @@ vk_dump_rmv_capture(struct vk_memory_trace_data *data) + time_t t = time(NULL); + now = *localtime(&t); + +- snprintf(filename, sizeof(filename), "/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rmv", ++ snprintf(filename, sizeof(filename), "@TERMUX_PREFIX@/tmp/%s_%04d.%02d.%02d_%02d.%02d.%02d.rmv", + util_get_process_name(), 1900 + now.tm_year, now.tm_mon + 1, now.tm_mday, now.tm_hour, + now.tm_min, now.tm_sec); + diff --git a/packages/mesa/sfn_memorypool.cpp.patch b/packages/mesa/sfn_memorypool.cpp.patch new file mode 100644 index 0000000000..85fa375e2c --- /dev/null +++ b/packages/mesa/sfn_memorypool.cpp.patch @@ -0,0 +1,17 @@ +--- mesa-23.0.0/src/gallium/drivers/r600/sfn/sfn_memorypool.cpp 2023-02-23 05:36:49.000000000 +0300 ++++ mesa-23.0.0/src/gallium/drivers/r600/sfn/sfn_memorypool.cpp.patch 2023-03-13 10:23:58.108801990 +0300 +@@ -36,6 +36,14 @@ + #include + #endif + ++#if defined(__ANDROID__) && __ANDROID_API__ < 26 ++void *aligned_alloc(size_t align, size_t size) { ++ void *result = NULL; ++ posix_memalign(&result, align, size); ++ return result; ++} ++#endif ++ + namespace r600 { + + #ifndef HAVE_MEMORY_RESOURCE diff --git a/packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.patch b/packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.patch deleted file mode 100644 index b6ad84b1db..0000000000 --- a/packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.patch +++ /dev/null @@ -1,15 +0,0 @@ -Disable multithreading by default because it seems to introduce a significant -overhead when enabled. - ---- a/src/gallium/drivers/llvmpipe/lp_screen.c -+++ b/src/gallium/drivers/llvmpipe/lp_screen.c -@@ -1092,6 +1092,9 @@ - screen->num_threads = debug_get_num_option("LP_NUM_THREADS", - screen->num_threads); - screen->num_threads = MIN2(screen->num_threads, LP_MAX_THREADS); -+#if defined __ANDROID__ -+ screen->num_threads = 0; -+#endif - - lp_build_init(); /* get lp_native_vector_width initialised */ - diff --git a/packages/mesa/target.c.patch b/packages/mesa/target.c.patch new file mode 100644 index 0000000000..97e12f3070 --- /dev/null +++ b/packages/mesa/target.c.patch @@ -0,0 +1,11 @@ +--- mesa-23.0.2/src/gallium/targets/dri/target.c 2023-04-07 19:22:42.000000000 +0300 ++++ mesa-23.0.2/src/gallium/targets/dri/target.c.patch 2023-04-14 10:04:26.314200266 +0300 +@@ -129,7 +129,7 @@ + #endif + + #if defined(GALLIUM_ZINK) && !defined(__APPLE__) +-#if defined(ANDROID) ++#if defined(__ANDROID__) + DEFINE_LOADER_DRM_ENTRYPOINT(zink); + #else + const __DRIextension **__driDriverGetExtensions_zink(void); diff --git a/packages/spirv-headers/build.sh b/packages/spirv-headers/build.sh new file mode 100644 index 0000000000..6380117778 --- /dev/null +++ b/packages/spirv-headers/build.sh @@ -0,0 +1,13 @@ +TERMUX_PKG_HOMEPAGE=https://www.khronos.org/registry/spir-v/ +TERMUX_PKG_DESCRIPTION="SPIR-V Headers" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.3.236.0 +TERMUX_PKG_SRCURL=https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-$TERMUX_PKG_VERSION/spirv-headers-$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=4d74c685fdd74469eba7c224dd671a0cb27df45fc9aa43cdd90e53bd4f2b2b78 +TERMUX_PKG_DEPENDS="libc++" +TERMUX_PKG_PLATFORM_INDEPENDENT=true + +termux_step_pre_configure() { + termux_setup_cmake +} diff --git a/packages/spirv-llvm-translator/build.sh b/packages/spirv-llvm-translator/build.sh new file mode 100644 index 0000000000..b052fde7ed --- /dev/null +++ b/packages/spirv-llvm-translator/build.sh @@ -0,0 +1,24 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/KhronosGroup/SPIRV-LLVM-Translator +TERMUX_PKG_DESCRIPTION="Tool and a library for bi-directional translation between SPIR-V and LLVM IR" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="LICENSE.TXT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=16.0.0 +TERMUX_PKG_SRCURL=https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256="305fac5bb8efdad9054f0d27b5b765aca8b3349a500e2ba0c927763e42badc2b" +TERMUX_PKG_DEPENDS="spirv-tools" +TERMUX_PKG_BUILD_DEPENDS="spirv-headers, libllvm-static, llvm" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DBUILD_SHARED_LIBS=ON +-DCMAKE_BUILD_TYPE=Release +-DCMAKE_SKIP_RPATH=ON +-DCMAKE_POSITION_INDEPENDENT_CODE=ON +-DLLVM_INCLUDE_TESTS=ON +-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$TERMUX_PREFIX/include/spirv/ +-Wno-dev +" + +termux_step_pre_configure() { + termux_setup_cmake + LDFLAGS+=" -lLLVM" +} diff --git a/packages/spirv-llvm-translator/setlib.patch b/packages/spirv-llvm-translator/setlib.patch new file mode 100644 index 0000000000..03d7eddc99 --- /dev/null +++ b/packages/spirv-llvm-translator/setlib.patch @@ -0,0 +1,186 @@ +diff --git a/lib/SPIRV/PreprocessMetadata.cpp b/lib/SPIRV/PreprocessMetadata.cpp +index 830f158..42a7d1e 100644 +--- a/lib/SPIRV/PreprocessMetadata.cpp ++++ b/lib/SPIRV/PreprocessMetadata.cpp +@@ -247,7 +247,9 @@ void PreprocessMetadataBase::visit(Module *M) { + InterfaceMode = 1; + EM.addOp() + .add(&Kernel) ++#if !defined(__ANDROID__) + .add(spv::ExecutionModeStreamingInterfaceINTEL) ++#endif + .add(InterfaceMode) + .done(); + } +diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp +index b4c6211..d3e640e 100644 +--- a/lib/SPIRV/SPIRVReader.cpp ++++ b/lib/SPIRV/SPIRVReader.cpp +@@ -3999,6 +3999,7 @@ bool SPIRVToLLVM::transMetadata() { + getMDNodeStringIntVec(Context, EM->getLiterals())); + } + // Generate metadata for Intel FPGA streaming interface ++#if !defined(__ANDROID__) + if (auto *EM = BF->getExecutionMode(ExecutionModeStreamingInterfaceINTEL)) { + std::vector InterfaceVec = EM->getLiterals(); + assert(InterfaceVec.size() == 1 && +@@ -4018,6 +4019,7 @@ bool SPIRVToLLVM::transMetadata() { + F->setMetadata(kSPIR2MD::IntelFPGAIPInterface, + MDNode::get(*Context, InterfaceMDVec)); + } ++#endif + } + NamedMDNode *MemoryModelMD = + M->getOrInsertNamedMetadata(kSPIRVMD::MemoryModel); +diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp +index 3286731..060267b 100644 +--- a/lib/SPIRV/SPIRVWriter.cpp ++++ b/lib/SPIRV/SPIRVWriter.cpp +@@ -2434,20 +2434,25 @@ static void transMetadataDecorations(Metadata *MD, SPIRVEntry *Target) { + SPIRVWord); + TWO_INT_DECORATION_CASE(MathOpDSPModeINTEL, spv, SPIRVWord, SPIRVWord); + ++#if !defined(__ANDROID__) + case DecorationConduitKernelArgumentINTEL: + case DecorationRegisterMapKernelArgumentINTEL: + case DecorationStableKernelArgumentINTEL: ++#endif + case DecorationRestrict: { + Target->addDecorate(new SPIRVDecorate(DecoKind, Target)); + break; + } + case DecorationBufferLocationINTEL: ++#if !defined(__ANDROID__) + case DecorationMMHostInterfaceReadWriteModeINTEL: + case DecorationMMHostInterfaceAddressWidthINTEL: + case DecorationMMHostInterfaceDataWidthINTEL: + case DecorationMMHostInterfaceLatencyINTEL: + case DecorationMMHostInterfaceMaxBurstINTEL: +- case DecorationMMHostInterfaceWaitRequestINTEL: { ++ case DecorationMMHostInterfaceWaitRequestINTEL: ++#endif ++ { + ErrLog.checkError(NumOperands == 2, SPIRVEC_InvalidLlvmModule, + "MMHost Kernel Argument Annotation requires exactly 2 " + "extra operands"); +@@ -4916,7 +4921,10 @@ bool LLVMToSPIRVBase::transExecutionMode() { + case spv::ExecutionModeNumSIMDWorkitemsINTEL: + case spv::ExecutionModeSchedulerTargetFmaxMhzINTEL: + case spv::ExecutionModeMaxWorkDimINTEL: +- case spv::ExecutionModeStreamingInterfaceINTEL: { ++#if !defined(__ANDROID__) ++ case spv::ExecutionModeStreamingInterfaceINTEL: ++#endif ++ { + if (!BM->isAllowedToUseExtension( + ExtensionID::SPV_INTEL_kernel_attributes)) + break; +diff --git a/lib/SPIRV/libSPIRV/SPIRVDecorate.h b/lib/SPIRV/libSPIRV/SPIRVDecorate.h +index 3f50f61..e8a62dc 100644 +--- a/lib/SPIRV/libSPIRV/SPIRVDecorate.h ++++ b/lib/SPIRV/libSPIRV/SPIRVDecorate.h +@@ -178,6 +178,7 @@ public: + case internal::DecorationInitModeINTEL: + case internal::DecorationImplementInCSRINTEL: + return ExtensionID::SPV_INTEL_global_variable_decorations; ++#if !defined(__ANDROID__) + case DecorationConduitKernelArgumentINTEL: + case DecorationRegisterMapKernelArgumentINTEL: + case DecorationStableKernelArgumentINTEL: +@@ -188,6 +189,7 @@ public: + case DecorationMMHostInterfaceMaxBurstINTEL: + case DecorationMMHostInterfaceWaitRequestINTEL: + return ExtensionID::SPV_INTEL_fpga_argument_interfaces; ++#endif + default: + return {}; + } +diff --git a/lib/SPIRV/libSPIRV/SPIRVEntry.cpp b/lib/SPIRV/libSPIRV/SPIRVEntry.cpp +index 54475a9..c5fa009 100644 +--- a/lib/SPIRV/libSPIRV/SPIRVEntry.cpp ++++ b/lib/SPIRV/libSPIRV/SPIRVEntry.cpp +@@ -614,7 +614,9 @@ void SPIRVExecutionMode::decode(std::istream &I) { + case ExecutionModeMaxWorkDimINTEL: + case ExecutionModeNumSIMDWorkitemsINTEL: + case ExecutionModeSchedulerTargetFmaxMhzINTEL: ++#if !defined(__ANDROID__) + case ExecutionModeStreamingInterfaceINTEL: ++#endif + WordLiterals.resize(1); + break; + default: +diff --git a/lib/SPIRV/libSPIRV/SPIRVEnum.h b/lib/SPIRV/libSPIRV/SPIRVEnum.h +index 3b6bd15..1fc7b3a 100644 +--- a/lib/SPIRV/libSPIRV/SPIRVEnum.h ++++ b/lib/SPIRV/libSPIRV/SPIRVEnum.h +@@ -261,8 +261,10 @@ template <> inline void SPIRVMap::init() { + {CapabilityVectorComputeINTEL}); + ADD_VEC_INIT(internal::ExecutionModeFastCompositeKernelINTEL, + {internal::CapabilityFastCompositeINTEL}); ++#if !defined(__ANDROID__) + ADD_VEC_INIT(ExecutionModeStreamingInterfaceINTEL, + {CapabilityFPGAKernelAttributesINTEL}); ++#endif + ADD_VEC_INIT(ExecutionModeNamedBarrierCountINTEL, + {CapabilityVectorComputeINTEL}); + } +@@ -451,6 +453,7 @@ template <> inline void SPIRVMap::init() { + {internal::CapabilityGlobalVariableDecorationsINTEL}); + ADD_VEC_INIT(internal::DecorationArgumentAttributeINTEL, + {CapabilityFunctionPointersINTEL}); ++#if !defined(__ANDROID__) + ADD_VEC_INIT(DecorationConduitKernelArgumentINTEL, + {CapabilityFPGAArgumentInterfacesINTEL}); + ADD_VEC_INIT(DecorationRegisterMapKernelArgumentINTEL, +@@ -469,6 +472,7 @@ template <> inline void SPIRVMap::init() { + {CapabilityFPGAArgumentInterfacesINTEL}); + ADD_VEC_INIT(DecorationStableKernelArgumentINTEL, + {CapabilityFPGAArgumentInterfacesINTEL}); ++#endif + } + + template <> inline void SPIRVMap::init() { +diff --git a/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h b/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h +index 093141d..5c658e9 100644 +--- a/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h ++++ b/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h +@@ -71,7 +71,9 @@ inline bool isValid(spv::ExecutionModel V) { + case ExecutionModelClosestHitKHR: + case ExecutionModelMissKHR: + case ExecutionModelCallableKHR: ++#if !defined(__ANDROID__) + case ExecutionModeStreamingInterfaceINTEL: ++#endif + return true; + default: + return false; +diff --git a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h b/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h +index 2a34e0b..df8eb7a 100644 +--- a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h ++++ b/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h +@@ -183,6 +183,7 @@ template <> inline void SPIRVMap::init() { + add(DecorationInitiationIntervalINTEL, "InitiationIntervalINTEL"); + add(DecorationMaxConcurrencyINTEL, "MaxConcurrencyINTEL"); + add(DecorationPipelineEnableINTEL, "PipelineEnableINTEL"); ++#if !defined(__ANDROID__) + add(DecorationConduitKernelArgumentINTEL, "ConduitKernelArgumentINTEL"); + add(DecorationRegisterMapKernelArgumentINTEL, + "RegisterMapKernelArgumentINTEL"); +@@ -196,6 +197,7 @@ template <> inline void SPIRVMap::init() { + add(DecorationMMHostInterfaceWaitRequestINTEL, + "MMHostInterfaceWaitRequestINTEL"); + add(DecorationStableKernelArgumentINTEL, "StableKernelArgumentINTEL"); ++#endif + + // From spirv_internal.hpp + add(internal::DecorationCallableFunctionINTEL, "CallableFunctionINTEL"); +@@ -615,7 +617,9 @@ template <> inline void SPIRVMap::init() { + "FPGAInvocationPipeliningAttributesINTEL"); + add(CapabilityRuntimeAlignedAttributeINTEL, "RuntimeAlignedAttributeINTEL"); + add(CapabilityMax, "Max"); ++#if !defined(__ANDROID__) + add(CapabilityFPGAArgumentInterfacesINTEL, "FPGAArgumentInterfacesINTEL"); ++#endif + + // From spirv_internal.hpp + add(internal::CapabilityFastCompositeINTEL, "FastCompositeINTEL"); diff --git a/packages/spirv-tools/build.sh b/packages/spirv-tools/build.sh new file mode 100644 index 0000000000..dab31dea0c --- /dev/null +++ b/packages/spirv-tools/build.sh @@ -0,0 +1,21 @@ +TERMUX_PKG_HOMEPAGE=https://www.khronos.org/vulkan/ +TERMUX_PKG_DESCRIPTION="API and commands for processing SPIR-V modules" +TERMUX_PKG_LICENSE="Apache-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=2022.4 +TERMUX_PKG_SRCURL=https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256="a156215a2d7c6c5b267933ed691877a9a66f07d75970da33ce9ad627a71389d7" +TERMUX_PKG_DEPENDS="bash" +TERMUX_PKG_BUILD_DEPENDS="spirv-headers" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DSPIRV_WERROR=Off +-DBUILD_SHARED_LIBS=ON +-DSPIRV_TOOLS_BUILD_STATIC=OFF +-DCMAKE_BUILD_TYPE=None +-DSPIRV-Headers_SOURCE_DIR=$prefix +" + +termux_step_pre_configure() { + termux_setup_cmake + termux_setup_ninja +} diff --git a/packages/vulkan-loader-generic/build.sh b/packages/vulkan-loader-generic/build.sh index 7829b5550f..d804110ae5 100644 --- a/packages/vulkan-loader-generic/build.sh +++ b/packages/vulkan-loader-generic/build.sh @@ -3,14 +3,20 @@ TERMUX_PKG_DESCRIPTION="Vulkan Loader" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.3.247" +TERMUX_PKG_REVISION="1" TERMUX_PKG_SRCURL=https://github.com/KhronosGroup/Vulkan-Loader/archive/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=1d0062e8cd78cb25140a784b50eee3b44f0be346c1a8d0c645e41394c2e56290 -TERMUX_PKG_BUILD_DEPENDS="vulkan-headers (=${TERMUX_PKG_VERSION}), libx11, libxcb, libxrandr" +TERMUX_PKG_BUILD_DEPENDS="vulkan-headers (=${TERMUX_PKG_VERSION}), libx11, libxcb, libxrandr, libwayland" TERMUX_PKG_CONFLICTS="vulkan-loader-android" TERMUX_PKG_PROVIDES="vulkan-loader-android" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DVULKAN_HEADERS_INSTALL_DIR=$TERMUX_PREFIX -DBUILD_TESTS=OFF +-DBUILD_WSI_XCB_SUPPORT=On +-DBUILD_WSI_XLIB_SUPPORT=On +-DBUILD_WSI_WAYLAND_SUPPORT=On +-DCMAKE_BUILD_TYPE=Release +-DCMAKE_SKIP_RPATH=True " TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag" diff --git a/scripts/build/setup/termux_setup_glslang.sh b/scripts/build/setup/termux_setup_glslang.sh new file mode 100644 index 0000000000..ffb4f63cc2 --- /dev/null +++ b/scripts/build/setup/termux_setup_glslang.sh @@ -0,0 +1,33 @@ +termux_setup_glslang() { + local GLSLANG_FOLDER + + if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then + GLSLANG_FOLDER=${TERMUX_SCRIPTDIR}/build-tools/glslang-main-tot + else + GLSLANG_FOLDER=${TERMUX_COMMON_CACHEDIR}/glslang-main-tot + fi + + if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then + if [ ! -d "$GLSLANG_FOLDER" ]; then + mkdir -p "$GLSLANG_FOLDER" + local GLSLANG_ZIP_FILE=$TERMUX_PKG_TMPDIR/glslang-main-linux-Release.zip + termux_download https://github.com/KhronosGroup/glslang/releases/download/main-tot/glslang-main-linux-Release.zip \ + "$GLSLANG_ZIP_FILE" \ + "SKIP_CHECKSUM" + unzip "$GLSLANG_ZIP_FILE" -d "$GLSLANG_FOLDER" + fi + export PATH=$GLSLANG_FOLDER/bin:$PATH + else + if [[ "$TERMUX_APP_PACKAGE_MANAGER" = "apt" && "$(dpkg-query -W -f '${db:Status-Status}\n' glslang 2>/dev/null)" != "installed" ]] || + [[ "$TERMUX_APP_PACKAGE_MANAGER" = "pacman" && ! "$(pacman -Q glslang 2>/dev/null)" ]]; then + echo "Package 'cmake' is not installed." + echo "You can install it with" + echo + echo " pkg install glslang" + echo + echo " pacman -S glslang" + echo + exit 1 + fi + fi +} diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 8df8a138fc..e63003e7a0 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -292,6 +292,10 @@ PACKAGES+=" libwebp7 libwebp7:i386 libwebp-dev" PACKAGES+=" libwebpdemux2 libwebpdemux2:i386" PACKAGES+=" libwebpmux3 libwebpmux3:i386" +# Required by libclc +PACKAGES+=" llvm-13" +PACKAGES+=" llvm-spirv" + # Do not require sudo if already running as root. if [ "$(id -u)" = "0" ]; then SUDO=""