From 1310ba6677fc1a1324500e43a2a4675bf770c5d4 Mon Sep 17 00:00:00 2001 From: Maxython Date: Thu, 9 Mar 2023 23:26:32 +0300 Subject: [PATCH] mesa: build more drive vulkan --- build-package.sh | 2 ++ packages/libvdpau/build.sh | 17 ++++++++++ packages/mesa/build.sh | 11 ++++--- ...lium-drivers-llvmpipe-lp_screen.c.disable} | 0 scripts/build/setup/termux_setup_glslang.sh | 33 +++++++++++++++++++ 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 packages/libvdpau/build.sh rename packages/mesa/{src-gallium-drivers-llvmpipe-lp_screen.c.patch => src-gallium-drivers-llvmpipe-lp_screen.c.disable} (100%) 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/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/build.sh b/packages/mesa/build.sh index ae930d2a15..aa4709a32d 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" 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,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -Dshared-llvm=disabled -Dplatforms=x11 -Dgallium-drivers=swrast,virgl --Dvulkan-drivers=swrast +-Dvulkan-drivers=intel,swrast,virtio-experimental +-Dvulkan-layers=device-select,intel-nullhw,overlay -Dosmesa=true -Dglvnd=true -Dxmlconfig=disabled @@ -36,9 +38,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.disable similarity index 100% rename from packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.patch rename to packages/mesa/src-gallium-drivers-llvmpipe-lp_screen.c.disable 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 +}