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/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 ae930d2a15..e6b0eccc20 100644 --- a/packages/mesa/build.sh +++ b/packages/mesa/build.sh @@ -4,14 +4,15 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="docs/license.rst" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=23.0.0 -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://archive.mesa3d.org/mesa-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=01f3cff3763f09e0adabcb8011e4aebc6ad48f6a4dd4bae904fe918707d253e4 -TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libexpat, libglvnd, libx11, libxext, libxfixes, libxshmfence, libxxf86vm, ncurses, zlib, zstd" +TERMUX_PKG_DEPENDS="libandroid-shmem, libc++, libdrm, libexpat, libglvnd, libx11, libxext, libxfixes, libxshmfence, libxxf86vm, ncurses, zlib, zstd, glslang, libvdpau" TERMUX_PKG_SUGGESTS="mesa-dev" TERMUX_PKG_BUILD_DEPENDS="libllvm-static, libxrandr, llvm, llvm-tools, mlir, xorgproto" 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 @@ -28,7 +29,10 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -Dshared-llvm=disabled -Dplatforms=x11 -Dgallium-drivers=swrast,virgl --Dvulkan-drivers=swrast +-Dgallium-extra-hud=true +-Dgallium-vdpau=enabled +-Dvulkan-drivers=intel,swrast,virtio-experimental +-Dvulkan-layers=device-select,intel-nullhw,overlay -Dosmesa=true -Dglvnd=true -Dxmlconfig=disabled @@ -36,9 +40,10 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" termux_step_pre_configure() { termux_setup_cmake + termux_setup_glslang CPPFLAGS+=" -D__USE_GNU" - LDFLAGS+=" -landroid-shmem" + LDFLAGS+=" -landroid-shmem -lexpat" _WRAPPER_BIN=$TERMUX_PKG_BUILDDIR/_wrapper/bin mkdir -p $_WRAPPER_BIN 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/scripts/build/setup/termux_setup_glslang.sh b/scripts/build/setup/termux_setup_glslang.sh new file mode 100644 index 0000000000..440f3bdb22 --- /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" \ + b94d4f620e714bd7e213c3d7d255dc306bbf17d404dc29f693b48629201b3d3a + 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 +}