From 0af4985aa74d934e83933f5319c59af348302ef3 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Thu, 11 Jul 2024 09:51:48 +0200 Subject: [PATCH] tinyx: add ports of tinyx/Xfbdev, necessary libs and ico JIRA: RTOS-861, RTOS-863 --- tinyx/build.sh | 260 ++++++++ tinyx/patches/ico/1.0.4/01-ico.c.patch | 31 + .../1.5.4/01-src-bitmap-bitscale.c.patch | 14 + .../libXfont/1.5.4/02-src-fc-fslibos.h.patch | 15 + .../1.5.4/03-src-fontfile-dirfile.c.patch | 21 + .../1.5.4/04-src-fontfile-fontscale.c.patch | 14 + .../1.5.4/05-src-util-fontxlfd.c.patch | 13 + .../libXfont/1.5.4/06-configure.ac.patch | 10 + .../libXfont/1.5.4/builtins-debug.patch | 111 ++++ .../tinyx/eed490/01-configure.ac.patch | 272 +++++++++ .../tinyx/eed490/02-kdrive-phoenix.patch | 194 ++++++ tinyx/patches/tinyx/eed490/03-mi.patch | 54 ++ tinyx/patches/tinyx/eed490/04-dixfonts.patch | 16 + tinyx/patches/tinyx/eed490/05-os.patch | 118 ++++ tinyx/patches/tinyx/eed490/06-Xext.patch | 84 +++ .../tinyx/eed490/07-kdrive-fbdev.patch | 388 ++++++++++++ .../9862f3/01-standard_definitions.mk.patch | 37 ++ .../patches/tinyxlib/9862f3/02-Makefile.patch | 71 +++ .../9862f3/04-include-X11-Xos_r.h.patch | 23 + .../9862f3/05-libxtrans-Xtransint.h.patch | 15 + .../9862f3/06-libxtrans-Xtranssock.c.patch | 11 + .../9862f3/10-libtinyX11-Makefile.patch | 25 + .../tinyxlib/9862f3/11-libXau-Makefile.patch | 24 + .../9862f3/12-libXdmcp-Makefile.patch | 27 + .../tinyxlib/9862f3/13-libXext-Makefile.patch | 24 + .../9862f3/15-include-X11-Xtrans.h.patch | 14 + .../patches/tinyxlib/9862f3/16-fix-conn.patch | 78 +++ .../tinyxlib/optional/17-conn-debug.patch | 563 ++++++++++++++++++ tinyx/patches/tinyxlib/optional/19-poll.patch | 55 ++ .../2023.1/01-include-X11-Xpoll.h.patch | 14 + .../2023.1/02-include-X11-Xos_r.h.patch | 13 + 31 files changed, 2609 insertions(+) create mode 100755 tinyx/build.sh create mode 100644 tinyx/patches/ico/1.0.4/01-ico.c.patch create mode 100644 tinyx/patches/libXfont/1.5.4/01-src-bitmap-bitscale.c.patch create mode 100644 tinyx/patches/libXfont/1.5.4/02-src-fc-fslibos.h.patch create mode 100644 tinyx/patches/libXfont/1.5.4/03-src-fontfile-dirfile.c.patch create mode 100644 tinyx/patches/libXfont/1.5.4/04-src-fontfile-fontscale.c.patch create mode 100644 tinyx/patches/libXfont/1.5.4/05-src-util-fontxlfd.c.patch create mode 100644 tinyx/patches/libXfont/1.5.4/06-configure.ac.patch create mode 100644 tinyx/patches/libXfont/1.5.4/builtins-debug.patch create mode 100644 tinyx/patches/tinyx/eed490/01-configure.ac.patch create mode 100644 tinyx/patches/tinyx/eed490/02-kdrive-phoenix.patch create mode 100644 tinyx/patches/tinyx/eed490/03-mi.patch create mode 100644 tinyx/patches/tinyx/eed490/04-dixfonts.patch create mode 100644 tinyx/patches/tinyx/eed490/05-os.patch create mode 100644 tinyx/patches/tinyx/eed490/06-Xext.patch create mode 100644 tinyx/patches/tinyx/eed490/07-kdrive-fbdev.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/02-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/04-include-X11-Xos_r.h.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/05-libxtrans-Xtransint.h.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/06-libxtrans-Xtranssock.c.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/10-libtinyX11-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/11-libXau-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/12-libXdmcp-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/13-libXext-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/15-include-X11-Xtrans.h.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/16-fix-conn.patch create mode 100644 tinyx/patches/tinyxlib/optional/17-conn-debug.patch create mode 100644 tinyx/patches/tinyxlib/optional/19-poll.patch create mode 100644 tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch create mode 100644 tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch diff --git a/tinyx/build.sh b/tinyx/build.sh new file mode 100755 index 0000000..1871180 --- /dev/null +++ b/tinyx/build.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env bash + +set -e + +PREFIX_SHARE="${PREFIX_A}/share/" + +# FIXME there *should* be a clean way to disable doc building via autotools config +TMP_DIR=`mktemp -d` + +inner_log() { + echo -e "$1" +} + +extract_sources() { + if [ ! -d "${PREFIX_PORT_SRC}" ]; then + echo "Extracting sources from ${archive_filename}" + mkdir -p "${PREFIX_PORT_SRC}" + tar -axf "${PREFIX_PORT}/${archive_filename}" --strip-components 1 -C "${PREFIX_PORT_SRC}" + fi +} + +exec_configure() { + (cd ${PREFIX_PORT_SRC} && + autoreconf -vfi && # reconf, as there may be patches to configure.ac + "${PREFIX_PORT_SRC}/configure" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \ + --host="${HOST%phoenix}linux" --sbindir="${PREFIX_PROG}" \ + --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" \ + --prefix="${PREFIX_PORT_INSTALL}" --datarootdir="${PREFIX_A}" "${@}" \ + --disable-shared --enable-static + ) +} + +md5_checksum() { + if [ ! -d "$1" ]; then + echo "no patches" + else + tar cfP - "$1" | md5sum + fi +} + +port_cleanup() { + if [ -z "${1}" ]; then + echo "port_cleanup: no arg provided" + fi + rm -rf ${PREFIX_PORT_SRC} + rm -rf "${PREFIX_PORT_BUILD}/markers/${1}" +} + +# TODO: add dependency rebuild on patch change, i.e. tinyxlib rebuild -> tinyx, +# ico rebuild +should_rebuild() { + patch_subdir="${1}" + marker_dir="${PREFIX_PORT_BUILD}/markers/${patch_subdir}" + patch_dir="${PREFIX_PORT}/patches/${patch_subdir}" + + built_md5_path="${marker_dir}/built.md5" + + if [ ! -f "${built_md5_path}" ]; then + inner_log "Patch and build ${patch_subdir} from scratch" + port_cleanup ${patch_subdir} + + true + else + patch_md5=`md5_checksum ${patch_dir}` + if [ "${patch_md5}" = "$(cat ${built_md5_path})" ]; then + inner_log "${patch_subdir} up-to-date, not rebuilding" + false + else + inner_log "Cleaning ${patch_subdir} up after previous patch set" + port_cleanup ${patch_subdir} + + inner_log "Patch and build ${patch_subdir} from scratch" + true + fi + fi +} + +mark_as_built() { + patch_subdir="${1}" + marker_dir="${PREFIX_PORT_BUILD}/markers/${patch_subdir}" + mkdir -p "${marker_dir}" + + patch_dir="${PREFIX_PORT}/patches/${patch_subdir}" + + built_md5_path="${marker_dir}/built.md5" + md5_checksum ${patch_dir} > ${built_md5_path} +} + +_build_xorgproto() { + b_log "tinyx: building xorgproto" + + version="2023.1" + archive_filename="xorgproto-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/xorgproto/${version}" + b_port_download "https://www.x.org/archive/individual/proto/" "${archive_filename}" + + port_cleanup "xorgproto/${version}" + + extract_sources + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure --disable-specs --docdir="${TMP_DIR}/doc" + fi + + b_port_apply_patches "${PREFIX_PORT_SRC}" "xorgproto/${version}" + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install + + rm -rf "${PREFIX_H}/GL" # GL headers (possibly) unnecessary for now +} + +build_tinyxlib() { + b_log "tinyx: building tinyxlib" + + ref="9862f359a745be8ee8f6505571e09c38e2439c6d" + short_ref=`echo ${ref} | cut -c -6` + archive_filename="${ref}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/tinyxlib/${short_ref}" + b_port_download "https://github.com/idunham/tinyxlib/archive/" "${archive_filename}" + + if should_rebuild "tinyxlib/${short_ref}"; then + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "tinyxlib/${short_ref}" + + # set up a dir for X11 files (currently just for XKeysymDB) + mkdir -p "$PREFIX_SHARE/X11" # FIXME path chosen arbitrarily + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" LIBDIR="${PREFIX_A}" INCDIR="${PREFIX_H}" install + + # Install libxtrans + cp -ar "${PREFIX_PORT_SRC}/libxtrans/." "${PREFIX_H}/X11/Xtrans" + ln -sf "${PREFIX_H}/X11/Xtrans.h" "${PREFIX_H}/X11/Xtrans/Xtrans.h" + + # remove sync.h, syncstr.h to avoid conflict with xorgproto + rm "${PREFIX_H}/X11/extensions/sync.h" + rm "${PREFIX_H}/X11/extensions/syncstr.h" + + _build_xorgproto + + mark_as_built "tinyxlib/${short_ref}" + fi +} + +build_a_lib() { + libname="$1" + version="$2" + configure_opts="${@:3}" + + b_log "tinyx: building ${libname}" + + archive_filename="${libname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}/${version}" + + b_port_download "https://www.x.org/archive/individual/lib/" "${archive_filename}" + + if should_rebuild "${libname}/${version}"; then + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure ${configure_opts} + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install + + mark_as_built "${libname}/${version}" + fi +} + +build_tinyx() { + b_log "tinyx: building xserver" + + ref="eed4902840732f170a7020cedb381017de99f2e6" + short_ref=`echo ${ref} | cut -c -6` + archive_filename="${ref}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/tinyx/${short_ref}" + b_port_download "https://github.com/tinycorelinux/tinyx/archive/" "${archive_filename}" + + if should_rebuild "tinyx/${short_ref}"; then + extract_sources + + if [ ! -d "${PREFIX_PORT_SRC}/kdrive/phoenix/" ]; then + mkdir -p "${PREFIX_PORT_SRC}/kdrive/phoenix/" + cp "${PREFIX_PORT_SRC}/kdrive/linux/mouse.c" "${PREFIX_PORT_SRC}/kdrive/phoenix/mouse.c" + fi + + b_port_apply_patches "${PREFIX_PORT_SRC}" "tinyx/${short_ref}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure --disable-xres --disable-screensaver --disable-xdmcp \ + --disable-dpms --disable-xf86bigfont --disable-xdm-auth-1 \ + --disable-dbe --host="${HOST}" \ + --with-default-font-path="built-ins" # otherwise won't find 'fixed'. libxfont/src/fontfile.c:FontFileNameCheck() + + # (brutally) force static compilation in generated Makefiles + # FIXME do it properly by patching configure.ac instead? + find . -name 'Makefile' -print0 | xargs -0 sed -i 's/ -lz/ -l:libz.a/g;s/ -lXfont/ -l:libXfont.a/g;s/ -lfontenc/ -l:libfontenc.a/g;s/-lm//g' + fi + + make -C "${PREFIX_PORT_SRC}" + + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/Xfbdev" "${PREFIX_PORT_SRC}/kdrive/fbdev/Xfbdev" + cp -a "${PREFIX_PORT_SRC}/kdrive/fbdev/Xfbdev" "${PREFIX_PROG}/Xfbdev" + + b_install "${PREFIX_PORTS_INSTALL}/Xfbdev" /bin + + mark_as_built "tinyx/${short_ref}" + fi +} + +# building ico requires gettext +build_ico() { + b_log "tinyx: building ico" + + version="1.0.4" + archive_filename="ico-${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/ico/${version}" + + b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}" + + if should_rebuild "ico/${version}"; then + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "ico/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure + fi + + make -C "${PREFIX_PORT_SRC}" + + $STRIP -o "${PREFIX_PROG_STRIPPED}/ico" "${PREFIX_PORT_SRC}/ico" + + b_install "${PREFIX_PORTS_INSTALL}/ico" /bin + + mark_as_built "ico/${version}" + fi +} + + +# Call ordering is important here +build_tinyxlib +build_a_lib libfontenc 1.1.8 + +# libXfont depends on libfontenc and headers from xorgproto/tinyxlib +build_a_lib libXfont 1.5.4 --disable-freetype +build_ico + +build_tinyx + +rm -rf $TMP_DIR diff --git a/tinyx/patches/ico/1.0.4/01-ico.c.patch b/tinyx/patches/ico/1.0.4/01-ico.c.patch new file mode 100644 index 0000000..d0b4183 --- /dev/null +++ b/tinyx/patches/ico/1.0.4/01-ico.c.patch @@ -0,0 +1,31 @@ +diff -ruN a/ico.c b/ico.c +--- a/ico.c 2024-07-22 14:37:21.564164578 +0200 ++++ b/ico.c 2024-07-24 11:32:51.014963666 +0200 +@@ -74,12 +74,16 @@ + #ifdef HAVE_CONFIG_H + #include "config.h" + +-#include + #ifdef XTHREADS + # define MULTITHREAD + #endif + #endif /* HAVE_CONFIG_H / autoconf */ + ++#define _X_UNUSED ++#define _X_NORETURN ++#define DEBUG ++#undef MULTITHREAD ++ + #include + #include + #include +@@ -90,9 +94,7 @@ + #ifdef MULTIBUFFER + #include + #endif /* MULTIBUFFER */ +-#ifdef MULTITHREAD + #include +-#endif + #include + + #define MIN_ICO_WIDTH 5 diff --git a/tinyx/patches/libXfont/1.5.4/01-src-bitmap-bitscale.c.patch b/tinyx/patches/libXfont/1.5.4/01-src-bitmap-bitscale.c.patch new file mode 100644 index 0000000..f5fead8 --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/01-src-bitmap-bitscale.c.patch @@ -0,0 +1,14 @@ +diff -ruN a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c +--- a/src/bitmap/bitscale.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/bitmap/bitscale.c 2024-07-16 16:49:46.936913990 +0200 +@@ -39,6 +39,10 @@ + #include + #include + ++#ifdef __phoenix__ ++#define hypot(x,y) sqrt(((x)*(x))+((y)*(y))) ++#endif ++ + #ifndef MAX + #define MAX(a,b) (((a)>(b)) ? a : b) + #endif diff --git a/tinyx/patches/libXfont/1.5.4/02-src-fc-fslibos.h.patch b/tinyx/patches/libXfont/1.5.4/02-src-fc-fslibos.h.patch new file mode 100644 index 0000000..8b5d922 --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/02-src-fc-fslibos.h.patch @@ -0,0 +1,15 @@ +diff -ruN a/src/fc/fslibos.h b/src/fc/fslibos.h +--- a/src/fc/fslibos.h 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/fc/fslibos.h 2024-07-16 16:50:15.143867373 +0200 +@@ -92,6 +92,11 @@ + # define NMSKBITS 32 + # endif + ++#ifdef __phoenix__ ++#include ++#define NOFILES_MAX RLIMIT_NOFILE ++#endif ++ + # define MSKCNT ((FONT_OPEN_MAX + NMSKBITS - 1) / NMSKBITS) + + typedef unsigned long FdSet[MSKCNT]; diff --git a/tinyx/patches/libXfont/1.5.4/03-src-fontfile-dirfile.c.patch b/tinyx/patches/libXfont/1.5.4/03-src-fontfile-dirfile.c.patch new file mode 100644 index 0000000..558e9be --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/03-src-fontfile-dirfile.c.patch @@ -0,0 +1,21 @@ +diff -ruN a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c +--- a/src/fontfile/dirfile.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/fontfile/dirfile.c 2024-07-16 16:51:06.852786243 +0200 +@@ -94,7 +94,7 @@ + strcat(dir_file, "/"); + strcat(dir_file, FontDirFile); + #ifndef WIN32 +- file_fd = open(dir_file, O_RDONLY | O_NOFOLLOW); ++ file_fd = open(dir_file, O_RDONLY); + if (file_fd >= 0) { + file = fdopen(file_fd, "rt"); + } +@@ -291,7 +291,7 @@ + } + + #ifndef WIN32 +- file_fd = open(alias_file, O_RDONLY | O_NOFOLLOW); ++ file_fd = open(alias_file, O_RDONLY); + if (file_fd >= 0) { + file = fdopen(file_fd, "rt"); + } diff --git a/tinyx/patches/libXfont/1.5.4/04-src-fontfile-fontscale.c.patch b/tinyx/patches/libXfont/1.5.4/04-src-fontfile-fontscale.c.patch new file mode 100644 index 0000000..c4eb47b --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/04-src-fontfile-fontscale.c.patch @@ -0,0 +1,14 @@ +diff -ruN a/src/fontfile/fontscale.c b/src/fontfile/fontscale.c +--- a/src/fontfile/fontscale.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/fontfile/fontscale.c 2024-07-16 16:50:34.984835602 +0200 +@@ -34,6 +34,10 @@ + #include + #include + ++#ifdef __phoenix__ ++#define hypot(x,y) sqrt(((x)*(x))+((y)*(y))) ++#endif ++ + Bool + FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, + FontPtr pFont, char *bitmapName) diff --git a/tinyx/patches/libXfont/1.5.4/05-src-util-fontxlfd.c.patch b/tinyx/patches/libXfont/1.5.4/05-src-util-fontxlfd.c.patch new file mode 100644 index 0000000..3eb5dbb --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/05-src-util-fontxlfd.c.patch @@ -0,0 +1,13 @@ +diff -ruN a/src/util/fontxlfd.c b/src/util/fontxlfd.c +--- a/src/util/fontxlfd.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/util/fontxlfd.c 2024-07-16 16:52:11.788691581 +0200 +@@ -43,6 +43,9 @@ + #if defined(sony) && !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) + #define NO_LOCALE + #endif ++#ifdef __phoenix__ ++#define NO_LOCALE ++#endif + #ifndef NO_LOCALE + #include + #endif diff --git a/tinyx/patches/libXfont/1.5.4/06-configure.ac.patch b/tinyx/patches/libXfont/1.5.4/06-configure.ac.patch new file mode 100644 index 0000000..032d388 --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/06-configure.ac.patch @@ -0,0 +1,10 @@ +--- a/configure.ac 2024-07-11 10:09:26.599010599 +0200 ++++ b/configure.ac 2024-07-11 10:09:45.520728347 +0200 +@@ -201,8 +201,6 @@ + fi + + +-AC_CHECK_LIB(m, hypot, [MATH_LIBS=-lm +-AC_SUBST(MATH_LIBS)], AC_MSG_ERROR([*** libm is required])) + + PKG_CHECK_MODULES(XFONT, [xproto xtrans fontsproto >= 2.1.3 fontenc]) diff --git a/tinyx/patches/libXfont/1.5.4/builtins-debug.patch b/tinyx/patches/libXfont/1.5.4/builtins-debug.patch new file mode 100644 index 0000000..6dab41d --- /dev/null +++ b/tinyx/patches/libXfont/1.5.4/builtins-debug.patch @@ -0,0 +1,111 @@ +diff -ruN a/src/builtins/dir.c b/src/builtins/dir.c +--- a/src/builtins/dir.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/builtins/dir.c 2024-07-19 14:32:28.541767801 +0200 +@@ -26,6 +26,8 @@ + #endif + #include "builtin.h" + ++#define HERE printf("%s:%d %s", __FILE__, __LINE__, __func__); ++ + static BuiltinDirPtr + BuiltinDirsDup (const BuiltinDirPtr a_dirs, + int a_dirs_len) +@@ -150,6 +152,7 @@ + int + BuiltinReadDirectory (const char *directory, FontDirectoryPtr *pdir) + { ++ HERE + FontDirectoryPtr dir; + int i; + +@@ -160,34 +163,40 @@ + + if (saved_builtin_dir) + { ++ HERE + BuiltinDirsRestore ((BuiltinDirPtr) builtin_dir, + saved_builtin_dir, + builtin_dir_count) ; + } + else + { ++ HERE + saved_builtin_dir = BuiltinDirsDup ((const BuiltinDirPtr) builtin_dir, + builtin_dir_count) ; + } + + if (saved_builtin_alias) + { ++ HERE + BuiltinAliasesRestore ((BuiltinAliasPtr) builtin_alias, + saved_builtin_alias, + builtin_alias_count) ; + } + else + { ++ HERE + saved_builtin_alias = BuiltinAliasesDup ((const BuiltinAliasPtr) builtin_alias, + builtin_alias_count) ; + } + + for (i = 0; i < builtin_dir_count; i++) + { ++ HERE + if (!FontFileAddFontFile (dir, + (char *) builtin_dir[i].font_name, + (char *) builtin_dir[i].file_name)) + { ++ HERE + FontFileFreeDir (dir); + return BadFontPath; + } +@@ -198,11 +207,13 @@ + (char *) builtin_alias[i].alias_name, + (char *) builtin_alias[i].font_name)) + { ++ HERE + FontFileFreeDir (dir); + return BadFontPath; + } + } + FontFileSortDir (dir); ++ HERE + *pdir = dir; + return Successful; + } +diff -ruN a/src/builtins/fpe.c b/src/builtins/fpe.c +--- a/src/builtins/fpe.c 2017-11-28 15:34:21.000000000 +0100 ++++ b/src/builtins/fpe.c 2024-07-19 14:32:51.841082177 +0200 +@@ -27,6 +27,8 @@ + #include + #include "builtin.h" + ++#define HERE printf("%s:%d %s", __FILE__, __LINE__, __func__); ++ + static int font_file_type; + + static const char builtin_fonts[] = "built-ins"; +@@ -40,12 +42,14 @@ + static int + BuiltinInitFPE (FontPathElementPtr fpe) + { ++ HERE + int status; + FontDirectoryPtr dir; + + status = BuiltinReadDirectory (fpe->name, &dir); + + if (status == Successful) ++ HERE + fpe->private = (pointer) dir; + return status; + } +@@ -68,6 +72,8 @@ + void + BuiltinRegisterFpeFunctions(void) + { ++ ++ HERE + BuiltinRegisterFontFileFunctions (); + + font_file_type = RegisterFPEFunctions(BuiltinNameCheck, diff --git a/tinyx/patches/tinyx/eed490/01-configure.ac.patch b/tinyx/patches/tinyx/eed490/01-configure.ac.patch new file mode 100644 index 0000000..22bdb97 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/01-configure.ac.patch @@ -0,0 +1,272 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2022-11-07 07:44:53.000000000 +0100 ++++ b/configure.ac 2024-08-02 10:34:26.900380412 +0200 +@@ -71,8 +71,6 @@ + strtol getopt getopt_long vsnprintf]) + AC_FUNC_ALLOCA + dnl Old HAS_* names used in os/*.c. +-AC_CHECK_FUNC([getdtablesize], +- AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the `getdtablesize' function.])) + AC_CHECK_FUNC([getifaddrs], + AC_DEFINE(HAS_GETIFADDRS, 1, [Have the `getifaddrs' function.])) + AC_CHECK_FUNC([getpeereid], +@@ -85,18 +83,17 @@ + AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno]) + + dnl Check for mmap support for Xvfb +-AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.])) ++#AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.])) ++AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.]) + + dnl Find the math libary + AC_CHECK_LIB(m, sqrt) + + dnl APM header +-AC_CHECK_HEADERS([linux/apm_bios.h], LNXAPM=yes) +-AM_CONDITIONAL(LNXAPM, [test "x$LNXAPM" = xyes]) ++AM_CONDITIONAL(LNXAPM, [test 1=0]) + + dnl fbdev header +-AC_CHECK_HEADERS([linux/fb.h], FBDEV=yes) +-AM_CONDITIONAL(FBDEVHW, [test "x$FBDEV" = xyes]) ++AM_CONDITIONAL(FBDEVHW, [test 1=1] ) + + dnl MTRR header + AC_CHECK_HEADERS([asm/mtrr.h], ac_cv_asm_mtrr_h=yes) +@@ -143,6 +140,10 @@ + I386_VIDEO=yes + case $host_os in + *linux*) DEFAULT_INT10=vm86 ;; ++ *phoenix*) DEFAULT_INT10=stub ++ dnl --whole-archive/--no-whole-archive required for proper weak symbol substitution in libgraph ++ SYS_LIBS="-Wl,--whole-archive,-l:libvga.a,-l:libvirtio.a,-l:libgraph.a,--no-whole-archive" ++ ;; + *freebsd*) AC_DEFINE(USE_DEV_IO) ;; + *netbsd*) AC_DEFINE(USE_I386_IOPL) + SYS_LIBS=-li386 +@@ -319,34 +320,34 @@ + + dnl Core modules for most extensions, et al. + REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto [kbproto >= 1.0.3]" +-REQUIRED_LIBS="xfont fontenc" ++REQUIRED_LIBS="xfont fontenc zlib" + + AM_CONDITIONAL(SCREENSAVER, [test "x$SCREENSAVER" = xyes]) +-if test "x$SCREENSAVER" = xyes; then +- AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension]) +-fi ++#if test "x$SCREENSAVER" = xyes; then ++# AC_DEFINE(SCREENSAVER, 1, [Support MIT-SCREEN-SAVER extension]) ++#fi + + AM_CONDITIONAL(RES, [test "x$RES" = xyes]) +-if test "x$RES" = xyes; then +- AC_DEFINE(RES, 1, [Support X resource extension]) +- REQUIRED_MODULES="$REQUIRED_MODULES resourceproto" +-fi ++#if test "x$RES" = xyes; then ++# AC_DEFINE(RES, 1, [Support X resource extension]) ++# REQUIRED_MODULES="$REQUIRED_MODULES resourceproto" ++#fi + + AM_CONDITIONAL(DBE, [test "x$DBE" = xyes]) +-if test "x$DBE" = xyes; then +- AC_DEFINE(DBE, 1, [Support DBE extension]) +- DBE_LIB='$(top_builddir)/dbe/libdbe.la' +-fi ++#if test "x$DBE" = xyes; then ++# AC_DEFINE(DBE, 1, [Support DBE extension]) ++# DBE_LIB='$(top_builddir)/dbe/libdbe.la' ++#fi + + AM_CONDITIONAL(XF86BIGFONT, [test "x$XF86BIGFONT" = xyes]) +-if test "x$XF86BIGFONT" = xyes; then +- AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension]) +-fi ++#if test "x$XF86BIGFONT" = xyes; then ++# AC_DEFINE(XF86BIGFONT, 1, [Support XF86 Big font extension]) ++#fi + + AM_CONDITIONAL(DPMSExtension, [test "x$DPMSExtension" = xyes]) +-if test "x$DPMSExtension" = xyes; then +- AC_DEFINE(DPMSExtension, 1, [Support DPMS extension]) +-fi ++#if test "x$DPMSExtension" = xyes; then ++# AC_DEFINE(DPMSExtension, 1, [Support DPMS extension]) ++#fi + + RENDER_LIB='$(top_builddir)/render/librender.la' + RENDER_INC='-I$(top_srcdir)/render' +@@ -365,40 +366,40 @@ + AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1, + [Do not have `strcasecmp'.])) + +-PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"]) +-if test "x$have_libxdmcp" = xyes; then +- AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS]) +-fi +-if test "x$XDMCP" = xauto; then +- if test "x$have_libxdmcp" = xyes; then +- XDMCP=yes +- else +- XDMCP=no +- fi +-fi +-if test "x$XDMAUTH" = xauto; then +- if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then +- XDMAUTH=yes +- else +- XDMAUTH=no +- fi +-fi ++#PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"]) ++#if test "x$have_libxdmcp" = xyes; then ++# AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS]) ++#fi ++#if test "x$XDMCP" = xauto; then ++# if test "x$have_libxdmcp" = xyes; then ++# XDMCP=yes ++# else ++# XDMCP=no ++# fi ++#fi ++#if test "x$XDMAUTH" = xauto; then ++# if test "x$have_libxdmcp" = xyes && test "x$have_xdmcpwrap" = xyes; then ++# XDMAUTH=yes ++# else ++# XDMAUTH=no ++# fi ++#fi + + AM_CONDITIONAL(XDMCP, [test "x$XDMCP" = xyes]) +-if test "x$XDMCP" = xyes; then +- AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol]) +- REQUIRED_LIBS="$REQUIRED_LIBS xdmcp" +- XDMCP_MODULES="xdmcp" +-fi +- ++#if test "x$XDMCP" = xyes; then ++# AC_DEFINE(XDMCP, 1, [Support XDM Control Protocol]) ++# REQUIRED_LIBS="$REQUIRED_LIBS xdmcp" ++# XDMCP_MODULES="xdmcp" ++#fi ++# + AM_CONDITIONAL(XDMAUTH, [test "x$XDMAUTH" = xyes]) +-if test "x$XDMAUTH" = xyes; then +- AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1]) +- if ! test "x$XDMCP" = xyes; then +- REQUIRED_LIBS="$REQUIRED_LIBS xdmcp" +- XDMCP_MODULES="xdmcp" +- fi +-fi ++#if test "x$XDMAUTH" = xyes; then ++# AC_DEFINE(HASXDMAUTH,1,[Support XDM-AUTH*-1]) ++# if ! test "x$XDMCP" = xyes; then ++# REQUIRED_LIBS="$REQUIRED_LIBS xdmcp" ++# XDMCP_MODULES="xdmcp" ++# fi ++#fi + + VENDOR_RELEASE="((($VERSION_MAJOR) * 10000000) + (($VERSION_MINOR) * 100000) + (($VERSION_PATCH) * 1000) + $VERSION_SNAP)" + +@@ -533,20 +534,13 @@ + AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server]) + AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx]) + +- AC_CHECK_HEADERS([asm/vm86.h sys/io.h]) +- if test "$ac_cv_header_asm_vm86_h" = yes; then +- AC_DEFINE(KDRIVEVESA, 1, [Build VESA-based kdrive servers]) +- fi +- +- AC_CHECK_HEADERS([linux/fb.h]) +- if test "$ac_cv_header_linux_fb_h" = yes; then +- AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server]) +- fi ++ AC_DEFINE(KDRIVEVESA, 0, [Build VESA-based kdrive servers]) ++ AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server]) + + # damage shadow extension fb mi + KDRIVE_INC='-I$(top_srcdir)/kdrive/src' + KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC" +- KDRIVE_OS_INC='-I$(top_srcdir)/kdrive/linux' ++ KDRIVE_OS_INC='-I$(top_srcdir)/kdrive/phoenix' + KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC" + + KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H" +@@ -561,9 +555,13 @@ + KDRIVE_OS_LIB='$(top_builddir)/kdrive/linux/liblinux.a' + KDRIVELINUX=yes + ;; ++ *phoenix*) ++ KDRIVE_OS_LIB='$(top_builddir)/kdrive/phoenix/libphoenix.a' ++ KDRIVEPHOENIX=yes ++ ;; + esac + KDRIVE_STUB_LIB='$(top_builddir)/kdrive/src/libkdrivestubs.a' +- KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB" ++ KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_PURE_LIBS $KDRIVE_OS_LIB $KDRIVE_STUB_LIB" + fi + AC_SUBST(KDRIVE_INCS) + AC_SUBST(KDRIVE_PURE_INCS) +@@ -571,6 +569,7 @@ + AC_SUBST(KDRIVE_PURE_LIBS) + AC_SUBST(KDRIVE_LIBS) + AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes]) ++AM_CONDITIONAL(KDRIVEPHOENIX, [test "x$KDRIVEPHOENIX" = xyes]) + AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_asm_vm86_h" = xyes]) + AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes]) + +@@ -579,21 +578,21 @@ + + dnl ---------- Compiler arguments + +-AX_CHECK_COMPILE_FLAG([-flto], +- [CFLAGS="$CFLAGS -flto"; LDFLAGS="$LDFLAGS -flto"; ac_cv_lto_supported=yes], +- [ac_cv_lto_supported=no], +- []) +- +-if test x"$ac_cv_lto_supported" = xno; then +- AC_MSG_NOTICE([LTO not supported, checking sections instead...]) +- +- AX_CHECK_COMPILE_FLAG([-ffunction-sections], +- [CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" +- LDFLAGS="$LDFLAGS -Wl,-gc-sections" +- ac_cv_sections_supported=yes], +- [ac_cv_sections_supported=no], +- []) +-fi ++#AX_CHECK_COMPILE_FLAG([-flto], ++# [CFLAGS="$CFLAGS -flto"; LDFLAGS="$LDFLAGS -flto"; ac_cv_lto_supported=yes], ++# [ac_cv_lto_supported=no], ++# []) ++ ++#if test x"$ac_cv_lto_supported" = xno; then ++# AC_MSG_NOTICE([LTO not supported, checking sections instead...]) ++# ++# AX_CHECK_COMPILE_FLAG([-ffunction-sections], ++# [CFLAGS="$CFLAGS -ffunction-sections -fdata-sections" ++# LDFLAGS="$LDFLAGS -Wl,-gc-sections" ++# ac_cv_sections_supported=yes], ++# [ac_cv_sections_supported=no], ++# []) ++#fi + + AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], + [CFLAGS="$CFLAGS -fvisibility=hidden"; ac_cv_visibility_supported=yes], +@@ -611,7 +610,7 @@ + []) + + AX_CHECK_LINK_FLAG([-Wl,-as-needed], [LDFLAGS="$LDFLAGS -Wl,-as-needed"], +- [], []) ++[], []) + + dnl ---------- + +@@ -655,6 +654,7 @@ + kdrive/Makefile + kdrive/fbdev/Makefile + kdrive/linux/Makefile ++kdrive/phoenix/Makefile + kdrive/src/Makefile + kdrive/vesa/Makefile + ]) diff --git a/tinyx/patches/tinyx/eed490/02-kdrive-phoenix.patch b/tinyx/patches/tinyx/eed490/02-kdrive-phoenix.patch new file mode 100644 index 0000000..39d1232 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/02-kdrive-phoenix.patch @@ -0,0 +1,194 @@ +diff -ruN a/kdrive/fbdev/fbinit.c b/kdrive/fbdev/fbinit.c +--- a/kdrive/fbdev/fbinit.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/fbdev/fbinit.c 2024-08-02 10:34:26.846387927 +0200 +@@ -67,7 +67,7 @@ + + void InitInput(int argc, char **argv) + { +- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs); ++ KdInitInput(&PhoenixMouseFuncs, &PhoenixKeyboardFuncs); + } + + void ddxUseMsg(void) +diff -ruN a/kdrive/Makefile.am b/kdrive/Makefile.am +--- a/kdrive/Makefile.am 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/Makefile.am 2024-08-02 10:34:26.850387370 +0200 +@@ -1,19 +1,3 @@ +-if KDRIVEVESA +-VESA_SUBDIRS = vesa +-endif ++SUBDIRS = src phoenix fbdev + +-if KDRIVEFBDEV +-FBDEV_SUBDIRS = fbdev +-endif +- +-if KDRIVELINUX +-LINUX_SUBDIRS = linux +-endif +- +-SUBDIRS = \ +- src \ +- $(LINUX_SUBDIRS) \ +- $(FBDEV_SUBDIRS) \ +- $(VESA_SUBDIRS) +- +-DIST_SUBDIRS = vesa fbdev src linux ++DIST_SUBDIRS = fbdev src phoenix +diff -ruN a/kdrive/phoenix/keyboard.c b/kdrive/phoenix/keyboard.c +--- a/kdrive/phoenix/keyboard.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/kdrive/phoenix/keyboard.c 2024-08-02 10:34:26.855386674 +0200 +@@ -0,0 +1,37 @@ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++#include "kdrive.h" ++#include "kkeymap.h" ++#define XK_PUBLISHING ++#include ++#include ++ ++static void PhoenixKeyboardLoad(void) ++{ ++} ++ ++static int PhoenixKeyboardInit(void) ++{ ++} ++ ++static void PhoenixKeyboardFini(void) ++{ ++} ++ ++static void PhoenixKeyboardLeds(int leds) ++{ ++} ++ ++static void PhoenixKeyboardBell(int volume, int pitch, int duration) ++{ ++} ++ ++const KdKeyboardFuncs PhoenixKeyboardFuncs = { ++ PhoenixKeyboardLoad, ++ PhoenixKeyboardInit, ++ PhoenixKeyboardLeds, ++ PhoenixKeyboardBell, ++ PhoenixKeyboardFini, ++ 3, ++}; +Binary files a/kdrive/phoenix/libphoenix.a and b/kdrive/phoenix/libphoenix.a differ +diff -ruN a/kdrive/phoenix/Makefile.am b/kdrive/phoenix/Makefile.am +--- a/kdrive/phoenix/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ b/kdrive/phoenix/Makefile.am 2024-08-02 10:34:26.855386674 +0200 +@@ -0,0 +1,20 @@ ++AM_CPPFLAGS = \ ++ @KDRIVE_INCS@ \ ++ @KDRIVE_CFLAGS@ ++ ++AM_CFLAGS = -DHAVE_DIX_CONFIG_H ++ ++noinst_LIBRARIES = libphoenix.a ++ ++KDRIVE_HW_SOURCES = \ ++ keyboard.c \ ++ phoenix.c ++ ++libphoenix_a_SOURCES = \ ++ mouse.c \ ++ $(KDRIVE_HW_SOURCES) ++ ++libphoenix_a_DEPENDENCIES = \ ++ keyboard.c \ ++ phoenix.c \ ++ mouse.c +diff -ruN a/kdrive/phoenix/mouse.c b/kdrive/phoenix/mouse.c +--- a/kdrive/phoenix/mouse.c 2024-07-18 09:24:38.856484124 +0200 ++++ b/kdrive/phoenix/mouse.c 2024-07-18 09:24:38.839485490 +0200 +@@ -937,7 +937,7 @@ + } + } + +-const KdMouseFuncs LinuxMouseFuncs = { ++const KdMouseFuncs PhoenixMouseFuncs = { + MouseInit, + MouseFini, + }; +diff -ruN a/kdrive/phoenix/phoenix.c b/kdrive/phoenix/phoenix.c +--- a/kdrive/phoenix/phoenix.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/kdrive/phoenix/phoenix.c 2024-08-02 10:34:26.855386674 +0200 +@@ -0,0 +1,45 @@ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++#include "kdrive.h" ++#include ++#include ++#include ++#include ++#include ++ ++static int PhoenixInit(void) ++{ ++ return 1; ++} ++ ++static void PhoenixEnable(void) ++{ ++} ++ ++static Bool PhoenixSpecialKey(KeySym sym) ++{ ++ return FALSE; ++} ++ ++static void PhoenixDisable(void) ++{ ++} ++ ++static void PhoenixFini(void) ++{ ++} ++ ++static const KdOsFuncs PhoenixFuncs = { ++ PhoenixInit, ++ PhoenixEnable, ++ PhoenixSpecialKey, ++ PhoenixDisable, ++ PhoenixFini, ++ 0 ++}; ++ ++void OsVendorInit(void) ++{ ++ KdOsInit(&PhoenixFuncs); ++} +diff -ruN a/kdrive/src/kdrive.h b/kdrive/src/kdrive.h +--- a/kdrive/src/kdrive.h 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/src/kdrive.h 2024-08-02 10:34:26.852387092 +0200 +@@ -381,8 +381,8 @@ + + void ProcessInputEvents(void); + +-extern const KdMouseFuncs LinuxMouseFuncs; +-extern const KdKeyboardFuncs LinuxKeyboardFuncs; ++extern const KdMouseFuncs PhoenixMouseFuncs; ++extern const KdKeyboardFuncs PhoenixKeyboardFuncs; + + /* kmap.c */ + +diff -ruN a/kdrive/src/kinput.c b/kdrive/src/kinput.c +--- a/kdrive/src/kinput.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/src/kinput.c 2024-08-02 10:34:26.852387092 +0200 +@@ -145,6 +145,12 @@ + + static int kdnFds; + ++#ifdef __phoenix__ ++/* FASYNC/O_ASYNC is Linux/BSD specific, ignore it */ ++#define FASYNC 0 ++#define FNDELAY O_NDELAY ++#endif ++ + #ifdef FNONBLOCK + #define NOBLOCK FNONBLOCK + #else diff --git a/tinyx/patches/tinyx/eed490/03-mi.patch b/tinyx/patches/tinyx/eed490/03-mi.patch new file mode 100644 index 0000000..5f0c63f --- /dev/null +++ b/tinyx/patches/tinyx/eed490/03-mi.patch @@ -0,0 +1,54 @@ +diff -ruN a/mi/miarc.c b/mi/miarc.c +--- a/mi/miarc.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/mi/miarc.c 2024-08-02 10:34:26.858386257 +0200 +@@ -74,7 +74,8 @@ + static double miDcos(double a); + static double miDasin(double v); + static double miDatan2(double dy, double dx); +-double cbrt(double); ++ ++double cbrt(double); + + #ifdef ICEILTEMPDECL + ICEILTEMPDECL +diff -ruN a/mi/mi.h b/mi/mi.h +--- a/mi/mi.h 2022-11-07 07:44:53.000000000 +0100 ++++ b/mi/mi.h 2024-08-02 10:34:26.859386118 +0200 +@@ -56,6 +56,10 @@ + #include "input.h" + #include "cursor.h" + ++#ifdef __phoenix__ ++#define hypot(x,y) sqrt(((x)*(x))+((y)*(y))) ++#endif ++ + #define MiBits CARD32 + + typedef struct _miDash *miDashPtr; +diff -ruN a/mi/miinitext.c b/mi/miinitext.c +--- a/mi/miinitext.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/mi/miinitext.c 2024-08-02 10:34:26.858386257 +0200 +@@ -147,7 +147,9 @@ + #ifdef SCREENSAVER + { "MIT-SCREEN-SAVER", &noScreenSaverExtension }, + #endif ++#ifndef __phoenix__ + { SHMNAME, &noMITShmExtension }, ++#endif + { "RANDR", &noRRExtension }, + { "RENDER", &noRenderExtension }, + { "SHAPE", &noShapeExtension }, +diff -ruN a/mi/miscrinit.c b/mi/miscrinit.c +--- a/mi/miscrinit.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/mi/miscrinit.c 2024-08-02 10:34:26.860385979 +0200 +@@ -38,8 +38,10 @@ + #include "pixmapstr.h" + #include "dix.h" + #include "miline.h" ++#ifndef __phoenix__ + #define _XSHM_SERVER_ + #include ++#endif + #include "shmint.h" + + /* We use this structure to propogate some information from miScreenInit to diff --git a/tinyx/patches/tinyx/eed490/04-dixfonts.patch b/tinyx/patches/tinyx/eed490/04-dixfonts.patch new file mode 100644 index 0000000..4956aa4 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/04-dixfonts.patch @@ -0,0 +1,16 @@ +diff -ruN a/dix/dixfonts.c b/dix/dixfonts.c +--- a/dix/dixfonts.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/dix/dixfonts.c 2024-08-02 11:12:41.020667770 +0200 +@@ -1859,10 +1859,10 @@ + patternCache = MakeFontPatternCache(); + + { +-#ifdef KDRIVESERVER + BuiltinRegisterFpeFunctions(); +-#endif ++#ifndef __phoenix__ + FontFileRegisterFpeFunctions(); ++#endif + } + } + diff --git a/tinyx/patches/tinyx/eed490/05-os.patch b/tinyx/patches/tinyx/eed490/05-os.patch new file mode 100644 index 0000000..5e7c761 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/05-os.patch @@ -0,0 +1,118 @@ +diff -ruN a/os/connection.c b/os/connection.c +--- a/os/connection.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/os/connection.c 2024-08-02 10:34:26.883382778 +0200 +@@ -170,7 +170,7 @@ + lastfdesc = sysconf(_SC_OPEN_MAX) - 1; + #endif + +-#ifdef HAS_GETDTABLESIZE ++#if defined(HAS_GETDTABLESIZE) && !defined(__phoenix__) + if (lastfdesc < 0) + lastfdesc = getdtablesize() - 1; + #endif +diff -ruN a/os/osdep.h b/os/osdep.h +--- a/os/osdep.h 2022-11-07 07:44:53.000000000 +0100 ++++ b/os/osdep.h 2024-08-02 10:34:26.883382778 +0200 +@@ -52,6 +52,8 @@ + #ifndef _OSDEP_H_ + #define _OSDEP_H_ 1 + ++#define DEBUG ++ + #define BOTIMEOUT 200 /* in milliseconds */ + #define BUFSIZE 4096 + #define BUFWATERMARK 8192 +@@ -69,6 +71,11 @@ + #undef _POSIX_SOURCE + #endif + ++#ifdef __phoenix__ ++#include ++#define NOFILES_MAX RLIMIT_NOFILE ++#endif ++ + #ifndef OPEN_MAX + #include + #ifndef OPEN_MAX +diff -ruN a/os/osinit.c b/os/osinit.c +--- a/os/osinit.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/os/osinit.c 2024-08-02 11:09:16.163880506 +0200 +@@ -94,8 +94,10 @@ + + + if (!been_here) { ++#ifndef __phoenix__ + fclose(stdin); + fclose(stdout); ++#endif + /* + * If a write of zero bytes to stderr returns non-zero, i.e. -1, + * then writing to stderr failed, and we'll write somewhere else +@@ -120,7 +122,9 @@ + dup2 (fileno (err), 2); + fclose (err); + } ++#ifndef __phoenix__ + setlinebuf(stderr); ++#endif + } + + if (getpgrp () == 0) +diff -ruN a/os/utils.c b/os/utils.c +--- a/os/utils.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/os/utils.c 2024-08-02 10:34:26.884382639 +0200 +@@ -206,6 +206,7 @@ + void + LockServer(void) + { ++#ifndef __phoenix__ + char tmp[PATH_MAX], pid_str[12]; + int lfd, i, haslock, l_pid, t; + char *tmppath = NULL; +@@ -327,6 +328,7 @@ + if (!haslock) + FatalError("Could not create server lock file: %s\n", LockFile); + StillLocking = FALSE; ++#endif + } + + /* +@@ -336,12 +338,14 @@ + void + UnlockServer(void) + { ++#ifndef __phoenix__ + if (nolock) return; + + if (!StillLocking){ + + (void) unlink(LockFile); + } ++#endif + } + + /* Force connections to close on SIGHUP from init */ +@@ -985,9 +989,12 @@ + Bool SmartScheduleIdle; + Bool SmartScheduleTimerStopped; + ++#ifndef __phoenix__ ++/* Phoenix currently doesn't support virtual timers */ + #ifdef SIGVTALRM + #define SMART_SCHEDULE_POSSIBLE + #endif ++#endif + + #ifdef SMART_SCHEDULE_POSSIBLE + #define SMART_SCHEDULE_SIGNAL SIGALRM +@@ -1334,10 +1341,6 @@ + cur->next = pidlist; + pidlist = cur; + +-#ifdef DEBUG +- ErrorF("Popen: `%s', fp = %p\n", command, iop); +-#endif +- + return iop; + #else + int ruid, euid; diff --git a/tinyx/patches/tinyx/eed490/06-Xext.patch b/tinyx/patches/tinyx/eed490/06-Xext.patch new file mode 100644 index 0000000..3741b7e --- /dev/null +++ b/tinyx/patches/tinyx/eed490/06-Xext.patch @@ -0,0 +1,84 @@ +diff -ruN a/Xext/shm.c b/Xext/shm.c +--- a/Xext/shm.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/Xext/shm.c 2024-08-02 10:34:26.811392798 +0200 +@@ -33,8 +33,10 @@ + #endif + + #include ++#ifndef __phoenix__ + #include + #include ++#endif + #include + #include + #include +@@ -210,6 +212,9 @@ + void + ShmExtensionInit(INITARGS) + { ++#ifdef __phoenix__ ++ return; // kernel has no support for shm ++#endif + ExtensionEntry *extEntry; + + int i; +@@ -278,15 +283,22 @@ + void + ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs) + { ++#ifdef __phoenix__ ++ return; // kernel has no support for shm ++#endif + shmFuncs[pScreen->myNum] = funcs; + } + + void + ShmSetPixmapFormat(ScreenPtr pScreen, int format) + { ++#ifdef __phoenix__ ++ return; // kernel has no support for shm ++#endif + shmPixFormat[pScreen->myNum] = format; + } + ++#ifndef __phoenix__ + static Bool + ShmDestroyPixmap(PixmapPtr pPixmap) + { +@@ -308,14 +320,19 @@ + pScreen->DestroyPixmap = ShmDestroyPixmap; + return ret; + } ++#endif + + void + ShmRegisterFbFuncs(pScreen) + ScreenPtr pScreen; + { ++#ifdef __phoenix__ ++ return; // kernel has no support for shm ++#endif + shmFuncs[pScreen->myNum] = &fbFuncs; + } + ++#ifndef __phoenix__ + static int + ProcShmQueryVersion(client) + ClientPtr client; +@@ -989,3 +1006,4 @@ + return BadRequest; + } + } ++#endif +diff -ruN a/Xext/sync.c b/Xext/sync.c +--- a/Xext/sync.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/Xext/sync.c 2024-08-02 10:34:26.810392937 +0200 +@@ -65,7 +65,7 @@ + #include "resource.h" + #include "opaque.h" + #define _SYNC_SERVER +-#include ++#include + #include + + #include diff --git a/tinyx/patches/tinyx/eed490/07-kdrive-fbdev.patch b/tinyx/patches/tinyx/eed490/07-kdrive-fbdev.patch new file mode 100644 index 0000000..9737033 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/07-kdrive-fbdev.patch @@ -0,0 +1,388 @@ +diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c +--- a/kdrive/fbdev/fbdev.c 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/fbdev/fbdev.c 2024-08-02 11:21:27.050721634 +0200 +@@ -37,6 +37,7 @@ + + static Bool fbdevInitialize(KdCardInfo * card, FbdevPriv * priv) + { ++#if 0 + unsigned long off; + + if (fbdevDevicePath == NULL) +@@ -75,6 +76,35 @@ + } + off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize(); + priv->fb = priv->fb_base + off; ++#endif ++ ++ int k; ++ ++ priv->bits_per_pixel = 32; ++ priv->smem_len = 0x2000; ++ ++ if ((k = graph_init()) < 0) { ++ FatalError("failed to initialize libgraph"); ++ } ++ ++ if ((k = graph_open(&priv->g, GRAPH_ANY, priv->smem_len)) < 0) { ++ graph_done(); ++ FatalError("failed to initialize graphics adapter: %s", strerror(k)); ++ } ++ ++ if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_DEFFREQ)) < 0) { ++ FatalError("failed to set graphics mode: %d", k); ++ } ++ ++ if (priv->g.depth != 4) { ++ FatalError(stderr, "32-bit video resolution required"); ++ } ++ ++ priv->fb = priv->g.data; ++ ++ priv->g.height = priv->g.height; ++ priv->g.width = priv->g.width; ++ + return TRUE; + } + +@@ -95,6 +125,7 @@ + return TRUE; + } + ++#if 0 + static Pixel fbdevMakeContig(Pixel orig, Pixel others) + { + Pixel low; +@@ -141,8 +172,11 @@ + var->sync |= FB_SYNC_VERT_HIGH_ACT; + } + ++#endif ++ + static Bool fbdevScreenInitialize(KdScreenInfo * screen, FbdevScrPriv * scrpriv) + { ++#if 0 + FbdevPriv *priv = screen->card->driver; + Pixel allbits; + int depth; +@@ -278,6 +312,27 @@ + screen->fb.bitsPerPixel = priv->var.bits_per_pixel; + + scrpriv->randr = screen->randr; ++#endif ++ FbdevPriv *priv = screen->card->driver; ++ int depth = priv->bits_per_pixel; ++ ++ screen->width = 640; ++ screen->height = 400; ++ screen->rate = 30; ++ screen->fb.depth = depth; ++ ++ depth = priv->bits_per_pixel; ++ ++ /* Calculate line_length if it's zero */ ++ if (!priv->line_length) ++ priv->line_length = (priv->g.width * depth + 7) / 8; ++ ++ screen->fb.visuals = (1 << TrueColor); ++#define Mask(o,l) (((1 << l) - 1) << o) ++ screen->fb.redMask = Mask(16,8); ++ screen->fb.greenMask = Mask(8,8); ++ screen->fb.blueMask = Mask(0,8); ++ screen->fb.bitsPerPixel = priv->bits_per_pixel; + + return fbdevMapFramebuffer(screen); + } +@@ -307,8 +361,8 @@ + + if (!pScreenPriv->enabled) + return 0; +- *size = priv->fix.line_length; +- return (CARD8 *) priv->fb + row * priv->fix.line_length + offset; ++ *size = priv->line_length; ++ return (CARD8 *) priv->fb + row * priv->line_length + offset; + } + + static Bool fbdevMapFramebuffer(KdScreenInfo * screen) +@@ -317,39 +371,26 @@ + KdMouseMatrix m; + FbdevPriv *priv = screen->card->driver; + +- if (scrpriv->randr != RR_Rotate_0 || +- priv->fix.type != FB_TYPE_PACKED_PIXELS) +- scrpriv->shadow = TRUE; +- else +- scrpriv->shadow = FALSE; ++ scrpriv->shadow = FALSE; + + KdComputeMouseMatrix(&m, scrpriv->randr, screen->width, screen->height); + + KdSetMouseMatrix(&m); + +- screen->width = priv->var.xres; +- screen->height = priv->var.yres; ++ screen->width = priv->g.width; ++ screen->height = priv->g.height; + screen->memory_base = (CARD8 *) (priv->fb); +- screen->memory_size = priv->fix.smem_len; ++ screen->memory_size = priv->smem_len; + +- if (scrpriv->shadow) { +- if (!KdShadowFbAlloc(screen, +- scrpriv-> +- randr & (RR_Rotate_90 | RR_Rotate_270))) +- return FALSE; +- screen->off_screen_base = screen->memory_size; +- } else { +- screen->fb.byteStride = priv->fix.line_length; +- screen->fb.pixelStride = (priv->fix.line_length * 8 / +- priv->var.bits_per_pixel); +- screen->fb.frameBuffer = (CARD8 *) (priv->fb); +- screen->off_screen_base = +- screen->fb.byteStride * screen->height; +- } ++ screen->fb.byteStride = (priv->g.width * priv->bits_per_pixel + 7) / 8; ++ screen->fb.pixelStride = priv->g.width; ++ screen->fb.frameBuffer = (CARD8 *) (priv->fb); ++ screen->off_screen_base = screen->fb.byteStride * screen->height; + + return TRUE; + } + ++#if 0 + static void fbdevSetScreenSizes(ScreenPtr pScreen) + { + KdScreenPriv(pScreen); +@@ -375,9 +416,11 @@ + KdShadowFbFree(screen); + return TRUE; + } ++#endif + + static Bool fbdevSetShadow(ScreenPtr pScreen) + { ++#if 0 + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + FbdevScrPriv *scrpriv = screen->driver; +@@ -426,10 +469,13 @@ + else + update = shadowUpdatePacked; + return KdShadowSet(pScreen, scrpriv->randr, update, window); ++#endif ++ return TRUE; + } + + static Bool fbdevRandRGetInfo(ScreenPtr pScreen, Rotation * rotations) + { ++#if 0 + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + FbdevScrPriv *scrpriv = screen->driver; +@@ -454,6 +500,7 @@ + + RRSetCurrentConfig(pScreen, randr, 0, pSize); + ++#endif + return TRUE; + } + +@@ -461,6 +508,7 @@ + fbdevRandRSetConfig(ScreenPtr pScreen, + Rotation randr, int rate, RRScreenSizePtr pSize) + { ++#if 0 + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + FbdevScrPriv *scrpriv = screen->driver; +@@ -548,6 +596,8 @@ + if (wasEnabled) + KdEnableScreen(pScreen); + return FALSE; ++#endif ++ return TRUE; + } + + static Bool fbdevRandRInit(ScreenPtr pScreen) +@@ -566,33 +616,26 @@ + static Bool fbdevCreateColormap(ColormapPtr pmap) + { + ScreenPtr pScreen = pmap->pScreen; +- KdScreenPriv(pScreen); +- FbdevPriv *priv = pScreenPriv->card->driver; + VisualPtr pVisual; + int i; + int nent; + xColorItem *pdefs; + +- switch (priv->fix.visual) { +- case FB_VISUAL_STATIC_PSEUDOCOLOR: +- pVisual = pmap->pVisual; +- nent = pVisual->ColormapEntries; +- pdefs = malloc(nent * sizeof(xColorItem)); +- if (!pdefs) +- return FALSE; +- for (i = 0; i < nent; i++) +- pdefs[i].pixel = i; +- fbdevGetColors(pScreen, nent, pdefs); +- for (i = 0; i < nent; i++) { +- pmap->red[i].co.local.red = pdefs[i].red; +- pmap->red[i].co.local.green = pdefs[i].green; +- pmap->red[i].co.local.blue = pdefs[i].blue; +- } +- free(pdefs); +- return TRUE; +- default: +- return fbInitializeColormap(pmap); ++ pVisual = pmap->pVisual; ++ nent = pVisual->ColormapEntries; ++ pdefs = malloc(nent * sizeof(xColorItem)); ++ if (!pdefs) ++ return FALSE; ++ for (i = 0; i < nent; i++) ++ pdefs[i].pixel = i; ++ fbdevGetColors(pScreen, nent, pdefs); ++ for (i = 0; i < nent; i++) { ++ pmap->red[i].co.local.red = pdefs[i].red; ++ pmap->green[i].co.local.green = pdefs[i].green; ++ pmap->blue[i].co.local.blue = pdefs[i].blue; + } ++ free(pdefs); ++ return TRUE; + } + + Bool fbdevInitScreen(ScreenPtr pScreen) +@@ -622,6 +665,7 @@ + { + } + ++#if 0 + static int fbdevUpdateFbColormap(FbdevPriv *priv, int minidx, int maxidx) + { + struct fb_cmap cmap; +@@ -635,9 +679,11 @@ + + return ioctl(priv->fd, FBIOPUTCMAP, &cmap); + } ++#endif + + Bool fbdevEnable(ScreenPtr pScreen) + { ++#if 0 + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + int k; +@@ -668,11 +714,13 @@ + i--; + fbdevUpdateFbColormap(priv, 0, i); + } ++#endif + return TRUE; + } + + Bool fbdevDPMS(ScreenPtr pScreen, int mode) + { ++#if 0 + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + static int oldmode = -1; +@@ -692,6 +740,8 @@ + } + #endif + return FALSE; ++#endif ++ return TRUE; + } + + void fbdevDisable(ScreenPtr pScreen) +@@ -710,8 +760,8 @@ + { + FbdevPriv *priv = card->driver; + +- munmap(priv->fb_base, priv->fix.smem_len); +- close(priv->fd); ++ graph_close(&priv->g); ++ graph_done(); + free(priv); + } + +@@ -721,9 +771,6 @@ + + void fbdevGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs) + { +- KdScreenPriv(pScreen); +- FbdevPriv *priv = pScreenPriv->card->driver; +- struct fb_cmap cmap; + int p; + int k; + int min, max; +@@ -736,22 +783,9 @@ + if (pdefs[k].pixel > max) + max = pdefs[k].pixel; + } +- cmap.start = min; +- cmap.len = max - min + 1; +- cmap.red = &priv->red[min]; +- cmap.green = &priv->green[min]; +- cmap.blue = &priv->blue[min]; +- cmap.transp = 0; +- k = ioctl(priv->fd, FBIOGETCMAP, &cmap); +- if (k < 0) { +- perror("can't get colormap"); +- return; +- } + while (n--) { + p = pdefs->pixel; +- pdefs->red = priv->red[p]; +- pdefs->green = priv->green[p]; +- pdefs->blue = priv->blue[p]; ++ pdefs->red = pdefs->green = pdefs->blue = p; + pdefs++; + } + } +@@ -761,6 +795,7 @@ + */ + void fbdevPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs) + { ++#if 0 + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + int p; +@@ -781,4 +816,5 @@ + } + + fbdevUpdateFbColormap(priv, min, max); ++#endif + } +diff -ruN a/kdrive/fbdev/fbdev.h b/kdrive/fbdev/fbdev.h +--- a/kdrive/fbdev/fbdev.h 2022-11-07 07:44:53.000000000 +0100 ++++ b/kdrive/fbdev/fbdev.h 2024-08-02 10:34:26.846387927 +0200 +@@ -23,8 +23,7 @@ + + #ifndef _FBDEV_H_ + #define _FBDEV_H_ +-#include +-#include ++#include + #include + #include + #include "kdrive.h" +@@ -32,14 +31,11 @@ + #include "randrstr.h" + + typedef struct _fbdevPriv { +- struct fb_var_screeninfo var; +- struct fb_fix_screeninfo fix; +- __u16 red[256]; +- __u16 green[256]; +- __u16 blue[256]; +- int fd; ++ graph_t g; ++ uint32_t smem_len; /* Length of frame buffer mem */ ++ uint32_t line_length; /* length of a line in bytes */ ++ uint32_t bits_per_pixel; /* guess what */ + char *fb; +- char *fb_base; + } FbdevPriv; + + typedef struct _fbdevScrPriv { diff --git a/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch b/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch new file mode 100644 index 0000000..d758b33 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch @@ -0,0 +1,37 @@ +diff -ruN a/standard_definitions.mk b/standard_definitions.mk +--- a/standard_definitions.mk 2014-11-08 16:38:44.000000000 +0100 ++++ b/standard_definitions.mk 2024-07-12 10:30:28.175542021 +0200 +@@ -1,26 +1,23 @@ + + #compiler +-CC=/usr/bin/gcc ++# CC=/usr/bin/gcc + #CC=/opt/musl/bin/musl-gcc + + #compilerflags +-COMPFLAGS=-pipe -Os -mtune=i386 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -fno-strength-reduce -nodefaultlibs -fno-strict-aliasing -I. -ffunction-sections -fdata-sections ++COMPFLAGS=-pipe -static -Os -mtune=i386 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -fno-strength-reduce -nodefaultlibs -fno-strict-aliasing -I. -ffunction-sections -fdata-sections + + COMMONDEFS=$(COMPFLAGS) -D_BSD_SOURCE -D_GNU_SOURCE -DUSECMS + +-LDFLAGS=-Wl,--gc-sections,--sort-common,-s ++# LDFLAGS=-Wl,--gc-sections,--sort-common,-s,-static + + #LINKDIR=-L/opt/musl/lib +-LINKDIR=-L/usr/lib ++LINKDIR=-L/lib + +-#PREDIR=/opt/musl +-PREDIR=/usr ++# LIBDIR=/lib + +-LIBDIR=${PREDIR}/lib +- +-INCDIR=${PREDIR}/include ++# INCDIR=/include + + #If you do not have setlocale, set this: + #COMMONDEFS+= -DX_LOCALE -DXLOCALEDIR=\"/usr/share/locale\" + #KEYSYMDB=/usr/X11R7/lib/X11/XKeysymDB +-KEYSYMDB=${PREDIR}/share/X11/XKeysymDB ++KEYSYMDB=$(LIBDIR)/share/X11/XKeysymDB diff --git a/tinyx/patches/tinyxlib/9862f3/02-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/02-Makefile.patch new file mode 100644 index 0000000..91fb492 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/02-Makefile.patch @@ -0,0 +1,71 @@ +diff -ruN a/Makefile b/Makefile +--- a/Makefile 2014-11-08 16:38:44.000000000 +0100 ++++ b/Makefile 2024-07-12 10:39:50.814037344 +0200 +@@ -1,67 +1,19 @@ + all: + cd libXau; make +- cd libICE; make +- cd libSM; make + cd libXext; make + cd libtinyX11; make +- cd libXt; make +- cd libXmu; make +- cd libXv; make +- cd libXinerama; make +- cd libXrender; make +- cd libXpm; make +- cd libXtst; make +- cd libXfont; make + cd libXdmcp; make +- cd libXi; make +- cd libXaw; make +- cd libXmuu; make +- cd libXss; make +- cd libXfixes; make +- cd libXcursor; make + mkdir -p include/pkgconfig && cd include/pkgconfig && ln -sf ../../lib*/*.pc ./ + clean: + cd libtinyX11; make clean +- cd libICE; make clean +- cd libSM; make clean +- cd libXmu; make clean +- cd libXt; make clean +- cd libXv; make clean + cd libXext; make clean +- cd libXinerama; make clean + cd libXau; make clean +- cd libXrender; make clean +- cd libXpm; make clean +- cd libXtst; make clean +- cd libXfont; make clean + cd libXdmcp; make clean +- cd libXi; make clean +- cd libXaw; make clean +- cd libXmuu; make clean +- cd libXss; make clean +- cd libXfixes; make clean +- cd libXcursor; make clean + install: + cd libXau; make install + cd libtinyX11; make install +- cd libICE; make install +- cd libSM; make install +- cd libXmu; make install +- cd libXt; make install +- cd libXv; make install + cd libXext; make install +- cd libXinerama; make install +- cd libXrender; make install +- cd libXpm; make install +- cd libXtst; make install +- cd libXfont; make install + cd libXdmcp; make install +- cd libXi; make install +- cd libXaw; make install +- cd libXmuu; make install +- cd libXss; make install +- cd libXfixes; make install +- cd libXcursor; make install + cd include; make install + tarball: clean + ./make-tarball.sh diff --git a/tinyx/patches/tinyxlib/9862f3/04-include-X11-Xos_r.h.patch b/tinyx/patches/tinyxlib/9862f3/04-include-X11-Xos_r.h.patch new file mode 100644 index 0000000..cfce074 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/04-include-X11-Xos_r.h.patch @@ -0,0 +1,23 @@ +diff -ruN a/include/X11/Xos_r.h b/include/X11/Xos_r.h +--- a/include/X11/Xos_r.h 2024-07-11 17:36:05.660187032 +0200 ++++ b/include/X11/Xos_r.h 2024-07-12 09:29:55.822006293 +0200 +@@ -307,7 +307,7 @@ + (_Xos_processUnlock), \ + (p).pwp ) + +-#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) ++#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(__phoenix__) + /* SVR4 threads, AIX 4.2.0 and earlier and OSF/1 3.2 and earlier pthreads */ + # define X_NEEDS_PWPARAMS + typedef struct { +@@ -391,6 +391,10 @@ + #include + #endif + ++#ifdef __phoenix__ ++#define MAXHOSTNAMELEN HOST_NAME_MAX ++#endif ++ + typedef struct { + struct hostent hent; + char h_name[MAXHOSTNAMELEN]; diff --git a/tinyx/patches/tinyxlib/9862f3/05-libxtrans-Xtransint.h.patch b/tinyx/patches/tinyxlib/9862f3/05-libxtrans-Xtransint.h.patch new file mode 100644 index 0000000..e8f1a93 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/05-libxtrans-Xtransint.h.patch @@ -0,0 +1,15 @@ +diff -ruN a/libxtrans/Xtransint.h b/libxtrans/Xtransint.h +--- a/libxtrans/Xtransint.h 2024-07-11 17:36:05.740203908 +0200 ++++ b/libxtrans/Xtransint.h 2024-07-12 09:30:23.087290981 +0200 +@@ -97,6 +97,11 @@ + #endif + #include + ++#ifdef __phoenix__ ++#include ++#define NOFILES_MAX RLIMIT_NOFILE ++#endif ++ + /* + * makedepend screws up on #undef OPEN_MAX, so we define a new symbol + */ diff --git a/tinyx/patches/tinyxlib/9862f3/06-libxtrans-Xtranssock.c.patch b/tinyx/patches/tinyxlib/9862f3/06-libxtrans-Xtranssock.c.patch new file mode 100644 index 0000000..de7211c --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/06-libxtrans-Xtranssock.c.patch @@ -0,0 +1,11 @@ +diff -ruN a/libxtrans/Xtranssock.c b/libxtrans/Xtranssock.c +--- a/libxtrans/Xtranssock.c 2024-07-11 17:36:05.740203908 +0200 ++++ b/libxtrans/Xtranssock.c 2024-07-12 09:56:30.954167196 +0200 +@@ -84,7 +84,7 @@ + + #include + +- ++#define h_addr h_addr_list[0] /* phoenix change */ + + diff --git a/tinyx/patches/tinyxlib/9862f3/10-libtinyX11-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/10-libtinyX11-Makefile.patch new file mode 100644 index 0000000..42917ce --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/10-libtinyX11-Makefile.patch @@ -0,0 +1,25 @@ +diff -ruN a/libtinyX11/Makefile b/libtinyX11/Makefile +--- a/libtinyX11/Makefile 2014-11-08 16:38:44.000000000 +0100 ++++ b/libtinyX11/Makefile 2024-07-12 10:34:19.235959177 +0200 +@@ -16,11 +16,6 @@ + + all: $(OBJS:.c=.o) + ar cr libX11.a $(OBJS:.c=.o) $(XAUOBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libX11.so.6.2~ -shared -Wl,-soname,libX11.so.6.2 $(OBJS:.c=.o) $(XAUOBJS:.c=.o) \ +- -L../libXext -lXext +- mv -f libX11.so.6.2~ libX11.so.6.2 +- ln -sf libX11.so.6.2 libX11.so.6 +- ln -sf libX11.so.6.2 libX11.so + + @echo "prefix=$(PREDIR)" > x11.pc + @echo "exec_prefix=$(PREDIR)/bin" >> x11.pc +@@ -53,9 +48,6 @@ + + install: + cp -af libX11.a $(DESTDIR)$(LIBDIR) +- cp -af libX11.so.6.2 $(DESTDIR)$(LIBDIR) +- cp -af libX11.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libX11.so $(DESTDIR)$(LIBDIR) + cp -a XKeysymDB $(DESTDIR)$(KEYSYMDB) + + depend: diff --git a/tinyx/patches/tinyxlib/9862f3/11-libXau-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/11-libXau-Makefile.patch new file mode 100644 index 0000000..22bd7ee --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/11-libXau-Makefile.patch @@ -0,0 +1,24 @@ +diff -ruN a/libXau/Makefile b/libXau/Makefile +--- a/libXau/Makefile 2014-11-08 16:38:44.000000000 +0100 ++++ b/libXau/Makefile 2024-07-12 10:36:54.639804045 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXau.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXau.so.6.0~ -shared -Wl,-soname,libXau.so.6 $(OBJS:.c=.o) +- mv -f libXau.so.6.0~ libXau.so.6.0 +- ln -s libXau.so.6.0 libXau.so.6 +- ln -s libXau.so.6.0 libXau.so + + @echo "prefix=$(PREDIR)" > xau.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xau.pc +@@ -32,9 +28,6 @@ + + install: + cp -af libXau.a $(DESTDIR)$(LIBDIR) +- cp -af libXau.so.6.0 $(DESTDIR)$(LIBDIR) +- cp -af libXau.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXau.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c diff --git a/tinyx/patches/tinyxlib/9862f3/12-libXdmcp-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/12-libXdmcp-Makefile.patch new file mode 100644 index 0000000..7746b22 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/12-libXdmcp-Makefile.patch @@ -0,0 +1,27 @@ +diff -ruN a/libXdmcp/Makefile b/libXdmcp/Makefile +--- a/libXdmcp/Makefile 2014-11-08 16:38:44.000000000 +0100 ++++ b/libXdmcp/Makefile 2024-07-12 10:33:56.034993396 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXdmcp.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXdmcp.so.6.0~ -shared -Wl,-soname,libXdmcp.so.6 $(OBJS:.c=.o) +- mv -f libXdmcp.so.6.0~ libXdmcp.so.6.0 +- ln -s libXdmcp.so.6.0 libXdmcp.so.6 +- ln -s libXdmcp.so.6.0 libXdmcp.so + + @echo "prefix=$(PREDIR)" > xdmcp.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xdmcp.pc +@@ -30,11 +26,8 @@ + clean: + rm -f *.o *.a *.so* xdmcp.pc + +-install: libXdmcp.a libXdmcp.so.6.0 libXdmcp.so.6 libXdmcp.so ++install: libXdmcp.a + cp -af libXdmcp.a $(DESTDIR)$(LIBDIR) +- cp -af libXdmcp.so.6.0 $(DESTDIR)$(LIBDIR) +- cp -af libXdmcp.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXdmcp.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c diff --git a/tinyx/patches/tinyxlib/9862f3/13-libXext-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/13-libXext-Makefile.patch new file mode 100644 index 0000000..580a699 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/13-libXext-Makefile.patch @@ -0,0 +1,24 @@ +diff -ruN a/libXext/Makefile b/libXext/Makefile +--- a/libXext/Makefile 2014-11-08 16:38:44.000000000 +0100 ++++ b/libXext/Makefile 2024-07-12 10:34:04.678571459 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXext.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXext.so.6.5~ -shared -Wl,-soname,libXext.so.6 $(OBJS:.c=.o) +- mv -f libXext.so.6.5~ libXext.so.6.5 +- ln -s libXext.so.6.5 libXext.so.6 +- ln -s libXext.so.6.5 libXext.so + + @echo "prefix=$(PREDIR)" > xext.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xext.pc +@@ -32,9 +28,6 @@ + + install: + cp -af libXext.a $(DESTDIR)$(LIBDIR) +- cp -af libXext.so.6.5 $(DESTDIR)$(LIBDIR) +- cp -af libXext.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXext.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c diff --git a/tinyx/patches/tinyxlib/9862f3/15-include-X11-Xtrans.h.patch b/tinyx/patches/tinyxlib/9862f3/15-include-X11-Xtrans.h.patch new file mode 100644 index 0000000..a9c2d76 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/15-include-X11-Xtrans.h.patch @@ -0,0 +1,14 @@ +diff -ruN a/include/X11/Xtrans.h b/include/X11/Xtrans.h +--- a/include/X11/Xtrans.h 2024-07-22 14:37:21.413166323 +0200 ++++ b/include/X11/Xtrans.h 2024-07-25 09:36:20.427950290 +0200 +@@ -54,8 +54,8 @@ + #ifndef _XTRANS_H_ + #define _XTRANS_H_ + +-#include "Xfuncproto.h" +-#include "Xos.h" ++#include ++#include + + + /* diff --git a/tinyx/patches/tinyxlib/9862f3/16-fix-conn.patch b/tinyx/patches/tinyxlib/9862f3/16-fix-conn.patch new file mode 100644 index 0000000..d829793 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/16-fix-conn.patch @@ -0,0 +1,78 @@ +# This patch is crucial for lively client-server connection. +# +# Caution: +# +# This uses recv(MSG_PEEK) that emulates ioctl/FIONREAD under Linux -- it +# returns the bytes available to read from the socket, and depends on ability of +# recv() to detect broken connections. With such BytesReadable() behaviour, +# it's important to NOT define XCONN_CHECK_FREQ. Otherwise expect connection +# deadlocks for absurd reasons. +# +# So, if BytesReadable()/recv behaviour changes, it is important to revisit +# XCONN_CHECK_FREQ. + +--- a/libxtrans/Xtranssock.c 2024-07-22 14:37:21.467165699 +0200 ++++ b/libxtrans/Xtranssock.c 2024-07-24 14:08:56.034387339 +0200 +@@ -1541,14 +1541,18 @@ + + #endif /* TRANS_CLIENT */ + +- + static int + TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) + + { +- PRMSG (2,"SocketBytesReadable(%x,%d,%x)\n", +- ciptr, ciptr->fd, pend); +- return ioctl (ciptr->fd, FIONREAD, (char *) pend); ++/* this bufsize doesn't really matter, but using recv() as a replacement ++ * for ioctl/FIONREAD is quite slow ++ * TODO implement ioctl/FIONREAD in phoenix kernel */ ++#define BUFSIZE 64 ++static char buf[BUFSIZE]; ++ *pend = recv(ciptr->fd, buf, BUFSIZE, MSG_PEEK); ++ if (pend < 0) return -1; ++ return 0; + } + + +diff -ruN a/include/X11/Xlibint.h b/include/X11/Xlibint.h +--- a/include/X11/Xlibint.h 2024-07-25 15:04:02.350699330 +0200 ++++ b/include/X11/Xlibint.h 2024-07-29 14:49:08.729362429 +0200 +@@ -50,9 +50,9 @@ + * If your BytesReadable correctly detects broken connections, then + * you should NOT define XCONN_CHECK_FREQ. + */ +-#ifndef XCONN_CHECK_FREQ +-#define XCONN_CHECK_FREQ 256 +-#endif ++// #ifndef XCONN_CHECK_FREQ ++// #define XCONN_CHECK_FREQ 256 ++// #endif + + struct _XGC + { +diff -ruN a/include/X11/Xpoll.h b/include/X11/Xpoll.h +--- a/include/X11/Xpoll.h 2024-07-25 15:04:02.351699987 +0200 ++++ b/include/X11/Xpoll.h 2024-07-29 14:37:45.800784463 +0200 +@@ -146,7 +146,7 @@ + (dst)->fds_bits[7] &= ~((b1)->fds_bits[7]); + + #else /* USE_POLL */ +-#include ++#include + #endif /* USE_POLL */ + + #endif /* _XPOLL_H_ */ +diff -ruN a/standard_definitions.mk b/standard_definitions.mk +--- a/standard_definitions.mk 2024-07-25 15:04:02.434754552 +0200 ++++ b/standard_definitions.mk 2024-07-29 14:34:16.832826259 +0200 +@@ -4,7 +4,7 @@ + #CC=/opt/musl/bin/musl-gcc + + #compilerflags +-COMPFLAGS=-pipe -static -Os -mtune=i386 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -fno-strength-reduce -nodefaultlibs -fno-strict-aliasing -I. -ffunction-sections -fdata-sections ++COMPFLAGS=-pipe -static -Os -mtune=i386 -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -DUSE_POLL -fno-strength-reduce -nodefaultlibs -fno-strict-aliasing -I. -ffunction-sections -fdata-sections + + COMMONDEFS=$(COMPFLAGS) -D_BSD_SOURCE -D_GNU_SOURCE -DUSECMS + diff --git a/tinyx/patches/tinyxlib/optional/17-conn-debug.patch b/tinyx/patches/tinyxlib/optional/17-conn-debug.patch new file mode 100644 index 0000000..615dcd8 --- /dev/null +++ b/tinyx/patches/tinyxlib/optional/17-conn-debug.patch @@ -0,0 +1,563 @@ +diff -ruN a/libtinyX11/ConnDis.c b/libtinyX11/ConnDis.c +--- a/libtinyX11/ConnDis.c 2024-07-22 14:37:21.452165872 +0200 ++++ b/libtinyX11/ConnDis.c 2024-07-22 14:37:21.313167479 +0200 +@@ -39,6 +39,8 @@ + #include + #include + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); ++ + #ifndef MINIX + #include + #endif +@@ -102,6 +104,7 @@ + char **auth_datap; /* RETURN */ + int *auth_datalenp; /* RETURN */ + { ++ HERE + int family; + int saddrlen; + Xtransaddr *saddr; +@@ -201,6 +204,7 @@ + idisplay = atoi (pdpynum); + + ++ HERE + /* + * Step 3, find the screen number. This field is optional. It is + * present only if the display number was followed by a period (which +@@ -308,6 +312,7 @@ + break; + } + ++ HERE + + if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 ) + { +@@ -316,12 +321,15 @@ + + if (connect_stat == TRANS_TRY_CONNECT_AGAIN) + { ++ HERE + sleep(1); + continue; + } + else ++ HERE + break; + } ++ HERE + + _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr); + +@@ -344,6 +352,7 @@ + continue; + } + ++ HERE + break; + } + +@@ -356,7 +365,9 @@ + * Set close-on-exec so that programs that fork() doesn't get confused. + */ + ++ HERE + _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1); ++ HERE + + /* + * Build the expanded display name: +@@ -379,10 +390,12 @@ + if (phostname) Xfree (phostname); + if (pdpynum) Xfree (pdpynum); + if (pscrnum) Xfree (pscrnum); ++ HERE + + + GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay, + auth_namep, auth_namelenp, auth_datap, auth_datalenp); ++ HERE + + return trans_conn; + +diff -ruN a/libtinyX11/OpenDis.c b/libtinyX11/OpenDis.c +--- a/libtinyX11/OpenDis.c 2024-07-22 14:37:21.458165803 +0200 ++++ b/libtinyX11/OpenDis.c 2024-07-22 14:37:21.319167410 +0200 +@@ -35,6 +35,7 @@ + #include + #include + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); + + #define Size_t size_t + +@@ -82,6 +83,7 @@ + register char *display; + #endif + { ++ HERE + register Display *dpy; /* New Display object being created. */ + register int i; + int j, k; /* random iterator indexes */ +@@ -145,6 +147,7 @@ + if ((dpy = (Display *)Xcalloc(1, sizeof(Display))) == NULL) { + return(NULL); + } ++ HERE + + /* + * Call the Connect routine to get the transport connection object. +@@ -165,6 +168,7 @@ + + dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn); + ++ HERE + + + /* Initialize as much of the display structure as we can. +@@ -225,6 +229,7 @@ + dpy->flushes = NULL; + dpy->xcmisc_opcode = 0; + dpy->xkb_info = NULL; ++ HERE + + /* + * Setup other information in this display structure. +@@ -249,6 +254,7 @@ + OutOfMemory (dpy, setup); + return(NULL); + } ++ HERE + + /* Set up the output buffers. */ + if ((dpy->bufptr = dpy->buffer = Xcalloc(1, BUFSIZE)) == NULL) { +@@ -299,6 +305,7 @@ + * Now see if connection was accepted... + */ + /* these internal functions expect the display to be locked */ ++ HERE + LockDisplay(dpy); + + if (prefixread == 0) +@@ -354,6 +361,7 @@ + OutOfMemory(dpy, setup); + return (NULL); + } ++ HERE + + /* + * We succeeded at authorization, so let us move the data into +@@ -501,6 +509,7 @@ + /* + * Now start talking to the server to setup all other information... + */ ++ HERE + + Xfree (setup); /* all finished with setup information */ + +@@ -515,6 +524,7 @@ + /* + * finished calling internal routines, now unlock for external routines + */ ++ HERE + UnlockDisplay(dpy); + + /* +@@ -536,6 +546,7 @@ + * call into synchronization routine so that all programs can be + * forced synchronous + */ ++ HERE + (void) XSynchronize(dpy, _Xdebug); + + /* +@@ -603,6 +614,7 @@ + /* + * and return successfully + */ ++ HERE + return(dpy); + } + +diff -ruN a/libXfont/fc/fserve.c b/libXfont/fc/fserve.c +--- a/libXfont/fc/fserve.c 2024-07-22 14:37:21.433166092 +0200 ++++ b/libXfont/fc/fserve.c 2024-07-22 14:37:21.296167676 +0200 +@@ -619,7 +619,7 @@ + if (rep->length > MAX_REPLY_LENGTH) + { + fprintf(stderr, "fserve: reply length %u > MAX_REPLY_LENGTH," +- " disconnecting from font server\n", (uint)rep->length); ++ " disconnecting from font server\n", (u_int)rep->length); + _fs_connection_died (conn); + *error = FSIO_ERROR; + return 0; +diff -ruN a/libxtrans/Xtransint.h b/libxtrans/Xtransint.h +--- a/libxtrans/Xtransint.h 2024-07-22 14:37:21.467165699 +0200 ++++ b/libxtrans/Xtransint.h 2024-07-22 15:30:12.478079720 +0200 +@@ -72,7 +72,7 @@ + * message. + */ + +-# define XTRANSDEBUG 1 ++# define XTRANSDEBUG 1 + + + #include +diff -ruN a/libtinyX11/IfEvent.c b/libtinyX11/IfEvent.c +--- a/libtinyX11/IfEvent.c 2024-07-22 14:37:21.456165826 +0200 ++++ b/libtinyX11/IfEvent.c 2024-07-24 11:50:09.897207666 +0200 +@@ -29,6 +29,8 @@ + #define NEED_EVENTS + #include "Xlibint.h" + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); ++ + /* + * Flush output and (wait for and) return the next event matching the + * predicate in the queue. +@@ -45,10 +47,12 @@ + register XEvent *event; + char *arg; + { ++ HERE + register _XQEvent *qelt, *prev; + unsigned long qe_serial = 0; + + LockDisplay(dpy); ++ HERE + prev = NULL; + while (1) { + for (qelt = prev ? prev->next : dpy->head; +@@ -56,17 +60,21 @@ + prev = qelt, qelt = qelt->next) { + if(qelt->qserial_num > qe_serial + && (*predicate)(dpy, &qelt->event, arg)) { ++ HERE + *event = qelt->event; + _XDeq(dpy, prev, qelt); + UnlockDisplay(dpy); ++ HERE + return 0; + } + } + if (prev) + qe_serial = prev->qserial_num; ++ HERE + _XReadEvents(dpy); + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } ++ HERE + } +--- a/libtinyX11/XlibInt.c 2024-07-22 14:37:21.465165722 +0200 ++++ b/libtinyX11/XlibInt.c 2024-07-25 10:46:11.295957633 +0200 +@@ -43,6 +43,8 @@ + #include + #include + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); ++ + #ifdef XTHREADS + #include "locking.h" + +@@ -591,6 +593,7 @@ + { + char *nextindex; + #endif /* XTHREADS*/ ++ HERE + register long size, todo; + register int write_stat; + register char *bufindex; +@@ -617,20 +620,25 @@ + * until the entire buffer is written. bufindex will be + * incremented and size decremented as buffer is written out. + */ ++ HERE + while (size) { + ESET(0); ++ HERE + write_stat = _X11TransWrite(dpy->trans_conn, + bufindex, (int) todo); ++ HERE + if (write_stat >= 0) { + size -= write_stat; + todo = size; + bufindex += write_stat; + } else if (ETEST()) { ++ HERE + _XWaitForWritable(dpy + #ifdef XTHREADS + , cv + #endif + ); ++ HERE + #ifdef SUNSYSV + } else if (ECHECK(0)) { + _XWaitForWritable(dpy +@@ -654,7 +662,9 @@ + } else if (!ECHECK(EINTR)) { + /* Write failed! */ + /* errno set by write system call. */ ++ HERE + _XIOError(dpy); ++ HERE + } + } + dpy->last_req = (char *)&_dummy_request; +@@ -668,6 +678,7 @@ + #ifdef XTHREADS + dpy->flags &= ~XlibDisplayWriting; + #endif ++ HERE + return 0; + } + +@@ -856,6 +867,7 @@ + void _XReadEvents(dpy) + register Display *dpy; + { ++ HERE + _XAlignedBuffer buf; + BytesReadable_t pend; + register BytesReadable_t len; +@@ -876,6 +888,7 @@ + * unless we were called from within XProcessInternalConnection + * or XLockDisplay + */ ++ HERE + xthread_clear_id(self); + if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) + || xthread_have_id (dpy->lock->locking_thread))) +@@ -888,6 +901,7 @@ + cvl = QueueEventReaderLock(dpy); + #endif /* XTHREADS */ + ++ HERE + do { + #ifdef XTHREADS + /* if it is not our turn to read an event off the wire, +@@ -900,9 +914,11 @@ + } + #endif /* XTHREADS */ + /* find out how much data can be read */ ++ HERE + if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) + _XIOError(dpy); + len = pend; ++ printf("len: %d\n", len); + + /* must read at least one xEvent; if none is pending, then + we'll just flush and block waiting for it */ +@@ -922,6 +938,7 @@ + not_yet_flushed = False; + } + } ++ HERE + + #ifdef XTHREADS + /* If someone is waiting for a reply, gamble that +@@ -934,6 +951,7 @@ + #endif /* XTHREADS*/ + { + read_buf = buf.buf; ++ HERE + + /* but we won't read more than the max buffer size */ + if (len > BUFSIZE) +@@ -949,12 +967,14 @@ + dpy->lock->reading_thread = self; + #endif /* XTHREADS */ + dpy->flags |= XlibDisplayReadEvents; ++ HERE + i = _XRead (dpy, read_buf, (long) len); + dpy->flags &= ~XlibDisplayReadEvents; + if (i == -2) { + /* special flag from _XRead to say that internal connection has + done XPutBackEvent. Which we can use so we're done. */ + got_event: ++ HERE + #ifdef XTHREADS + if (dpy->lock && dpy->lock->lock_wait) { + if (dpy->lock->event_awaiters != cvl) +@@ -967,6 +987,7 @@ + #endif + break; + } ++ HERE + #ifdef XTHREADS + if (xthread_have_id(self)) + xthread_clear_id(dpy->lock->reading_thread); +@@ -988,6 +1009,7 @@ + } + #endif /* XTHREADS */ + ++ HERE + STARTITERATE(rep,xReply,buf.buf,len > 0) { + if (rep->generic.type == X_Reply) { + pend = len; +@@ -1006,6 +1028,7 @@ + } ENDITERATE; + } while (!_XNewerQueuedEvent(dpy, entry_event_serial_num)); + ++ HERE + UnlockNextEventReader(dpy); + /*return 0;*/ + } +@@ -1024,17 +1047,19 @@ + int original_size = size; + #endif + ++ HERE + if ((dpy->flags & XlibDisplayIOError) || size == 0) + return 0; + ESET(0); + while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size)) + != size) { +- ++ HERE + if (bytes_read > 0) { + size -= bytes_read; + data += bytes_read; + } + else if (ETEST()) { ++ HERE + if (_XWaitForReadable(dpy) == -2) + return -2; /* internal connection did XPutBackEvent */ + ESET(0); +@@ -1046,6 +1071,7 @@ + } + #endif + else if (bytes_read == 0) { ++ HERE + /* Read failed because of end of file! */ + ESET(EPIPE); + _XIOError(dpy); +@@ -1060,6 +1086,7 @@ + #ifdef XTHREADS + if (dpy->lock && dpy->lock->reply_bytes_left > 0) + { ++ HERE + dpy->lock->reply_bytes_left -= original_size; + if (dpy->lock->reply_bytes_left == 0) { + dpy->flags &= ~XlibDisplayReply; +@@ -1067,6 +1094,7 @@ + } + } + #endif /* XTHREADS*/ ++ HERE + return 0; + } + +@@ -2912,6 +2940,7 @@ + int _XIOError (dpy) + Display *dpy; + { ++ HERE + dpy->flags |= XlibDisplayIOError; + + if (_XIOErrorFunction != NULL) +--- a/libxtrans/Xtrans.c 2024-07-22 14:37:21.467165699 +0200 ++++ b/libxtrans/Xtrans.c 2024-07-25 10:00:54.118995666 +0200 +@@ -162,6 +162,8 @@ + return NULL; + } + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); ++ + #ifndef TEST_t + static + #endif /* TEST_t */ +@@ -188,6 +190,7 @@ + char hostnamebuf[256]; + + PRMSG (3,"ParseAddress(%s)\n", address, 0, 0); ++ HERE + + /* Copy the string so it can be changed */ + +@@ -210,6 +213,7 @@ + return 0; + } + ++ HERE + if (*mybuf == ':') + { + /* +@@ -234,6 +238,7 @@ + + *mybuf ++= '\0'; /* put a null at the end of the protocol */ + ++ HERE + if (strlen(_protocol) == 0) + { + /* +@@ -260,6 +265,7 @@ + return 0; + } + ++ HERE + *mybuf ++= '\0'; + + if (strlen(_host) == 0) +@@ -276,6 +282,7 @@ + mybuf++; + } + ++ HERE + /* Get the port */ + + _port = mybuf; +@@ -312,6 +319,7 @@ + else + strcpy (*protocol, _protocol); + ++ HERE + if ((*host = (char *) xalloc (strlen (_host) + 1)) == NULL) + { + /* Malloc failed */ +@@ -341,6 +349,7 @@ + + xfree (tmpptr); + ++ HERE + return 1; + } + +--- a/libxtrans/Xtranssock.c 2024-07-22 14:37:21.467165699 +0200 ++++ b/libxtrans/Xtranssock.c 2024-07-24 14:08:56.034387339 +0200 +@@ -56,6 +56,7 @@ + #include + #endif + ++#define HERE printf("%s:%d %s\n", __FILE__, __LINE__, __func__); + + #if defined(TCPCONN) || defined(UNIXCONN) + #include +@@ -1479,14 +1480,16 @@ + /* + * Do the connect() + */ +- ++ HERE + if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0) + { ++ HERE + int olderrno = errno; + int connected = 0; + + if (!connected) + { ++ HERE + errno = olderrno; + + /* +@@ -1533,6 +1536,7 @@ + ciptr->peeraddrlen = namelen; + memcpy (ciptr->addr, &sockname, ciptr->addrlen); + memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); ++ HERE + + return 0; + } diff --git a/tinyx/patches/tinyxlib/optional/19-poll.patch b/tinyx/patches/tinyxlib/optional/19-poll.patch new file mode 100644 index 0000000..b363982 --- /dev/null +++ b/tinyx/patches/tinyxlib/optional/19-poll.patch @@ -0,0 +1,55 @@ +# Optional poll patch for timeout limiting. xserver-ico conn works fine without +# it. + +diff -ruN a/libtinyX11/XlibInt.c b/libtinyX11/XlibInt.c +--- a/libtinyX11/XlibInt.c 2024-07-25 15:04:02.404734830 +0200 ++++ b/libtinyX11/XlibInt.c 2024-07-29 14:44:00.085469285 +0200 +@@ -160,6 +160,21 @@ + static void _XProcessInternalConnection(); + #define SEQLIMIT (65535 - (BUFSIZE / SIZEOF(xReq)) - 10) + ++/* Limits poll timeout to 1s to enable signal reception */ ++static int phoenix_poll(struct pollfd *fds, nfds_t nfds, int timeout) ++{ ++ int err, msec; ++ ++ do { ++ msec = timeout >= 0 && timeout < 1000 ? timeout : 1000; ++ err = poll(fds, nfds, msec); ++ if (timeout > 0) ++ timeout -= msec; ++ } while (err == 0 && timeout != 0); ++ ++ return err; ++} ++ + /* + * The following routines are internal routines used by Xlib for protocol + * packet transmission and reception. +@@ -258,7 +273,7 @@ + do { + UnlockDisplay(dpy); + #ifdef USE_POLL +- nfound = poll (&filedes, 1, -1); ++ nfound = phoenix_poll (&filedes, 1, -1); + #else + nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); + #endif +@@ -473,7 +488,7 @@ + #endif + UnlockDisplay(dpy); + #ifdef USE_POLL +- result = poll(filedes, ++ result = phoenix_poll(filedes, + (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, + -1); + #else +@@ -767,7 +782,7 @@ + #ifdef USE_POLL + filedes.fd = dpy->fd; + filedes.events = POLLIN; +- if (pend = poll(&filedes, 1, 0)) ++ if (pend = phoenix_poll(&filedes, 1, 0)) + #else + FD_ZERO(&r_mask); + FD_SET(dpy->fd, &r_mask); diff --git a/tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch b/tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch new file mode 100644 index 0000000..5f3d255 --- /dev/null +++ b/tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch @@ -0,0 +1,14 @@ +diff -ruN a/include/X11/Xpoll.h b/include/X11/Xpoll.h +--- a/include/X11/Xpoll.h 2024-07-11 11:23:02.195783567 +0200 ++++ b/include/X11/Xpoll.h 2024-07-15 13:02:02.865217689 +0200 +@@ -60,6 +60,10 @@ + + #include + ++#ifdef __phoenix__ ++typedef uint32_t fd_mask; ++#endif ++ + #ifdef CSRG_BASED + #include + # if BSD < 199103 diff --git a/tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch b/tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch new file mode 100644 index 0000000..d353922 --- /dev/null +++ b/tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch @@ -0,0 +1,13 @@ +diff -ruN a/include/X11/Xos_r.h b/include/X11/Xos_r.h +--- a/include/X11/Xos_r.h 2024-07-11 11:23:02.195783567 +0200 ++++ b/include/X11/Xos_r.h 2024-07-12 09:03:48.026294638 +0200 +@@ -318,7 +318,7 @@ + (_Xos_processUnlock), \ + (p).pwp ) + +-#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) ++#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(__phoenix__) + # define X_NEEDS_PWPARAMS + typedef struct { + struct passwd pws; +