Adding xorg-server package with full Xorg and dummy driver

This commit is contained in:
Twaik Yont 2018-11-21 00:46:09 +02:00 committed by Yaksh Bariya
parent 6d52dc2c2e
commit 7e9b1e0e89
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
27 changed files with 960 additions and 0 deletions

View File

@ -0,0 +1,4 @@
TERMUX_PKG_HOMEPAGE=https://xorg.freedesktop.org
TERMUX_PKG_VERSION=0.14
TERMUX_PKG_SRCURL=https://xorg.freedesktop.org/releases/individual/lib/libpciaccess-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=3df543e12afd41fea8eac817e48cbfde5aed8817b81670a4e9e493bb2f5bf2a4

View File

@ -0,0 +1,28 @@
+++ ./src/linux_sysfs.c 2018-01-28 23:25:35.585314792 +0200
@@ -50,7 +50,7 @@
#include <dirent.h>
#include <errno.h>
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if (defined(__i386__) || defined(__x86_64__) || defined(__arm__)) && !defined(__ANDROID__)
#include <sys/io.h>
#else
#define inb(x) -1
@@ -461,7 +461,7 @@
while ( temp_size > 0 ) {
- const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
+ const ssize_t bytes = pread( fd, data_bytes, temp_size, offset );
/* If zero bytes were read, then we assume it's the end of the
* config file.
@@ -521,7 +521,7 @@
while ( temp_size > 0 ) {
- const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
+ const ssize_t bytes = pwrite( fd, data_bytes, temp_size, offset );
/* If zero bytes were written, then we assume it's the end of the
* config file.

View File

@ -0,0 +1,9 @@
TERMUX_PKG_VERSION=0.3.8
TERMUX_PKG_SRCURL=https://www.x.org/archive/individual/driver/xf86-video-dummy-$TERMUX_PKG_VERSION.tar.bz2
TERMUX_PKG_SHA256=3712bb869307233491e4c570732d6073c0dc3d99adfdb9977396a3fdf84e95b9
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_DEPENDS="xorg-server"
termux_step_pre_configure () {
autoreconf -if
export LDFLAGS="$LDFLAGS -lXFree86"
}

View File

@ -0,0 +1,131 @@
# This file is used to setup a dummy X server for testing on http://travis-ci.org
# See config file ".travis.yml"
##Xdummy:##
Section "ServerFlags"
Option "DontVTSwitch" "true"
Option "AllowMouseOpenFail" "true"
Option "PciForceNone" "true"
Option "AutoEnableDevices" "false"
Option "AutoAddDevices" "false"
EndSection
##Xdummy:##
Section "InputDevice"
Identifier "NoMouse"
Option "CorePointer" "true"
Driver "void"
EndSection
Section "InputDevice"
Identifier "NoKeyboard"
Option "CoreKeyboard" "true"
Driver "void"
EndSection
##Xdummy:##
Section "Device"
Identifier "Videocard0"
Driver "dummy"
#VideoRam 4096000
VideoRam 256000
EndSection
##Xdummy:##
Section "Monitor"
Identifier "Monitor0"
HorizSync 10.0 - 300.0
VertRefresh 10.0 - 200.0
DisplaySize 4335 1084
#The following modeline is invalid (calculator overflowed):
#Modeline "32000x32000@0" -38917.43 32000 32032 -115848 -115816 32000 32775 32826 33601
Modeline "16384x8192@10" 2101.93 16384 16416 24400 24432 8192 8390 8403 8602
Modeline "8192x4096@10" 424.46 8192 8224 9832 9864 4096 4195 4202 4301
Modeline "5120x3200@10" 199.75 5120 5152 5904 5936 3200 3277 3283 3361
Modeline "3840x2880@10" 133.43 3840 3872 4376 4408 2880 2950 2955 3025
Modeline "3840x2560@10" 116.93 3840 3872 4312 4344 2560 2622 2627 2689
Modeline "3840x2048@10" 91.45 3840 3872 4216 4248 2048 2097 2101 2151
Modeline "2048x2048@10" 49.47 2048 2080 2264 2296 2048 2097 2101 2151
Modeline "2560x1600@10" 47.12 2560 2592 2768 2800 1600 1639 1642 1681
Modeline "1920x1200@10" 26.28 1920 1952 2048 2080 1200 1229 1231 1261
Modeline "1920x1080@10" 23.53 1920 1952 2040 2072 1080 1106 1108 1135
Modeline "1680x1050@10" 20.08 1680 1712 1784 1816 1050 1075 1077 1103
Modeline "1600x900@20" 33.92 1600 1632 1760 1792 900 921 924 946
Modeline "1440x900@20" 30.66 1440 1472 1584 1616 900 921 924 946
Modeline "1360x768@20" 24.49 1360 1392 1480 1512 768 786 789 807
#common resolutions for android devices (both orientations):
Modeline "800x1280@20" 25.89 800 832 928 960 1280 1310 1315 1345
Modeline "1280x800@20" 24.15 1280 1312 1400 1432 800 819 822 841
Modeline "720x1280@25" 30.22 720 752 864 896 1280 1309 1315 1345
Modeline "1280x720@25" 27.41 1280 1312 1416 1448 720 737 740 757
Modeline "768x1024@25" 24.93 768 800 888 920 1024 1047 1052 1076
Modeline "1024x768@25" 23.77 1024 1056 1144 1176 768 785 789 807
Modeline "600x1024@25" 19.90 600 632 704 736 1024 1047 1052 1076
Modeline "1024x600@25" 18.26 1024 1056 1120 1152 600 614 617 631
Modeline "536x960@25" 16.74 536 568 624 656 960 982 986 1009
Modeline "960x536@25" 15.23 960 992 1048 1080 536 548 551 563
Modeline "600x800@25" 15.17 600 632 688 720 800 818 822 841
Modeline "800x600@25" 14.50 800 832 880 912 600 614 617 631
Modeline "480x854@25" 13.34 480 512 560 592 854 873 877 897
Modeline "848x480@25" 12.09 848 880 920 952 480 491 493 505
Modeline "480x800@25" 12.43 480 512 552 584 800 818 822 841
Modeline "800x480@25" 11.46 800 832 872 904 480 491 493 505
Modeline "320x480@50" 10.73 320 352 392 424 480 490 494 505
Modeline "480x320@50" 9.79 480 512 544 576 320 327 330 337
Modeline "240x400@50" 6.96 240 272 296 328 400 408 412 421
Modeline "400x240@50" 6.17 400 432 448 480 240 245 247 253
Modeline "240x320@50" 5.47 240 272 288 320 320 327 330 337
Modeline "320x240@50" 5.10 320 352 368 400 240 245 247 253
#resolutions for android devices (both orientations)
#minus the status bar
#38px status bar (and width rounded up)
Modeline "800x1242@20" 25.03 800 832 920 952 1242 1271 1275 1305
Modeline "1280x762@20" 22.93 1280 1312 1392 1424 762 780 783 801
Modeline "720x1242@25" 29.20 720 752 856 888 1242 1271 1276 1305
Modeline "1280x682@25" 25.85 1280 1312 1408 1440 682 698 701 717
Modeline "768x986@25" 23.90 768 800 888 920 986 1009 1013 1036
Modeline "1024x730@25" 22.50 1024 1056 1136 1168 730 747 750 767
Modeline "600x986@25" 19.07 600 632 704 736 986 1009 1013 1036
Modeline "1024x562@25" 17.03 1024 1056 1120 1152 562 575 578 591
Modeline "536x922@25" 16.01 536 568 624 656 922 943 947 969
Modeline "960x498@25" 14.09 960 992 1040 1072 498 509 511 523
Modeline "600x762@25" 14.39 600 632 680 712 762 779 783 801
Modeline "800x562@25" 13.52 800 832 880 912 562 575 578 591
Modeline "480x810@25" 12.59 480 512 552 584 810 828 832 851
Modeline "848x442@25" 11.09 848 880 920 952 442 452 454 465
Modeline "480x762@25" 11.79 480 512 552 584 762 779 783 801
Modeline "800x442@25" 10.51 800 832 864 896 442 452 454 465
#32px status bar (no need for rounding):
Modeline "320x448@50" 9.93 320 352 384 416 448 457 461 471
Modeline "480x288@50" 8.75 480 512 544 576 288 294 297 303
#24px status bar:
Modeline "240x376@50" 6.49 240 272 296 328 376 384 387 395
Modeline "400x216@50" 5.50 400 432 448 480 216 220 222 227
Modeline "240x296@50" 5.02 240 272 288 320 296 302 305 311
Modeline "320x216@50" 4.55 320 352 368 400 216 220 222 227
EndSection
##Xdummy:##
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "32000x32000" "16384x8192" "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
#Virtual 32000 32000
#Virtual 16384 8192
#Virtual 8192 4096
Virtual 1920 1440
EndSubSection
EndSection
Section "ServerLayout"
Identifier "dummy_layout"
Screen "screen0"
InputDevice "NoMouse"
InputDevice "NoKeyboard"
EndSection

View File

@ -0,0 +1,18 @@
--- ./src/dummy_driver.c.orig 2018-02-23 01:06:42.125661000 +0200
+++ ./src/dummy_driver.c 2018-02-23 01:06:50.741822039 +0200
@@ -436,15 +436,6 @@
/* If monitor resolution is set on the command line, use it */
xf86SetDpi(pScrn, 0, 0);
-
- if (xf86LoadSubModule(pScrn, "fb") == NULL) {
- RETURN;
- }
-
- if (!dPtr->swCursor) {
- if (!xf86LoadSubModule(pScrn, "ramdac"))
- RETURN;
- }
/* We have no contiguous physical fb in physical memory */
pScrn->memPhysBase = 0;

View File

@ -0,0 +1,87 @@
TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com> @xeffyr"
TERMUX_PKG_HOMEPAGE=http://xorg.freedesktop.org/
TERMUX_PKG_DESCRIPTION="Xorg server"
TERMUX_PKG_VERSION=1.20.3
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://xorg.freedesktop.org/releases/individual/xserver/xorg-server-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=1b3ce466c12cacbe2252b3ad5b0ed561972eef9d09e75900d65fb1e21f9201de
TERMUX_PKG_DEPENDS="libandroid-shmem, libdrm, libpciaccess, libpixman, libx11, libxau, libxfont2, libxinerama, libxkbfile, libxshmfence, mesa, openssl, xkeyboard-config, xorg-xkbcomp"
TERMUX_PKG_CONFLICTS="xorg-server"
TERMUX_PKG_REPLACES="xorg-server"
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
--enable-xorg
--disable-glamor
--disable-dmx
--disable-xvfb
--disable-xnest
--disable-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"
CPPFLAGS+=" -I${TERMUX_PREFIX}/include/libdrm"
if [ -n "${TERMUX_DEBUG}" ]; 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"
}
## The following is required for package 'tigervnc'.
if [ "${#}" -eq 1 ] && [ "${1}" == "xorg_server_flags" ]; then
echo ${TERMUX_PKG_EXTRA_CONFIGURE_ARGS}
return
fi

View File

@ -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])

View File

@ -0,0 +1,25 @@
+++ ./hw/xfree86/os-support/xf86_OSlib.h 2017-12-20 22:32:33.000000000 +0200
@@ -132,7 +132,11 @@
#if !defined(__sun)
#include <sys/at_ansi.h>
#endif
+#ifdef __ANDROID__
+#include <linux/kd.h>
+#else
#include <sys/kd.h>
+#endif
#include <sys/vt.h>
extern _X_HIDDEN void xf86VTAcquire(int);
@@ -195,7 +199,11 @@
#include <sys/mman.h>
#ifdef __linux__
#define HAS_USL_VTS
+#ifdef __ANDROID__
+#include <linux/kd.h>
+#else
#include <sys/kd.h>
+#endif
#include <sys/vt.h>
#define LDGMAP GIO_SCRNMAP
#define LDSMAP PIO_SCRNMAP

View File

@ -0,0 +1,25 @@
+++ ./hw/xfree86/os-support/shared/platform_noop.c 2018-09-14 18:56:45.000000000 +0300
@@ -0,0 +1,23 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifdef XSERVER_PLATFORM_BUS
+/* noop platform device support */
+#include "xf86_OSproc.h"
+
+#include "xf86.h"
+#include "xf86platformBus.h"
+
+Bool
+xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid)
+{
+ return FALSE;
+}
+
+void xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
+{
+
+}
+#endif

View File

@ -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 */

View File

@ -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);
}

View File

@ -0,0 +1,10 @@
+++ ./hw/xfree86/common/xf86AutoConfig.c
@@ -294,7 +294,7 @@
xf86PciMatchDriver(md);
#endif
-#if defined(__linux__)
+#if defined(__linux__) && !defined(__ANDROID__)
xf86AddMatchedDriver(md, "modesetting");
#endif

View File

@ -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
}
}

View File

@ -0,0 +1,21 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/common/compiler.h xorg-server-1.20.1.mod/hw/xfree86/common/compiler.h
--- xorg-server-1.20.1/hw/xfree86/common/compiler.h 2018-08-07 19:31:02.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/common/compiler.h 2018-10-08 21:07:16.804247702 +0300
@@ -518,7 +518,7 @@
barrier();
}
-#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
+#elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__)) || defined(__ANDROID__)
#if defined(__arm32__) || defined(__mips64)
#define PORT_SIZE long
#else
@@ -758,7 +758,7 @@
return xf86ReadMmio32Le((void *) ioBase, port);
}
-#elif defined(__arm__) && defined(__linux__)
+#elif defined(__arm__) && defined(__linux__) && !defined(__ANDROID__)
/* for Linux on ARM, we use the LIBC inx/outx routines */
/* note that the appropriate setup via "ioperm" needs to be done */

View File

@ -0,0 +1,12 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/common/xf86Config.c xorg-server-1.20.1.mod/hw/xfree86/common/xf86Config.c
--- xorg-server-1.20.1/hw/xfree86/common/xf86Config.c 2018-08-07 19:31:02.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/common/xf86Config.c 2018-10-08 21:07:16.807582583 +0300
@@ -106,7 +106,7 @@
#define SYS_CONFIGDIRPATH "%D/X11/%X"
#endif
#ifndef PROJECTROOT
-#define PROJECTROOT "/usr/X11R6"
+#define PROJECTROOT "/data/data/com.termux/files/usr/X11R6"
#endif
static ModuleDefault ModuleDefaults[] = {

View File

@ -0,0 +1,12 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/os-support/linux/lnx_acpi.c xorg-server-1.20.1.mod/hw/xfree86/os-support/linux/lnx_acpi.c
--- xorg-server-1.20.1/hw/xfree86/os-support/linux/lnx_acpi.c 2018-08-07 19:31:03.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/os-support/linux/lnx_acpi.c 2018-10-08 21:07:16.807582583 +0300
@@ -15,7 +15,7 @@
#include <fcntl.h>
#include <errno.h>
-#define ACPI_SOCKET "/var/run/acpid.socket"
+#define ACPI_SOCKET "/data/data/com.termux/files/usr/var/run/acpid.socket"
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
#define ACPI_VIDEO_NOTIFY_PROBE 0x81

View File

@ -0,0 +1,18 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/os-support/linux/lnx_kmod.c xorg-server-1.20.1.mod/hw/xfree86/os-support/linux/lnx_kmod.c
--- xorg-server-1.20.1/hw/xfree86/os-support/linux/lnx_kmod.c 2018-08-07 19:31:03.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/os-support/linux/lnx_kmod.c 2018-10-08 21:07:16.810917466 +0300
@@ -68,14 +68,6 @@
*/
switch (pid = fork()) {
case 0: /* child */
- /* change real/effective user ID to 0/0 as we need to
- * preinstall agpgart module for some DRM modules
- */
- if (setreuid(0, 0)) {
- xf86Msg(X_WARNING, "LoadKernelModule: "
- "Setting of real/effective user Id to 0/0 failed");
- }
- setenv("PATH", "/sbin", 1);
execl(mpPath, "modprobe", modName, NULL);
xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno));
exit(EXIT_FAILURE); /* if we get here the child's exec failed */

View File

@ -0,0 +1,22 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/parser/scan.c xorg-server-1.20.1.mod/hw/xfree86/parser/scan.c
--- xorg-server-1.20.1/hw/xfree86/parser/scan.c 2018-08-07 19:31:03.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/parser/scan.c 2018-10-08 21:07:16.814252348 +0300
@@ -873,13 +873,13 @@
*/
#ifndef DEFAULT_CONF_PATH
-#define DEFAULT_CONF_PATH "/etc/X11/%S," \
+#define DEFAULT_CONF_PATH "@TERMUX_PREFIX@/etc/X11/%S," \
"%P/etc/X11/%S," \
- "/etc/X11/%G," \
+ "@TERMUX_PREFIX@/etc/X11/%G," \
"%P/etc/X11/%G," \
- "/etc/X11/%X-%M," \
- "/etc/X11/%X," \
- "/etc/%X," \
+ "@TERMUX_PREFIX@/etc/X11/%X-%M," \
+ "@TERMUX_PREFIX@/etc/X11/%X," \
+ "@TERMUX_PREFIX@/etc/%X," \
"%P/etc/X11/%X.%H," \
"%P/etc/X11/%X-%M," \
"%P/etc/X11/%X," \

View File

@ -0,0 +1,69 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/parser/write.c xorg-server-1.20.1.mod/hw/xfree86/parser/write.c
--- xorg-server-1.20.1/hw/xfree86/parser/write.c 2018-08-07 19:31:03.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/parser/write.c 2018-10-08 21:07:16.817587230 +0300
@@ -129,64 +129,5 @@
int
xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr)
{
-#ifndef HAS_NO_UIDS
- int ret;
-
- if (getuid() != geteuid()) {
-
-#if !defined(HAS_SAVED_IDS_AND_SETEUID)
- int pid, p;
- int status;
- void (*csig) (int);
-
- /* Need to fork to change ruid without loosing euid */
- csig = OsSignal(SIGCHLD, SIG_DFL);
- switch ((pid = fork())) {
- case -1:
- ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
- strerror(errno));
- return 0;
- case 0: /* child */
- if (setuid(getuid()) == -1)
- FatalError("xf86writeConfigFile(): "
- "setuid failed(%s)\n", strerror(errno));
- ret = doWriteConfigFile(filename, cptr);
- exit(ret);
- break;
- default: /* parent */
- do {
- p = waitpid(pid, &status, 0);
- } while (p == -1 && errno == EINTR);
- }
- OsSignal(SIGCHLD, csig);
- if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
- return 1; /* success */
- else
- return 0;
-
-#else /* HAS_SAVED_IDS_AND_SETEUID */
- int ruid, euid;
-
- ruid = getuid();
- euid = geteuid();
-
- if (seteuid(ruid) == -1) {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- ruid, strerror(errno));
- return 0;
- }
- ret = doWriteConfigFile(filename, cptr);
-
- if (seteuid(euid) == -1) {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- euid, strerror(errno));
- }
- return ret;
-
-#endif /* HAS_SAVED_IDS_AND_SETEUID */
-
- }
- else
-#endif /* !HAS_NO_UIDS */
- return doWriteConfigFile(filename, cptr);
+ return doWriteConfigFile(filename, cptr);
}

View File

@ -0,0 +1,27 @@
diff -uNr xorg-server-1.20.1/hw/xfree86/xorg-wrapper.c xorg-server-1.20.1.mod/hw/xfree86/xorg-wrapper.c
--- xorg-server-1.20.1/hw/xfree86/xorg-wrapper.c 2018-08-07 19:31:04.000000000 +0300
+++ xorg-server-1.20.1.mod/hw/xfree86/xorg-wrapper.c 2018-10-08 21:07:16.817587230 +0300
@@ -251,23 +251,6 @@
}
#endif
- /* If we've found cards, and all cards support kms, drop root rights */
- if (needs_root_rights == 0 || (total_cards && kms_cards == total_cards)) {
- gid_t realgid = getgid();
- uid_t realuid = getuid();
-
- if (setresgid(-1, realgid, realgid) != 0) {
- fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
- progname, strerror(errno));
- exit(1);
- }
- if (setresuid(-1, realuid, realuid) != 0) {
- fprintf(stderr, "%s: Could not drop setuid privileges: %s\n",
- progname, strerror(errno));
- exit(1);
- }
- }
-
snprintf(buf, sizeof(buf), "%s/Xorg", SUID_WRAPPER_DIR);
/* Check if the server is executable by our real uid */

View File

@ -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
/*

View File

@ -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) +

View File

@ -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 {

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}
/*

View File

@ -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/");
}
}