diff --git a/x11-packages/gl4es/CMakeLists.txt.patch b/x11-packages/gl4es/CMakeLists.txt.patch new file mode 100644 index 000000000..eba60f6eb --- /dev/null +++ b/x11-packages/gl4es/CMakeLists.txt.patch @@ -0,0 +1,22 @@ +diff -uNr gl4es/CMakeLists.txt gl4es.mod/CMakeLists.txt +--- gl4es/CMakeLists.txt 2021-10-13 23:49:59.659443188 +0800 ++++ gl4es.mod/CMakeLists.txt 2021-10-13 23:48:57.547443233 +0800 +@@ -13,6 +13,7 @@ + option(BCMHOST "Set to ON if targeting an RPi(2) device" ${BCMHOST}) + option(ODROID "Set to ON if targeting an ODroid device" ${ODROID}) + option(ANDROID "Set to ON if targeting an Android device" ${ANDROID}) ++option(TERMUX "Set to ON if targeting Termux environment" ${TERMUX}) + option(CHIP "Set to ON if targeting an C.H.I.P. device" ${CHIP}) + option(AMIGAOS4 "Set to ON if targeting an AmigaOS4/Warp3D platform (activate NOEGL and NOX11)" ${AMIGAOS4}) + option(NOX11 "Set to ON to not use X11 (creation of context has to be done outside gl4es)" ${NOX11}) +@@ -99,6 +100,10 @@ + find_library(log-lib log) + endif() + ++if(TERMUX) ++ add_definitions(-DNO_GBM -DDEFAULT_ES=2) ++endif() ++ + #PocketCHIP + if(CHIP) + add_definitions(-DCHIP) diff --git a/x11-packages/gl4es/build.sh b/x11-packages/gl4es/build.sh index 21fa9778b..4ef3c9ac1 100644 --- a/x11-packages/gl4es/build.sh +++ b/x11-packages/gl4es/build.sh @@ -1,8 +1,31 @@ -TERMUX_PKG_HOMEPAGE=http://ptitseb.github.io/gl4es/ +TERMUX_PKG_HOMEPAGE=https://ptitseb.github.io/gl4es/ TERMUX_PKG_DESCRIPTION="OpenGL driver for GLES devices" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@suhan-paradkar" TERMUX_PKG_VERSION=1.1.4 +TERMUX_PKG_REVISION=1 +_COMMIT=dab338dc5d16807a071454e6116faf09c37f8a31 TERMUX_PKG_SRCURL=https://github.com/ptitSeb/gl4es.git -TERMUX_PKG_DEPENDS="libandroid-shmem, libexpat, libdrm, libx11, libxdamage, libxext, libxml2, libxshmfence, zlib" +TERMUX_PKG_GIT_BRANCH=master +TERMUX_PKG_DEPENDS="libx11" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DTERMUX=ON +-DCMAKE_SYSTEM_NAME=Linux +" +termux_step_post_get_source() { + git pull + git reset --hard ${_COMMIT} +} + +termux_step_pre_configure() { + # lets go crazy with optimization as we only build one shared library + # current highest fps output (on my A30s): + # -O2 -flto > -O3 -flto > -O2 > -Os > -Os -flto > -O3 > -Oz > -Oz -flto + export CFLAGS="${CFLAGS/-Oz/-O2} -flto" + export AR="llvm-ar" # remove this after NDK 23 landed +} + +termux_step_post_make_install() { + ln -fsT "libGL.so.1" "$TERMUX_PREFIX/lib/gl4es/libGL.so" +} diff --git a/x11-packages/gl4es/framebuffers.c.patch b/x11-packages/gl4es/framebuffers.c.patch deleted file mode 100644 index fcaaf7169..000000000 --- a/x11-packages/gl4es/framebuffers.c.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -uNr gl4es/src/CMakeLists.txt gl4es.mod/src/CMakeLists.txt ---- gl4es/src/CMakeLists.txt 2021-06-21 07:53:58.734942738 +0000 -+++ gl4es.mod/src/CMakeLists.txt 2021-06-21 08:02:39.158267430 +0000 -@@ -211,10 +211,10 @@ - endif() - install(TARGETS GL - LIBRARY -- DESTINATION "/usr/lib/gl4es/" -+ DESTINATION "@TERMUX_PREFIX@/lib/gl4es/" - ) - install(FILES "../include/gl4esinit.h" "../include/gl4eshint.h" -- DESTINATION "/usr/include/gl4es/" -+ DESTINATION "@TERMUX_PREFIX@/include/gl4es/" - ) - endif() - -diff -uNr gl4es/src/gl/framebuffers.c gl4es.mod/src/gl/framebuffers.c ---- gl4es/src/gl/framebuffers.c 2021-06-21 07:53:58.742943357 +0000 -+++ gl4es.mod/src/gl/framebuffers.c 2021-06-21 07:55:02.829910677 +0000 -@@ -1,6 +1,6 @@ - #include "framebuffers.h" - --#if !defined(ANDROID) && !defined(AMIGAOS4) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__) -+#if !defined(__ANDROID__) && !defined(AMIGAOS4) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__) - #include - #endif - #include "../glx/hardext.h" -diff -uNr gl4es/src/gl/init.c gl4es.mod/src/gl/init.c ---- gl4es/src/gl/init.c 2021-06-21 07:53:58.743943435 +0000 -+++ gl4es.mod/src/gl/init.c 2021-06-21 07:57:22.429734941 +0000 -@@ -1,4 +1,4 @@ --#if !defined(ANDROID) && !defined(AMIGAOS4) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__) -+#if !defined(__ANDROID__) && !defined(AMIGAOS4) && !defined(__EMSCRIPTEN__) && !defined(__APPLE__) - #include - #endif - #include diff --git a/x11-packages/gl4es/src_CMakeLists.txt.patch b/x11-packages/gl4es/src_CMakeLists.txt.patch new file mode 100644 index 000000000..d8986676f --- /dev/null +++ b/x11-packages/gl4es/src_CMakeLists.txt.patch @@ -0,0 +1,16 @@ +diff -uNr gl4es/src/CMakeLists.txt gl4es.mod/src/CMakeLists.txt +--- gl4es/src/CMakeLists.txt 2021-06-21 07:53:58.734942738 +0000 ++++ gl4es.mod/src/CMakeLists.txt 2021-06-21 08:02:39.158267430 +0000 +@@ -224,10 +224,10 @@ else() + endif() + install(TARGETS GL + LIBRARY +- DESTINATION "/usr/lib/gl4es/" ++ DESTINATION "@TERMUX_PREFIX@/lib/gl4es/" + ) + install(FILES "../include/gl4esinit.h" "../include/gl4eshint.h" +- DESTINATION "/usr/include/gl4es/" ++ DESTINATION "@TERMUX_PREFIX@/include/gl4es/" + ) + endif() + diff --git a/x11-packages/gl4es/src_glx_glx.c.patch b/x11-packages/gl4es/src_glx_glx.c.patch new file mode 100644 index 000000000..c2a1000b8 --- /dev/null +++ b/x11-packages/gl4es/src_glx_glx.c.patch @@ -0,0 +1,39 @@ +diff -uNr gl4es/src/glx/glx.c gl4es.mod/src/glx/glx.c +--- gl4es/src/glx/glx.c 2021-10-13 23:49:59.663443188 +0800 ++++ gl4es.mod/src/glx/glx.c 2021-10-13 23:48:57.699443233 +0800 +@@ -770,8 +770,11 @@ + } + + result = egl_eglChooseConfig(eglDisplay, configAttribs, fake->eglConfigs, 64, &fake->eglConfigsCount); ++ ++#ifndef NO_GBM + if(fake->eglConfigsCount && globals4es.usegbm) + fake->eglconfigIdx = FindGBMConfig(eglDisplay, fake->eglConfigs, fake->eglConfigsCount); ++#endif + + CheckEGLErrors(); + if (result != EGL_TRUE || fake->eglConfigsCount == 0) { +@@ -951,10 +954,12 @@ + } + + result = egl_eglChooseConfig(eglDisplay, configAttribs, fake->eglConfigs, 64, &fake->eglConfigsCount); ++ ++ fake->eglconfigIdx = 0; ++#ifndef NO_GBM + if(fake->eglConfigsCount && globals4es.usegbm) + fake->eglconfigIdx = FindGBMConfig(eglDisplay, fake->eglConfigs, fake->eglConfigsCount); +- else +- fake->eglconfigIdx = 0; ++#endif + + CheckEGLErrors(); + if (result != EGL_TRUE || fake->eglConfigsCount == 0) { +@@ -1819,7 +1824,7 @@ + attr[cur++] = EGL_STENCIL_SIZE; + attr[cur++] = tmp; + } +- attr[1] |= (globals4es.usepbuffer)?(/*EGL_PBUFFER_BIT|*/EGL_PIXMAP_BIT):EGL_WINDOW_BIT; ++ attr[1] |= (globals4es.usepbuffer)?(EGL_PBUFFER_BIT/*|EGL_PIXMAP_BIT*/):EGL_WINDOW_BIT; + + attr[cur++] = EGL_RENDERABLE_TYPE; + attr[cur++] = (hardext.esversion==1)?EGL_OPENGL_ES_BIT:EGL_OPENGL_ES2_BIT;