Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virgl-angle: add venus interface and on device build #23104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions packages/virglrenderer-android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,21 @@ termux_step_host_build() {
if [ $TERMUX_ARCH = arm ]; then
CCTERMUX_HOST_PLATFORM=armv7a-linux-androideabi$TERMUX_PKG_API_LEVEL
fi

if $TERMUX_ON_DEVICE_BUILD; then
local _INSTALL_PREFIX=$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/opt/$TERMUX_PKG_NAME
CC=clang
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to set CC and CXX. $CCTERMUX_HOST_PLATFORM-clang/clang++ also exist when on-device build.

CXX=c++
CROSS=
# need android 30+
# vim $PREFIX/include/sys/mman.h -c /memfd_create
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memfd_create should be patched to syscall(SYS_memfd_create, ...).

export CFLAGS="--target=aarch64-linux-android30 -w "
else
local _INSTALL_PREFIX=$TERMUX_PREFIX/opt/$TERMUX_PKG_NAME
CC=$(command -v $CCTERMUX_HOST_PLATFORM-clang)
CXX=$(command -v $CCTERMUX_HOST_PLATFORM-clang++)
CROSS=--cross-file $TERMUX_MESON_CROSSFILE
CFLAGS=
fi

PKG_CONFIG="$TERMUX_PKG_TMPDIR/host-build-pkg-config"
local _HOST_PKGCONFIG=$(command -v pkg-config)
Expand All @@ -42,20 +55,17 @@ termux_step_host_build() {
chmod +x $PKG_CONFIG

AR=$(command -v llvm-ar)
CC=$(command -v $CCTERMUX_HOST_PLATFORM-clang)
CXX=$(command -v $CCTERMUX_HOST_PLATFORM-clang++)
LD=$(command -v ld.lld)
CFLAGS=""
CPPFLAGS=""
CXXFLAGS=""
LDFLAGS="-Wl,-rpath=$_INSTALL_PREFIX/lib"
export LDFLAGS="-Wl,-rpath=$_INSTALL_PREFIX/lib"
STRIP=$(command -v llvm-strip)
termux_setup_meson

# Compile libepoxy
mkdir -p libepoxy-build
$TERMUX_MESON $TERMUX_PKG_SRCDIR/libepoxy libepoxy-build \
--cross-file $TERMUX_MESON_CROSSFILE \
$CROSS \
--prefix=$_INSTALL_PREFIX \
--libdir lib \
-Degl=yes -Dglx=no -Dx11=false
Expand All @@ -64,14 +74,19 @@ termux_step_host_build() {
# Compile virglrenderer
mkdir -p virglrenderer-build
$TERMUX_MESON $TERMUX_PKG_SRCDIR virglrenderer-build \
--cross-file $TERMUX_MESON_CROSSFILE \
$CROSS \
--prefix=$_INSTALL_PREFIX \
--libdir lib \
-Dplatforms=egl
-Dplatforms=egl \
-Dvenus=true
ninja -C virglrenderer-build install -j $TERMUX_PKG_MAKE_PROCESSES

# i have to say everything twice as usual
patchelf --set-rpath $_INSTALL_PREFIX/lib $_INSTALL_PREFIX/bin/virgl_test_server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patchelf doesn't exist in the host builder image. This will break the normal build progress when cross-compling.


# Move our virglrenderer binary to regular bin directory.
mv $_INSTALL_PREFIX/bin/virgl_test_server $TERMUX_PREFIX/bin/virgl_test_server_android
mkdir $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use TERMUX_PKG_MASSAGEDIR, unless you know what you are doing. I haven't found any need to use it.

mv $_INSTALL_PREFIX/bin/virgl_test_server $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/bin/virgl-angle

# Cleanup.
rm -rf $_INSTALL_PREFIX/{bin,include,lib/pkgconfig}
Expand Down
Loading