Skip to content

Commit

Permalink
mesa: build more drive vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Mar 11, 2023
1 parent 1f390b7 commit ecdcced
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
2 changes: 2 additions & 0 deletions build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions packages/libvdpau/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 7 additions & 4 deletions packages/mesa/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,17 +29,19 @@ 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
"

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
Expand Down
33 changes: 33 additions & 0 deletions scripts/build/setup/termux_setup_glslang.sh
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit ecdcced

Please sign in to comment.