diff --git a/x11-packages/libwayland-protocols/build.sh b/x11-packages/libwayland-protocols/build.sh new file mode 100644 index 000000000..cb499579c --- /dev/null +++ b/x11-packages/libwayland-protocols/build.sh @@ -0,0 +1,14 @@ +TERMUX_PKG_HOMEPAGE=https://wayland.freedesktop.org/ +TERMUX_PKG_DESCRIPTION="Wayland protocols library" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.17 +TERMUX_PKG_REVISION=4 +TERMUX_PKG_SRCURL=https://wayland.freedesktop.org/releases/wayland-protocols-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=df1319cf9705643aea9fd16f9056f4e5b2471bd10c0cc3713d4a4cdc23d6812f +TERMUX_PKG_DEPENDS="libandroid-support" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-documentation --with-host-scanner" + +termux_step_post_make_install() { + mv ${TERMUX_PREFIX}/share/pkgconfig/wayland-protocols.pc ${TERMUX_PREFIX}/lib/pkgconfig/ +} diff --git a/x11-packages/libwayland/Makefile.am.patch b/x11-packages/libwayland/Makefile.am.patch new file mode 100644 index 000000000..d175564ed --- /dev/null +++ b/x11-packages/libwayland/Makefile.am.patch @@ -0,0 +1,28 @@ ++++ ./Makefile.am +@@ -71,7 +71,7 @@ + protocol/wayland-client-protocol.h + + libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread +-libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm ++libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lm + libwayland_server_la_LDFLAGS = -version-info 1:0:1 + libwayland_server_la_SOURCES = \ + src/wayland-server.c \ +@@ -83,7 +83,7 @@ + protocol/wayland-protocol.c + + libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread +-libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm ++libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lm + libwayland_client_la_LDFLAGS = -version-info 3:0:3 + libwayland_client_la_SOURCES = \ + src/wayland-client.c +@@ -227,7 +227,7 @@ + libwayland-client.la \ + libwayland-server.la \ + libtest-helpers.la \ +- -lrt -ldl $(FFI_LIBS) ++ -ldl $(FFI_LIBS) + + array_test_SOURCES = tests/array-test.c + array_test_LDADD = libtest-runner.la diff --git a/x11-packages/libwayland/build.sh b/x11-packages/libwayland/build.sh new file mode 100644 index 000000000..e5c01947d --- /dev/null +++ b/x11-packages/libwayland/build.sh @@ -0,0 +1,18 @@ +TERMUX_PKG_HOMEPAGE=https://wayland.freedesktop.org/ +TERMUX_PKG_DESCRIPTION="Wayland protocol library" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.17.0 +TERMUX_PKG_REVISION=6 +TERMUX_PKG_SRCURL=https://wayland.freedesktop.org/releases/wayland-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=72aa11b8ac6e22f4777302c9251e8fec7655dc22f9d94ee676c6b276f95f91a4 +TERMUX_PKG_DEPENDS="libandroid-support, libffi, libxml2, libexpat" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-documentation --with-host-scanner" + +termux_step_pre_configure() { + autoreconf -fi +} + +termux_step_post_make_install() { + sed -i 's/wayland_scanner=${exec_prefix}\/bin\/wayland-scanner/wayland_scanner=\/usr\/bin\/wayland-scanner/g' /data/data/com.termux/files/usr/lib/pkgconfig/wayland-scanner.pc +} diff --git a/x11-packages/libwayland/xdg-runtime-dir.patch b/x11-packages/libwayland/xdg-runtime-dir.patch new file mode 100644 index 000000000..208f65dd6 --- /dev/null +++ b/x11-packages/libwayland/xdg-runtime-dir.patch @@ -0,0 +1,46 @@ +diff -uNr wayland-1.17.0/cursor/os-compatibility.c wayland-1.17.0.mod/cursor/os-compatibility.c +--- wayland-1.17.0/cursor/os-compatibility.c 2019-03-21 02:55:25.000000000 +0200 ++++ wayland-1.17.0.mod/cursor/os-compatibility.c 2019-07-01 22:32:38.256153848 +0300 +@@ -111,8 +111,7 @@ + + path = getenv("XDG_RUNTIME_DIR"); + if (!path) { +- errno = ENOENT; +- return -1; ++ path = "@TERMUX_PREFIX@/tmp"; + } + + name = malloc(strlen(path) + sizeof(template)); +diff -uNr wayland-1.17.0/src/wayland-client.c wayland-1.17.0.mod/src/wayland-client.c +--- wayland-1.17.0/src/wayland-client.c 2019-03-21 02:55:25.000000000 +0200 ++++ wayland-1.17.0.mod/src/wayland-client.c 2019-07-01 22:33:25.633279646 +0300 +@@ -962,11 +962,7 @@ + + runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (!runtime_dir && !path_is_absolute) { +- wl_log("error: XDG_RUNTIME_DIR not set in the environment.\n"); +- /* to prevent programs reporting +- * "failed to create display: Success" */ +- errno = ENOENT; +- return -1; ++ runtime_dir = "@TERMUX_PREFIX@/tmp"; + } + + fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0); +diff -uNr wayland-1.17.0/src/wayland-server.c wayland-1.17.0.mod/src/wayland-server.c +--- wayland-1.17.0/src/wayland-server.c 2019-03-21 02:55:25.000000000 +0200 ++++ wayland-1.17.0.mod/src/wayland-server.c 2019-07-01 22:34:05.100325582 +0300 +@@ -1427,12 +1427,7 @@ + + runtime_dir = getenv("XDG_RUNTIME_DIR"); + if (!runtime_dir) { +- wl_log("error: XDG_RUNTIME_DIR not set in the environment\n"); +- +- /* to prevent programs reporting +- * "failed to add socket: Success" */ +- errno = ENOENT; +- return -1; ++ runtime_dir = "@TERMUX_PREFIX@/tmp"; + } + + s->addr.sun_family = AF_LOCAL; diff --git a/x11-packages/xwayland/build.sh b/x11-packages/xwayland/build.sh new file mode 100644 index 000000000..0136d0df5 --- /dev/null +++ b/x11-packages/xwayland/build.sh @@ -0,0 +1,78 @@ +TERMUX_PKG_HOMEPAGE=https://xorg.freedesktop.org/wiki/ +TERMUX_PKG_DESCRIPTION="Wayland X11 server" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.20.5 +TERMUX_PKG_REVISION=6 +TERMUX_PKG_SRCURL=https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-${TERMUX_PKG_VERSION}.tar.bz2 +TERMUX_PKG_SHA256=a81d8243f37e75a03d4f8c55f96d0bc25802be6ec45c3bfa5cb614c6d01bac9d +TERMUX_PKG_DEPENDS="libandroid-shmem, libdrm, libpciaccess, libpixman, libx11, libxau, libxfont2, libxinerama, libxkbfile, libxshmfence, mesa, openssl, xkeyboard-config, xorg-xkbcomp, libwayland, libwayland-protocols, libepoxy" + +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--enable-composite +--enable-mitshm +--enable-xres +--enable-record +--enable-xv +--enable-xvmc +--enable-dga +--enable-screensaver +--enable-xdmcp +--disable-glx +--disable-dri +--disable-dri2 +--disable-dri3 +--enable-present +--enable-xinerama +--enable-xf86vidmode +--enable-xace +--enable-xcsecurity +--enable-dbe +--enable-xf86bigfont +--disable-xfree86-utils +--disable-vgahw +--disable-vbe +--disable-int10-module +--enable-libdrm +--disable-pciaccess +--disable-linux-acpi +--disable-linux-apm +--disable-xorg +--disable-glamor +--disable-dmx +--disable-xvfb +--disable-xnest +--enable-xwayland +--disable-xwin +--disable-kdrive +--disable-xephyr +--disable-libunwind +--enable-xshmfence +--enable-ipv6 +--with-sha1=libcrypto +--with-fontrootdir=${TERMUX_PREFIX}/share/fonts +--with-xkb-path=${TERMUX_PREFIX}/share/X11/xkb +LIBS=-landroid-shmem" + +termux_step_pre_configure () { + CFLAGS+=" -DFNDELAY=O_NDELAY -Wno-int-to-pointer-cast" + CPPFLAGS+=" -I${TERMUX_PREFIX}/include/libdrm" + + if [ "${TERMUX_DEBUG_BUILD}" = "true" ]; then + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-debug" + fi + + # fixing automake version mismatch + cd ${TERMUX_PKG_SRCDIR} + files=`find . -name configure -o -name config.status -o -name Makefile.in` + for file in $files; do rm $file; done + unset files + + #you will need xutils-dev package for xorg-macros installed + autoreconf -if + cd - +} + +termux_step_post_make_install () { + rm -f "${TERMUX_PREFIX}/usr/share/X11/xkb/compiled" +} diff --git a/x11-packages/xwayland/disable-modesetting.patch b/x11-packages/xwayland/disable-modesetting.patch new file mode 100644 index 000000000..391108d9c --- /dev/null +++ b/x11-packages/xwayland/disable-modesetting.patch @@ -0,0 +1,14 @@ ++++ ./configure.ac +@@ -2005,9 +2005,9 @@ + XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS" + fi + +- if test "x$DRM" = xyes; then +- XORG_DRIVER_MODESETTING=yes +- fi ++# if test "x$DRM" = xyes; then ++# XORG_DRIVER_MODESETTING=yes ++# fi + + AC_SUBST([XORG_LIBS]) + AC_SUBST([XORG_SYS_LIBS]) diff --git a/x11-packages/xwayland/statifiing-all-modules.patch b/x11-packages/xwayland/statifiing-all-modules.patch new file mode 100644 index 000000000..f02b0a93f --- /dev/null +++ b/x11-packages/xwayland/statifiing-all-modules.patch @@ -0,0 +1,147 @@ ++++ ./hw/xfree86/Makefile.am 2018-01-28 10:03:56.740173910 +0200 +@@ -36,8 +36,8 @@ + + SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ + ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ +- $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods xkb \ +- fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \ ++ $(DRI2_SUBDIR) fbdevhw shadowfb . $(VBE_SUBDIR) i2c \ ++ dixmods xkb exa $(XF86UTILS_SUBDIR) doc man \ + $(GLAMOR_EGL_SUBDIR) drivers + + DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ +@@ -45,8 +45,8 @@ + loader dixmods xkb dri dri2 exa modes \ + utils doc man glamor_egl drivers + ++lib_LTLIBRARIES = libXFree86.la + bin_PROGRAMS = Xorg +-nodist_Xorg_SOURCES = sdksyms.c + + AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ + AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/parser \ +@@ -75,11 +75,35 @@ + $(top_builddir)/os/libos.la \ + $(top_builddir)/Xext/libXvidmode.la + +-Xorg_LDADD = \ +- $(LOCAL_LIBS) \ +- $(XORG_SYS_LIBS) \ +- $(XSERVER_SYS_LIBS) +-Xorg_DEPENDENCIES = $(LOCAL_LIBS) ++LIBXFREE86_LIBS = \ ++ $(MAIN_LIB) \ ++ $(XSERVER_LIBS) \ ++ loader/libloader.la \ ++ common/libcommon.la \ ++ os-support/libxorgos.la \ ++ parser/libxf86config.la \ ++ dixmods/libdixmods.la \ ++ modes/libxf86modes.la \ ++ ramdac/libramdac.la \ ++ ddc/libddc.la \ ++ i2c/libi2c.la \ ++ $(XORG_LIBS) \ ++ xkb/libxorgxkb.la \ ++ fbdevhw/libfbdevhw.la \ ++ $(top_builddir)/Xext/libXvidmode.la \ ++ $(top_builddir)/fb/libfb.la \ ++ $(top_builddir)/miext/shadow/libshadow.la ++ ++ ++libXFree86_la_LDFLAGS = $(Xorg_LDFLAGS) -module -avoid-version -Wl,--unresolved-symbols=report-all -rdynamic ++nodist_libXFree86_la_SOURCES = sdksyms.c ++libXFree86_la_SOURCES = ++libXFree86_la_LIBADD = $(LIBXFREE86_LIBS) $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) ++libXFree86_la_CFLAGS = $(AM_CFLAGS) ++libXFree86_la_DEPENDENCIES = $(LOCAL_LIBS) ++ ++Xorg_LDADD = libXFree86.la ++Xorg_SOURCES = $(top_srcdir)/dix/stubmain.c + + Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + ++++ ./hw/xfree86/shadowfb/Makefile.am 2018-01-28 15:18:06.191501835 +0200 +@@ -1,5 +1,5 @@ + module_LTLIBRARIES = libshadowfb.la +-libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libshadowfb_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) + libshadowfb_la_SOURCES = sfbmodule.c shadowfb.c + libshadowfb_la_LIBADD = $(PIXMAN_LIBS) + + ++++ ./miext/shadow/Makefile.am 2018-01-28 15:24:22.836598681 +0200 +@@ -6,6 +6,7 @@ + sdk_HEADERS = shadow.h + endif + ++libshadow_la_LDFLAGS = -module -avoid-version -static + libshadow_la_SOURCES = \ + c2p_core.h \ + shadow.c \ + ++++ ./hw/xfree86/fbdevhw/Makefile.am 2018-01-28 16:04:05.242414784 +0200 +@@ -1,17 +1,11 @@ + SUBDIRS = man + +-module_LTLIBRARIES = libfbdevhw.la ++noinst_LTLIBRARIES = libfbdevhw.la + +-libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libfbdevhw_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) +- +-if FBDEVHW + libfbdevhw_la_SOURCES = fbdevhw.c +-else +-libfbdevhw_la_SOURCES = fbdevhwstub.c +-endif + + AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../i2c -I$(srcdir)/../modes -I$(srcdir)/../ddc -I$(srcdir)/../parser +- + AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) + + sdk_HEADERS = fbdevhw.h + ++++ ./hw/xfree86/dixmods/Makefile.am 2018-01-30 00:09:07.250483502 +0200 +@@ -17,17 +17,17 @@ + -I$(top_srcdir)/miext/shadow \ + -I$(top_srcdir)/glx + +-libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libfb_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) + libfb_la_LIBADD = $(top_builddir)/fb/libfb.la + libfb_la_SOURCES = fbmodule.c + libfb_la_CFLAGS = $(AM_CFLAGS) + +-libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libwfb_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) + libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la + libwfb_la_SOURCES = fbmodule.c + libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER + +-libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libglx_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) + libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS) + if DRI2 + libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la +@@ -37,7 +37,7 @@ + endif + libglx_la_SOURCES = glxmodule.c + +-libshadow_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) ++libshadow_la_LDFLAGS = -module -avoid-version -static $(LD_NO_UNDEFINED_FLAG) + libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la + if NO_UNDEFINED + libshadow_la_LIBADD += libfb.la + ++++ ./include/dix.h 2018-01-25 00:43:05.367766278 +0200 +@@ -307,7 +307,7 @@ + extern _X_EXPORT void + SetVendorString(const char *string); + +-int ++_X_EXPORT int + dix_main(int argc, char *argv[], char *envp[]); + + /* events.c */ + diff --git a/x11-packages/xwayland/stubmain.c.patch b/x11-packages/xwayland/stubmain.c.patch new file mode 100644 index 000000000..aba82f76e --- /dev/null +++ b/x11-packages/xwayland/stubmain.c.patch @@ -0,0 +1,19 @@ ++++ ./dix/stubmain.c +@@ -23,6 +23,7 @@ + + ******************************************************************/ + ++extern const char *xf86LogFile; + int dix_main(int argc, char *argv[], char *envp[]); + + /* +@@ -31,5 +32,9 @@ + int + main(int argc, char *argv[], char *envp[]) + { ++#ifdef ANDROID ++ xf86LogFile = "/dev/null"; ++#endif ++ + return dix_main(argc, argv, envp); + } diff --git a/x11-packages/xwayland/xorg-server-1.20.1_Xext_xf86bigfont.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_Xext_xf86bigfont.c.patch new file mode 100644 index 000000000..c248c2faa --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_Xext_xf86bigfont.c.patch @@ -0,0 +1,20 @@ +diff -uNr xorg-server-1.20.1/Xext/xf86bigfont.c xorg-server-1.20.1.mod/Xext/xf86bigfont.c +--- xorg-server-1.20.1/Xext/xf86bigfont.c 2018-08-07 19:31:00.000000000 +0300 ++++ xorg-server-1.20.1.mod/Xext/xf86bigfont.c 2018-10-08 21:07:49.005945142 +0300 +@@ -715,16 +715,7 @@ + /* fprintf(stderr, "signature = 0x%08X\n", signature); */ + + FontShmdescIndex = xfont2_allocate_font_private_index(); +- +-#if !defined(CSRG_BASED) && !defined(__CYGWIN__) +- pagesize = SHMLBA; +-#else +-#ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +-#else +- pagesize = getpagesize(); +-#endif +-#endif + #endif + } + } diff --git a/x11-packages/xwayland/xorg-server-1.20.1_include_site.h.patch b/x11-packages/xwayland/xorg-server-1.20.1_include_site.h.patch new file mode 100644 index 000000000..53787afd0 --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_include_site.h.patch @@ -0,0 +1,12 @@ +diff -uNr xorg-server-1.20.1/include/site.h xorg-server-1.20.1.mod/include/site.h +--- xorg-server-1.20.1/include/site.h 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/include/site.h 2018-10-08 21:07:16.824256995 +0300 +@@ -72,7 +72,7 @@ + * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! + */ + #ifndef COMPILEDDEFAULTFONTPATH +-#define COMPILEDDEFAULTFONTPATH "/usr/share/fonts/X11/misc/" ++#define COMPILEDDEFAULTFONTPATH "/data/data/com.termux/files/usr/share/fonts/X11/misc/" + #endif + + /* diff --git a/x11-packages/xwayland/xorg-server-1.20.1_os_access.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_os_access.c.patch new file mode 100644 index 000000000..c62771cec --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_os_access.c.patch @@ -0,0 +1,12 @@ +diff -uNr xorg-server-1.20.1/os/access.c xorg-server-1.20.1.mod/os/access.c +--- xorg-server-1.20.1/os/access.c 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/os/access.c 2018-10-08 21:07:16.834261640 +0300 +@@ -961,7 +961,7 @@ + #if defined WIN32 && defined __MINGW32__ + #define ETC_HOST_PREFIX "X" + #else +-#define ETC_HOST_PREFIX "/etc/X" ++#define ETC_HOST_PREFIX "/data/data/com.termux/files/usr/etc/X" + #endif + #define ETC_HOST_SUFFIX ".hosts" + fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + diff --git a/x11-packages/xwayland/xorg-server-1.20.1_os_backtrace.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_os_backtrace.c.patch new file mode 100644 index 000000000..ab9f5931e --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_os_backtrace.c.patch @@ -0,0 +1,19 @@ +diff -uNr xorg-server-1.20.1/os/backtrace.c xorg-server-1.20.1.mod/os/backtrace.c +--- xorg-server-1.20.1/os/backtrace.c 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/os/backtrace.c 2018-10-08 21:07:16.834261640 +0300 +@@ -244,14 +244,13 @@ + /* CHILD */ + char parent[16]; + +- seteuid(0); + close(STDIN_FILENO); + close(STDOUT_FILENO); + dup2(pipefd[1], STDOUT_FILENO); + closefrom(STDERR_FILENO); + + snprintf(parent, sizeof(parent), "%d", getppid()); +- execle("/usr/bin/pstack", "pstack", parent, NULL); ++ execle("/data/data/com.termux/files/usr/bin/pstack", "pstack", parent, NULL); + exit(1); + } + else { diff --git a/x11-packages/xwayland/xorg-server-1.20.1_os_connection.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_os_connection.c.patch new file mode 100644 index 000000000..0de201d29 --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_os_connection.c.patch @@ -0,0 +1,12 @@ +diff -uNr xorg-server-1.20.1/os/connection.c xorg-server-1.20.1.mod/os/connection.c +--- xorg-server-1.20.1/os/connection.c 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/os/connection.c 2018-10-08 21:07:16.837596523 +0300 +@@ -996,7 +996,7 @@ + XtransConnInfo ciptr; + const char *display_env = getenv("DISPLAY"); + +- if (display_env && (strncmp(display_env, "/tmp/launch", 11) == 0)) { ++ if (display_env && (strncmp(display_env, "/data/data/com.termux/files/usr/tmp/launch", 11) == 0)) { + /* Make the path the launchd socket if our DISPLAY is set right */ + strcpy(port, display_env); + } diff --git a/x11-packages/xwayland/xorg-server-1.20.1_os_osinit.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_os_osinit.c.patch new file mode 100644 index 000000000..f48a44c32 --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_os_osinit.c.patch @@ -0,0 +1,12 @@ +diff -uNr xorg-server-1.20.1/os/osinit.c xorg-server-1.20.1.mod/os/osinit.c +--- xorg-server-1.20.1/os/osinit.c 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/os/osinit.c 2018-10-08 21:07:16.840931406 +0300 +@@ -72,7 +72,7 @@ + #endif + + #ifndef ADMPATH +-#define ADMPATH "/usr/adm/X%smsgs" ++#define ADMPATH "/data/data/com.termux/files/usr/adm/X%smsgs" + #endif + + #ifdef RLIMIT_DATA diff --git a/x11-packages/xwayland/xorg-server-1.20.1_os_utils.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_os_utils.c.patch new file mode 100644 index 000000000..507feb648 --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_os_utils.c.patch @@ -0,0 +1,161 @@ +diff -uNr xorg-server-1.20.1/os/utils.c xorg-server-1.20.1.mod/os/utils.c +--- xorg-server-1.20.1/os/utils.c 2018-08-07 19:31:05.000000000 +0300 ++++ xorg-server-1.20.1.mod/os/utils.c 2018-10-08 21:07:16.844266287 +0300 +@@ -228,7 +228,7 @@ + * server at a time. This keeps the servers from stomping on each other + * if the user forgets to give them different display numbers. + */ +-#define LOCK_DIR "/tmp" ++#define LOCK_DIR "/data/data/com.termux/files/usr/tmp" + #define LOCK_TMP_PREFIX "/.tX" + #define LOCK_PREFIX "/.X" + #define LOCK_SUFFIX "-lock" +@@ -320,7 +320,7 @@ + i = 0; + haslock = 0; + while ((!haslock) && (i++ < 3)) { +- haslock = (link(tmp, LockFile) == 0); ++ haslock = (rename(tmp, LockFile) == 0); + if (haslock) { + /* + * We're done. +@@ -1383,11 +1383,7 @@ + p = -1; + break; + case 0: /* child */ +- if (setgid(getgid()) == -1) +- _exit(127); +- if (setuid(getuid()) == -1) +- _exit(127); +- execl("/bin/sh", "sh", "-c", command, (char *) NULL); ++ execl("/data/data/com.termux/files/usr/bin/sh", "sh", "-c", command, (char *) NULL); + _exit(127); + default: /* parent */ + do { +@@ -1453,10 +1449,6 @@ + #endif + return NULL; + case 0: /* child */ +- if (setgid(getgid()) == -1) +- _exit(127); +- if (setuid(getuid()) == -1) +- _exit(127); + if (*type == 'r') { + if (pdes[1] != 1) { + /* stdout */ +@@ -1473,7 +1465,7 @@ + } + close(pdes[1]); + } +- execl("/bin/sh", "sh", "-c", command, (char *) NULL); ++ execl("/data/data/com.termux/files/usr/bin/sh", "sh", "-c", command, (char *) NULL); + _exit(127); + } + +@@ -1531,10 +1523,6 @@ + free(cur); + return NULL; + case 0: /* child */ +- if (setgid(getgid()) == -1) +- _exit(127); +- if (setuid(getuid()) == -1) +- _exit(127); + if (*type == 'r') { + if (pdes[1] != 1) { + /* stdout */ +@@ -1577,20 +1565,7 @@ + + return iop; + #else +- int ruid, euid; +- +- ruid = getuid(); +- euid = geteuid(); +- +- if (seteuid(ruid) == -1) { +- return NULL; +- } + iop = fopen(file, type); +- +- if (seteuid(euid) == -1) { +- fclose(iop); +- return NULL; +- } + return iop; + #endif /* HAS_SAVED_IDS_AND_SETEUID */ + } +@@ -1670,7 +1645,7 @@ + else if (getenv("TMP") != NULL) + return getenv("TMP"); + else +- return "/tmp"; ++ return "/data/data/com.termux/files/usr/tmp"; + } + + int +@@ -1722,64 +1697,7 @@ + Bool + PrivsElevated(void) + { +- static Bool privsTested = FALSE; +- static Bool privsElevated = TRUE; +- +- if (!privsTested) { +-#if defined(WIN32) +- privsElevated = FALSE; +-#else +- if ((getuid() != geteuid()) || (getgid() != getegid())) { +- privsElevated = TRUE; +- } +- else { +-#if defined(HAVE_ISSETUGID) +- privsElevated = issetugid(); +-#elif defined(HAVE_GETRESUID) +- uid_t ruid, euid, suid; +- gid_t rgid, egid, sgid; +- +- if ((getresuid(&ruid, &euid, &suid) == 0) && +- (getresgid(&rgid, &egid, &sgid) == 0)) { +- privsElevated = (euid != suid) || (egid != sgid); +- } +- else { +- printf("Failed getresuid or getresgid"); +- /* Something went wrong, make defensive assumption */ +- privsElevated = TRUE; +- } +-#else +- if (getuid() == 0) { +- /* running as root: uid==euid==0 */ +- privsElevated = FALSE; +- } +- else { +- /* +- * If there are saved ID's the process might still be privileged +- * even though the above test succeeded. If issetugid() and +- * getresgid() aren't available, test this by trying to set +- * euid to 0. +- */ +- unsigned int oldeuid; +- +- oldeuid = geteuid(); +- +- if (seteuid(0) != 0) { +- privsElevated = FALSE; +- } +- else { +- if (seteuid(oldeuid) != 0) { +- FatalError("Failed to drop privileges. Exiting\n"); +- } +- privsElevated = TRUE; +- } +- } +-#endif +- } +-#endif +- privsTested = TRUE; +- } +- return privsElevated; ++ return FALSE; + } + + /* diff --git a/x11-packages/xwayland/xorg-server-1.20.1_xkb_ddxLoad.c.patch b/x11-packages/xwayland/xorg-server-1.20.1_xkb_ddxLoad.c.patch new file mode 100644 index 000000000..91325e314 --- /dev/null +++ b/x11-packages/xwayland/xorg-server-1.20.1_xkb_ddxLoad.c.patch @@ -0,0 +1,14 @@ +diff -uNr xorg-server-1.20.1/xkb/ddxLoad.c xorg-server-1.20.1.mod/xkb/ddxLoad.c +--- xorg-server-1.20.1/xkb/ddxLoad.c 2018-08-07 19:31:06.000000000 +0300 ++++ xorg-server-1.20.1.mod/xkb/ddxLoad.c 2018-10-08 21:07:16.844266287 +0300 +@@ -76,8 +76,8 @@ + } + else + #endif +- if (strlen("/tmp/") < size) { +- (void) strcpy(outdir, "/tmp/"); ++ if (strlen("/data/data/com.termux/files/usr/tmp/") < size) { ++ (void) strcpy(outdir, "/data/data/com.termux/files/usr/tmp/"); + } + } + diff --git a/x11-packages/xwayland/xwayland_disable_glx.patch b/x11-packages/xwayland/xwayland_disable_glx.patch new file mode 100644 index 000000000..e1a61d7e5 --- /dev/null +++ b/x11-packages/xwayland/xwayland_disable_glx.patch @@ -0,0 +1,20 @@ ++++ ./hw/xwayland/Makefile.am 2019-06-26 02:44:24.968986945 +0300 +@@ -24,7 +24,6 @@ + Xwayland_LDADD = \ + $(glamor_lib) \ + $(XWAYLAND_LIBS) \ +- $(top_builddir)/glx/libglxvnd.la \ + $(XWAYLAND_SYS_LIBS) \ + $(top_builddir)/Xext/libXvidmode.la \ + $(XSERVER_SYS_LIBS) + ++++ ./hw/xwayland/Makefile.in 2019-06-26 02:46:04.650920429 +0300 +@@ -640,7 +640,7 @@ + $(top_srcdir)/mi/miinitext.c $(am__append_1) $(am__append_2) \ + $(am__append_3) + Xwayland_LDADD = $(glamor_lib) $(XWAYLAND_LIBS) \ +- $(top_builddir)/glx/libglxvnd.la $(XWAYLAND_SYS_LIBS) \ ++ $(XWAYLAND_SYS_LIBS) \ + $(top_builddir)/Xext/libXvidmode.la $(XSERVER_SYS_LIBS) \ + $(am__append_5) + Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) diff --git a/x11-packages/xwayland/xwayland_for_android.patch b/x11-packages/xwayland/xwayland_for_android.patch new file mode 100644 index 000000000..a2e6ed33f --- /dev/null +++ b/x11-packages/xwayland/xwayland_for_android.patch @@ -0,0 +1,222 @@ +diff -Naur ../xserver-1.20.5-orig/hw/xwayland/ashmem.h ./hw/xwayland/ashmem.h +--- ../xserver-1.20.5-orig/hw/xwayland/ashmem.h 1970-01-01 02:00:00.000000000 +0200 ++++ ./hw/xwayland/ashmem.h 2019-07-12 15:00:25.712211695 +0300 +@@ -0,0 +1,47 @@ ++/**************************************************************************** ++ **************************************************************************** ++ *** ++ *** This header was automatically generated from a Linux kernel header ++ *** of the same name, to make information necessary for userspace to ++ *** call into the kernel available to libc. It contains only constants, ++ *** structures, and macros generated from the original header, and thus, ++ *** contains no copyrightable information. ++ *** ++ **************************************************************************** ++ ****************************************************************************/ ++#ifndef _LINUX_ASHMEM_H ++#define _LINUX_ASHMEM_H ++ ++#include ++#include ++#include ++ ++#define ASHMEM_NAME_LEN 256 ++ ++#define ASHMEM_NAME_DEF "dev/ashmem" ++ ++#define ASHMEM_NOT_PURGED 0 ++#define ASHMEM_WAS_PURGED 1 ++ ++#define ASHMEM_IS_UNPINNED 0 ++#define ASHMEM_IS_PINNED 1 ++ ++struct ashmem_pin { ++ uint32_t offset; ++ uint32_t len; ++}; ++ ++#define __ASHMEMIOC 0x77 ++ ++#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) ++#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) ++#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) ++#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) ++#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) ++#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) ++#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) ++#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) ++#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) ++#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) ++ ++#endif +diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-cursor.c ./hw/xwayland/xwayland-cursor.c +--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-cursor.c 2019-07-12 15:14:26.885076932 +0300 ++++ ./hw/xwayland/xwayland-cursor.c 2019-07-12 14:57:25.217524468 +0300 +@@ -66,7 +66,8 @@ + PixmapPtr pixmap; + + pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width, +- cursor->bits->height, 32, 0); ++ cursor->bits->height, 32, ++ CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap); + + return TRUE; +diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-glamor-gbm.c ./hw/xwayland/xwayland-glamor-gbm.c +--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-glamor-gbm.c 2019-07-12 15:14:26.885076932 +0300 ++++ ./hw/xwayland/xwayland-glamor-gbm.c 2019-07-12 14:57:38.836704786 +0300 +@@ -212,9 +212,9 @@ + PixmapPtr pixmap = NULL; + + if (width > 0 && height > 0 && depth >= 15 && +- (hint == 0 || +- hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || +- hint == CREATE_PIXMAP_USAGE_SHARED)) { ++ (hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || ++ hint == CREATE_PIXMAP_USAGE_SHARED || ++ (xwl_screen->rootless && hint == 0))) { + uint32_t format = gbm_format_for_depth(depth); + + #ifdef GBM_BO_WITH_MODIFIERS +diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-output.c ./hw/xwayland/xwayland-output.c +--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-output.c 2019-07-12 15:14:26.889075146 +0300 ++++ ./hw/xwayland/xwayland-output.c 2019-07-12 14:54:13.242596617 +0300 +@@ -171,6 +171,40 @@ + return 25.4 / DEFAULT_DPI; + } + ++static int ++xwl_set_pixmap_visit_window(WindowPtr window, void *data) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ ++ if (screen->GetWindowPixmap(window) == data) { ++ screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen)); ++ return WT_WALKCHILDREN; ++ } ++ ++ return WT_DONTWALKCHILDREN; ++} ++ ++static void ++update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height) ++{ ++ ScreenPtr pScreen = xwl_screen->screen; ++ WindowPtr pRoot = pScreen->root; ++ PixmapPtr old_pixmap, new_pixmap; ++ ++ old_pixmap = pScreen->GetScreenPixmap(pScreen); ++ new_pixmap = pScreen->CreatePixmap(pScreen, width, height, ++ pScreen->rootDepth, ++ CREATE_PIXMAP_USAGE_BACKING_PIXMAP); ++ pScreen->SetScreenPixmap(new_pixmap); ++ ++ if (old_pixmap) { ++ TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap); ++ pScreen->DestroyPixmap(old_pixmap); ++ } ++ ++ pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); ++} ++ + static void + update_screen_size(struct xwl_output *xwl_output, int width, int height) + { +@@ -180,6 +214,9 @@ + if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL) + SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE); + ++ if (!xwl_screen->rootless && xwl_screen->screen->root) ++ update_backing_pixmaps (xwl_screen, width, height); ++ + xwl_screen->width = width; + xwl_screen->height = height; + xwl_screen->screen->width = width; +diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-shm.c ./hw/xwayland/xwayland-shm.c +--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-shm.c 2019-07-12 15:14:26.889075146 +0300 ++++ ./hw/xwayland/xwayland-shm.c 2019-07-12 15:28:09.124589333 +0300 +@@ -40,12 +40,17 @@ + #include + #include + ++#ifdef __ANDROID__ ++#include "ashmem.h" ++#endif ++ + struct xwl_pixmap { + struct wl_buffer *buffer; + void *data; + size_t size; + }; + ++#ifndef __ANDROID__ + #ifndef HAVE_MKOSTEMP + static int + set_cloexec_or_close(int fd) +@@ -172,6 +177,37 @@ + return fd; + } + ++#else // __ANDROID__ ++ ++static int ++os_create_anonymous_file(off_t size) { ++ int fd, ret; ++ long flags; ++ ++ fd = open("/dev/ashmem", O_RDWR); ++ if (fd < 0) ++ return fd; ++ ++ ret = ioctl(fd, ASHMEM_SET_SIZE, size); ++ if (ret < 0) ++ goto err; ++ ++ flags = fcntl(fd, F_GETFD); ++ if (flags == -1) ++ goto err; ++ ++ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) ++ goto err; ++ ++ return fd; ++ ++err: ++ close(fd); ++ return ret; ++} ++ ++#endif // __ANDROID__ ++ + static uint32_t + shm_format_for_depth(int depth) + { +@@ -202,6 +238,7 @@ + int fd; + + if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE || ++ (!xwl_screen->rootless && hint != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) || + (width == 0 && height == 0) || depth < 15) + return fbCreatePixmap(screen, width, height, depth, hint); + +--- ./miext/sync/meson.build.orig 2019-07-21 03:56:18.960672711 +0300 ++++ ./miext/sync/meson.build 2019-07-21 04:02:55.926796439 +0300 +@@ -1,6 +1,7 @@ + srcs_miext_sync = [ + 'misync.c', + 'misyncfd.c', ++ 'misyncshm.c', + ] + + hdrs_miext_sync = [ +@@ -10,10 +11,6 @@ + 'misyncstr.h', + ] + +-if build_dri3 +- srcs_miext_sync += 'misyncshm.c' +-endif +- + libxserver_miext_sync = static_library('libxserver_miext_sync', + srcs_miext_sync, + include_directories: inc,