From b8cff9a116284a5ce227db40dfd2631d5843574b Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:03:24 +0200 Subject: [PATCH 01/14] tinyx: add build.sh skeleton, add tinyx to root build.sh JIRA: RTOS-826 --- build.sh | 1 + tinyx/build.sh | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100755 tinyx/build.sh diff --git a/build.sh b/build.sh index e3bd68c..b526aa8 100755 --- a/build.sh +++ b/build.sh @@ -60,6 +60,7 @@ ports=( "picocom" "fs_mark" "coremark" + "tinyx" ) diff --git a/tinyx/build.sh b/tinyx/build.sh new file mode 100755 index 0000000..d023727 --- /dev/null +++ b/tinyx/build.sh @@ -0,0 +1,96 @@ +#!/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 --enable-silent-rules + ) +} + + +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_reconfigure() { + 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 configure ${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 reconfiguring" + false + else + inner_log "Cleaning ${patch_subdir} up after previous patch set" + port_cleanup "${patch_subdir}" + + inner_log "Patch and reconfigure ${patch_subdir} from scratch" + true + fi + fi +} + + +mark_as_configured() { + 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}" +} + + +rm -rf "$TMP_DIR" From f7a31700d1578c6e96dafacf624eed18c2d74dd4 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:05:53 +0200 Subject: [PATCH 02/14] tinyx: add tinyx and its dependencies ports JIRA: RTOS-826, RTOS-861 --- tinyx/build.sh | 142 +++++++ .../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 ++++ ...03-libtinyX11-Imakefile-disable-i18n.patch | 61 +++ .../9862f3/04-include-X11-Xos_r.h.patch | 23 ++ .../9862f3/05-libxtrans-Xtransint.h.patch | 15 + .../9862f3/06-libxtrans-Xtranssock.c.patch | 11 + .../9862f3/07-libtinyX11-Makefile.patch | 25 ++ .../tinyxlib/9862f3/08-libXau-Makefile.patch | 24 ++ .../9862f3/09-libXdmcp-Makefile.patch | 27 ++ .../tinyxlib/9862f3/10-libXext-Makefile.patch | 24 ++ .../9862f3/11-include-X11-Xtrans.h.patch | 14 + .../patches/tinyxlib/9862f3/12-fix-conn.patch | 119 ++++++ .../2023.1/01-include-X11-Xpoll.h.patch | 14 + .../2023.1/02-include-X11-Xos_r.h.patch | 13 + 29 files changed, 1944 insertions(+) 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/03-libtinyX11-Imakefile-disable-i18n.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/07-libtinyX11-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/08-libXau-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/09-libXdmcp-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/10-libXext-Makefile.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/11-include-X11-Xtrans.h.patch create mode 100644 tinyx/patches/tinyxlib/9862f3/12-fix-conn.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 index d023727..1dae7a1 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -93,4 +93,146 @@ mark_as_configured() { } +_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}" + + # TODO move make outside of reconfigure block + if should_reconfigure "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_configured "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_reconfigure "${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 + + mark_as_configured "${libname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install +} + + +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_reconfigure "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 + mark_as_configured "tinyx/${short_ref}" + 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" /usr/bin +} + +# Build xlib and xserver (call ordering is important here) + +build_tinyxlib +build_a_lib libfontenc 1.1.8 +build_a_lib libXfont 1.5.4 --disable-freetype # libXfont depends on libfontenc and headers from xorgproto/tinyxlib + +build_tinyx + rm -rf "$TMP_DIR" 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/03-libtinyX11-Imakefile-disable-i18n.patch b/tinyx/patches/tinyxlib/9862f3/03-libtinyX11-Imakefile-disable-i18n.patch new file mode 100644 index 0000000..e71041d --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/03-libtinyX11-Imakefile-disable-i18n.patch @@ -0,0 +1,61 @@ +diff -ruN a/libtinyX11/Imakefile b/libtinyX11/Imakefile +--- a/libtinyX11/Imakefile 2024-10-07 10:28:11.915322364 +0200 ++++ b/libtinyX11/Imakefile 2024-10-07 13:07:15.859526298 +0200 +@@ -34,7 +34,7 @@ + #define IncSubdir X11 + + #if BuildLoadableXlibI18n +-SUBDIRS = xlibi18n ++# SUBDIRS = xlibi18n + #endif + + #include +@@ -47,7 +47,7 @@ + REQUIREDX11LIBS = SharedX11Reqs + #endif + #if BuildLoadableXlibI18n +-REQUIREDI18NLIBS = DlLibrary ++# REQUIREDI18NLIBS = DlLibrary + #endif + #ifdef cygwinArchitecture + EXCLUDE_SYMBOL = -Wl,--exclude-symbol,XdmcpWrap:_XdmcpWrapperToOddParity +@@ -151,7 +151,7 @@ + LINTLIBS = + + #if BuildLoadableXlibI18n && DoSharedLib +-EXTRASHAREDSRC = $(SHAREDLCSRCS) ++# EXTRASHAREDSRC = $(SHAREDLCSRCS) + #endif + #if !BuildLoadableXlibI18n || DoNormalLib + EXTRASTATICSRC = $(STATICLCSRCS) +@@ -833,7 +833,7 @@ + $(XKBOBJS) $(LCOBJS) $(MISCOBJS) + + #if BuildLoadableXlibI18n +-LC_DYNDEFINES = -DUSE_DYNAMIC_LC ++# LC_DYNDEFINES = -DUSE_DYNAMIC_LC + #endif + + SHAREDLCDEPSYMSRCS = XlcDL.c XlcSL.c +@@ -1000,7 +1000,7 @@ + EXTRAUNSHAREDOBJS = $(STATICLCOBJS) + + #if BuildLoadableXlibI18n +-EXTRASHAREDOBJS = $(SHAREDLCOBJS) ++# EXTRASHAREDOBJS = $(SHAREDLCOBJS) + # else + EXTRASHAREDOBJS = $(STATICLCOBJS) + #endif +@@ -1036,9 +1036,9 @@ + SpecialCLibObjectRule(k5encode,$(_NOOP_),$(K5INCL)) + #endif + #if BuildLoadableXlibI18n +-SpecialCLibObjectRuleSeparateOpts(lcInit,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) +-SpecialCLibObjectRuleSeparateOpts(lcGeneric,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) +-SpecialCLibObjectRuleSeparateOpts(lcPublic,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) ++# SpecialCLibObjectRuleSeparateOpts(lcInit,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) ++# SpecialCLibObjectRuleSeparateOpts(lcGeneric,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) ++# SpecialCLibObjectRuleSeparateOpts(lcPublic,$(ICONFIGFILES),$(_NOOP_),$(LC_DYNDEFINES)) + #endif + #if BuildLoadableXlibXcursor + SpecialCLibObjectRuleSeparateOpts(CrCursor,$(ICONFIGFILES),$(_NOOP_),$(XCURSOR_DEFINES)) 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/07-libtinyX11-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/07-libtinyX11-Makefile.patch new file mode 100644 index 0000000..42917ce --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/07-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/08-libXau-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/08-libXau-Makefile.patch new file mode 100644 index 0000000..22bd7ee --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/08-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/09-libXdmcp-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/09-libXdmcp-Makefile.patch new file mode 100644 index 0000000..7746b22 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/09-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/10-libXext-Makefile.patch b/tinyx/patches/tinyxlib/9862f3/10-libXext-Makefile.patch new file mode 100644 index 0000000..580a699 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/10-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/11-include-X11-Xtrans.h.patch b/tinyx/patches/tinyxlib/9862f3/11-include-X11-Xtrans.h.patch new file mode 100644 index 0000000..a9c2d76 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/11-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/12-fix-conn.patch b/tinyx/patches/tinyxlib/9862f3/12-fix-conn.patch new file mode 100644 index 0000000..f879f18 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/12-fix-conn.patch @@ -0,0 +1,119 @@ +# Non-zero poll/select timeouts introduced by this patch are crucial for lively +# client-server connection. +# +# This also uses recv(MSG_PEEK) that emulates ioctl/FIONREAD under Linux -- it +# returns the bytes available to read from the socket and doesn't depend +# on recv() ability to detect broken connections (thus XCONN_CHECK_FREQ patch is +# commented out).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,24 @@ + + #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 ++ * Maybe implement ioctl/FIONREAD in phoenix kernel? */ ++#define BUFSIZE 64 ++static char buf[BUFSIZE]; ++ int k = recv(ciptr->fd, buf, BUFSIZE, MSG_PEEK | MSG_DONTWAIT); ++ if (k < 0) { ++ if (errno == EWOULDBLOCK || errno == EAGAIN) ++ k = 0; ++ else ++ return -1; ++ } ++ *pend = k; ++ 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_ */ +--- 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 + +--- a/libtinyX11/XlibInt.c 2024-10-07 10:28:11.925322598 +0200 ++++ b/libtinyX11/XlibInt.c 2024-10-07 10:31:25.856657685 +0200 +@@ -256,7 +256,7 @@ + do { + UnlockDisplay(dpy); + #ifdef USE_POLL +- nfound = poll (&filedes, 1, -1); ++ nfound = poll (&filedes, 1, 10); + #else + nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); + #endif +@@ -473,7 +473,7 @@ + #ifdef USE_POLL + result = poll(filedes, + (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, +- -1); ++ 1); + #else + result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); + #endif +@@ -756,7 +756,7 @@ + #ifdef USE_POLL + filedes.fd = dpy->fd; + filedes.events = POLLIN; +- if (pend = poll(&filedes, 1, 0)) ++ if (pend = poll(&filedes, 1, 10)) + #else + FD_ZERO(&r_mask); + FD_SET(dpy->fd, &r_mask); +--- a/libXt/NextEvent.c 2024-10-07 13:41:24.958653758 +0200 ++++ b/libXt/NextEvent.c 2024-10-07 14:14:25.247737774 +0200 +@@ -336,7 +336,7 @@ + return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask, + wt->wait_time_ptr); + #else +- return poll (wf->fdlist, wf->fdlistlen, wt->poll_wait); ++ return poll (wf->fdlist, wf->fdlistlen, 100); + #endif + } + 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; + From 4d2baf76977a1ff237c0b74b4fd176c3fd46a697 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:08:23 +0200 Subject: [PATCH 03/14] tinyx: add ico port 02-keysym.patch adds key event printing for keyboard testing (a poor man's xev) JIRA: RTOS-826, RTOS-863 --- tinyx/build.sh | 42 +++++++++++++++++++++++++ tinyx/patches/ico/1.0.4/01-ico.c.patch | 31 ++++++++++++++++++ tinyx/patches/ico/1.0.4/02-keysym.patch | 11 +++++++ 3 files changed, 84 insertions(+) create mode 100644 tinyx/patches/ico/1.0.4/01-ico.c.patch create mode 100644 tinyx/patches/ico/1.0.4/02-keysym.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 1dae7a1..20461f7 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -227,6 +227,44 @@ build_tinyx() { b_install "${PREFIX_PORTS_INSTALL}/Xfbdev" /usr/bin } + +build_x11_app() { + appname="$1" + version="$2" + configure_opts=${@:3} + + b_log "tinyx: building ${appname}" + + archive_filename="${appname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}" + + if should_reconfigure "${appname}/${version}"; then + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure ${configure_opts} + fi + + mark_as_configured "${appname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" + + binpath="${PREFIX_PORT_SRC}/${appname}" + if [ ! -f "${binpath}" ]; then + binpath="${PREFIX_PORT_SRC}/src/${appname}" + fi + $STRIP -o "${PREFIX_PROG_STRIPPED}/${appname}" "${binpath}" + + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + # Build xlib and xserver (call ordering is important here) build_tinyxlib @@ -235,4 +273,8 @@ build_a_lib libXfont 1.5.4 --disable-freetype # libXfont depends on libfo build_tinyx +# Build client apps + +build_x11_app ico 1.0.4 # requires gettext + 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/ico/1.0.4/02-keysym.patch b/tinyx/patches/ico/1.0.4/02-keysym.patch new file mode 100644 index 0000000..0d3f51f --- /dev/null +++ b/tinyx/patches/ico/1.0.4/02-keysym.patch @@ -0,0 +1,11 @@ +diff -ruN a/ico.c b/ico.c +--- a/ico.c 2024-08-05 09:04:38.644732743 +0200 ++++ b/ico.c 2024-08-06 13:48:40.156026945 +0200 +@@ -1061,6 +1061,7 @@ + #endif + XLookupString(&xev.xkey, buf, 10, &ksym, NULL); + do_it = ((ksym != XK_Q) && ksym != XK_q); ++ printf("keycode %u (keysym 0x%lx, %s)\n", xev.xkey.keycode, ksym, XKeysymToString(ksym)); + break; + case MapNotify: + blocking = False; From 264162b789e9c192b2b84241cccdd8ef473ede49 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:11:53 +0200 Subject: [PATCH 04/14] tinyx: patch input methods in xserver These patches require /dev/kbd and /dev/mouse PS/2 vdevs to be available JIRA: RTOS-826, RTOS-864 --- tinyx/patches/tinyx/eed490/08-mouse.patch | 91 +++++++++ tinyx/patches/tinyx/eed490/09-keyboard.patch | 187 +++++++++++++++++++ 2 files changed, 278 insertions(+) create mode 100644 tinyx/patches/tinyx/eed490/08-mouse.patch create mode 100644 tinyx/patches/tinyx/eed490/09-keyboard.patch diff --git a/tinyx/patches/tinyx/eed490/08-mouse.patch b/tinyx/patches/tinyx/eed490/08-mouse.patch new file mode 100644 index 0000000..993138d --- /dev/null +++ b/tinyx/patches/tinyx/eed490/08-mouse.patch @@ -0,0 +1,91 @@ +diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c +--- a/kdrive/fbdev/fbdev.c 2024-08-05 09:04:38.652732766 +0200 ++++ b/kdrive/fbdev/fbdev.c 2024-08-08 12:33:09.385160526 +0200 +@@ -374,7 +374,7 @@ + + scrpriv->shadow = FALSE; + +- KdComputeMouseMatrix(&m, scrpriv->randr, screen->width, screen->height); ++ KdComputeMouseMatrix(&m, RR_Rotate_0, screen->width, screen->height); + + KdSetMouseMatrix(&m); + +--- a/kdrive/phoenix/mouse.c 2024-08-05 09:04:38.653732769 +0200 ++++ b/kdrive/phoenix/mouse.c 2024-08-07 16:30:38.814841906 +0200 +@@ -25,6 +25,7 @@ + #include + #endif + #include ++#include + #include + #include + #include +@@ -45,6 +46,14 @@ + int used; + } Kbufio; + ++typedef struct _mr_args_t { ++ int fd; ++ void *closure; ++} mouse_reader_args_t; ++ ++mouse_reader_args_t mr_args; ++pthread_t mouse_thread; ++ + static Bool MouseWaitForReadable(int fd, int timeout) + { + fd_set set; +@@ -863,15 +872,17 @@ + } + } + ++static void* mouse_reader(void * arg) { ++ mouse_reader_args_t *mr_args = (mouse_reader_args_t *) arg; ++ while (1) { ++ MouseRead(mr_args->fd, mr_args->closure); ++ } ++} ++ + static int MouseInputType; + + const char * const kdefaultMouse[] = { + "/dev/mouse", +- "/dev/psaux", +- "/dev/input/mice", +- "/dev/adbmouse", +- "/dev/ttyS0", +- "/dev/ttyS1", + }; + + #define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0])) +@@ -893,14 +904,14 @@ + continue; + if (!mi->name) { + for (i = 0; i < NUM_DEFAULT_MOUSE; i++) { +- fd = open(kdefaultMouse[i], 2); ++ fd = open(kdefaultMouse[i], O_RDWR); + if (fd >= 0) { + mi->name = strdup(kdefaultMouse[i]); + break; + } + } + } else +- fd = open(mi->name, 2); ++ fd = open(mi->name, O_RDWR); + + if (fd >= 0) { + km = malloc(sizeof(Kmouse)); +@@ -913,9 +924,10 @@ + mi->driver = km; + mi->inputType = MouseInputType; + MouseFirstProtocol(km, mi->prot); +- if (KdRegisterFd +- (MouseInputType, fd, MouseRead, (void *)mi)) +- n++; ++ mr_args.fd = fd; ++ mr_args.closure = (void *)mi; ++ if (pthread_create(&mouse_thread, NULL, mouse_reader, &mr_args) == 0) ++ n++; + } else + close(fd); + } diff --git a/tinyx/patches/tinyx/eed490/09-keyboard.patch b/tinyx/patches/tinyx/eed490/09-keyboard.patch new file mode 100644 index 0000000..a46fe86 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/09-keyboard.patch @@ -0,0 +1,187 @@ +diff -ruN a/kdrive/phoenix/keyboard.c b/kdrive/phoenix/keyboard.c +--- a/kdrive/phoenix/keyboard.c 2024-08-05 09:04:38.653732769 +0200 ++++ b/kdrive/phoenix/keyboard.c 2024-08-06 13:59:18.567821129 +0200 +@@ -5,14 +5,183 @@ + #include "kkeymap.h" + #define XK_PUBLISHING + #include ++#include + #include ++#include ++ ++static int PhoenixKbdFd; ++ ++static const KeySym phoenix_to_x[128] = { ++/* 0 unused */ NoSymbol, ++/* 1 ESCape */ XK_Escape, ++/* 2 1 */ XK_1, ++/* 3 2 */ XK_2, ++/* 4 3 */ XK_3, ++/* 5 4 */ XK_4, ++/* 6 5 */ XK_5, ++/* 7 6 */ XK_6, ++/* 8 7 */ XK_7, ++/* 9 8 */ XK_8, ++/* 10 9 */ XK_9, ++/* 11 0 */ XK_0, ++/* 12 - */ XK_minus, ++/* 13 = */ XK_equal, ++/* 14 backspace */ XK_BackSpace, ++/* 15 tab */ XK_Tab, ++/* 16 q */ XK_q, ++/* 17 w */ XK_w, ++/* 18 e */ XK_e, ++/* 19 r */ XK_r, ++/* 20 t */ XK_t, ++/* 21 y */ XK_y, ++/* 22 u */ XK_u, ++/* 23 i */ XK_i, ++/* 24 o */ XK_o, ++/* 25 p */ XK_p, ++/* 26 [ */ XK_bracketleft, ++/* 27 ] */ XK_bracketright, ++/* 28 return */ XK_Return, ++/* 29 control */ XK_Control_L, ++/* 30 a */ XK_a, ++/* 31 s */ XK_s, ++/* 32 d */ XK_d, ++/* 33 f */ XK_f, ++/* 34 g */ XK_g, ++/* 35 h */ XK_h, ++/* 36 j */ XK_j, ++/* 37 k */ XK_k, ++/* 38 l */ XK_l, ++/* 39 ; */ XK_semicolon, ++/* 40 ' */ XK_apostrophe, ++/* 41 ` */ XK_grave, ++/* 42 shift */ XK_Shift_R, ++/* 43 \ */ XK_backslash, ++/* 44 z */ XK_z, ++/* 45 x */ XK_x, ++/* 46 c */ XK_c, ++/* 47 v */ XK_v, ++/* 48 b */ XK_b, ++/* 49 n */ XK_n, ++/* 50 m */ XK_m, ++/* 51 , */ XK_comma, ++/* 52 . */ XK_period, ++/* 53 / */ XK_slash, ++/* 54 shift */ XK_Shift_L, ++/* 55 kp * */ NoSymbol, // TODO ????? ++/* 56 alt */ XK_Alt_L, ++/* 57 space */ XK_space, ++/* 58 caps */ XK_Caps_Lock, ++/* 59 f1 */ XK_F1, ++/* 60 f2 */ XK_F2, ++/* 61 f3 */ XK_F3, ++/* 62 f4 */ XK_F4, ++/* 63 f5 */ XK_F5, ++/* 64 f6 */ XK_F6, ++/* 65 f7 */ XK_F7, ++/* 66 f8 */ XK_F8, ++/* 67 f9 */ XK_F9, ++/* 68 f10 */ XK_F10, ++/* 69 num lock */ XK_Num_Lock, ++/* 70 scroll lock*/ XK_Scroll_Lock, ++/* 71 kp 7 */ NoSymbol, ++/* 72 kp 8 */ NoSymbol, ++/* 73 kp 9 */ NoSymbol, ++/* 74 kp - */ NoSymbol, ++/* 75 kp 4 */ NoSymbol, ++/* 76 kp 5 */ NoSymbol, ++/* 77 kp 6 */ NoSymbol, ++/* 78 kp + */ NoSymbol, ++/* 79 kp 1 */ NoSymbol, ++/* 80 kp 2 */ NoSymbol, ++/* 81 kp 3 */ NoSymbol, ++/* 82 kp 0 */ NoSymbol, ++/* 83 kp . */ NoSymbol, ++/* 84 0 */ NoSymbol, ++/* 85 0 */ NoSymbol, ++/* 86 0 */ NoSymbol, ++/* 87 f11 */ XK_F11, ++/* 88 f12 */ XK_F12, ++/* 89 0 */ NoSymbol, ++/* 90 0 */ NoSymbol, ++/* 91 0 */ NoSymbol, ++/* 92 0 */ NoSymbol, ++/* 93 0 */ NoSymbol, ++/* 94 0 */ NoSymbol, ++/* 95 0 */ NoSymbol, ++/* 96 extended */ NoSymbol, ++/* 97 0 */ NoSymbol, ++/* 98 0 */ NoSymbol, ++/* 99 0 */ NoSymbol, ++/* 100 */ NoSymbol, ++/* 101 */ NoSymbol, ++/* 102 */ NoSymbol, ++/* 103 */ NoSymbol, ++/* 104 */ NoSymbol, ++/* 105 */ NoSymbol, ++/* 106 */ NoSymbol, ++/* 107 */ NoSymbol, ++/* 108 */ NoSymbol, ++/* 109 */ NoSymbol, ++/* 110 */ NoSymbol, ++/* 111 */ NoSymbol, ++/* 112 */ NoSymbol, ++/* 113 */ NoSymbol, ++/* 114 */ NoSymbol, ++/* 115 */ NoSymbol, ++/* 116 */ NoSymbol, ++/* 117 */ NoSymbol, ++/* 118 */ NoSymbol, ++/* 119 */ NoSymbol, ++/* 120 */ NoSymbol, ++/* 121 */ NoSymbol, ++/* 122 */ NoSymbol, ++/* 123 */ NoSymbol, ++/* 124 */ NoSymbol, ++/* 125 */ NoSymbol, ++/* 126 */ NoSymbol, ++/* 127 */ NoSymbol ++}; ++ ++ ++static void* event_watcher(void* arg) { ++ printf("hello\n"); ++ int fd = *((int*) arg); ++ unsigned char c; ++ ++ while (1) { ++ if (read(fd, &c, 1) > 0) { ++ KdEnqueueKeyboardEvent(c & 0x7f, c & 0x80); ++ } ++ usleep(200); ++ } ++} ++ ++#define NR_KEYS 101 + + static void PhoenixKeyboardLoad(void) + { ++ kdMinScanCode = 0; ++ kdMaxScanCode = 127; ++ ++ KeySym *k; ++ int i; ++ int row; ++ ++ row = 0; ++ for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i) { ++ k = kdKeymap + row * KD_MAX_WIDTH; ++ k[0] = phoenix_to_x[i]; ++ row++; ++ } + } + + static int PhoenixKeyboardInit(void) + { ++ PhoenixKbdFd = open("/dev/kbd", O_RDONLY); ++ ++ pthread_t thread; ++ ++ pthread_create(&thread, NULL, event_watcher, &PhoenixKbdFd); + } + + static void PhoenixKeyboardFini(void) From b9417f52b90ced59d774180ad01772ed67f653e3 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:18:53 +0200 Subject: [PATCH 05/14] tinyx: add dwm port JIRA: RTOS-826, RTOS-865 --- tinyx/build.sh | 27 +++++++++++++++++ tinyx/patches/dwm/5.1/01-Makefile.patch | 39 +++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tinyx/patches/dwm/5.1/01-Makefile.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 20461f7..353b77c 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -265,6 +265,29 @@ build_x11_app() { } +build_suckless() { + appname="$1" + version="$2" + + b_log "tinyx: building ${appname}" + + archive_filename="${appname}-${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + b_port_download "https://dl.suckless.org/${appname}/" "${archive_filename}" + + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" + + $STRIP -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/${appname}" + + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + # Build xlib and xserver (call ordering is important here) build_tinyxlib @@ -273,6 +296,10 @@ build_a_lib libXfont 1.5.4 --disable-freetype # libXfont depends on libfo build_tinyx +# Build window managers + +build_suckless dwm 5.1 + # Build client apps build_x11_app ico 1.0.4 # requires gettext diff --git a/tinyx/patches/dwm/5.1/01-Makefile.patch b/tinyx/patches/dwm/5.1/01-Makefile.patch new file mode 100644 index 0000000..b9cb8c0 --- /dev/null +++ b/tinyx/patches/dwm/5.1/01-Makefile.patch @@ -0,0 +1,39 @@ +diff -ruN a/config.mk b/config.mk +--- a/config.mk 2024-08-09 12:42:00.109791945 +0200 ++++ b/config.mk 2024-08-09 12:41:44.723456850 +0200 +@@ -4,28 +4,21 @@ + # Customize below to fit your system + + # paths +-PREFIX = /usr/local ++PREFIX ?= /usr/local + MANPREFIX = ${PREFIX}/share/man + +-X11INC = /usr/X11R6/include +-X11LIB = /usr/X11R6/lib +- +-# Xinerama, comment if you don't want it +-XINERAMALIBS = -L${X11LIB} -lXinerama +-XINERAMAFLAGS = -DXINERAMA +- + # includes and libs +-INCS = -I. -I/usr/include -I${X11INC} +-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS} ++INCS = -I. -I${PREFIX_H} ++LIBS = -L${PREFIX_A} -l:libX11.a -l:libphoenix.a + + # flags +-CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} +-LDFLAGS = -s ${LIBS} ++CPPFLAGS += -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ++CFLAGS += -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} ++LDFLAGS += -s ${LIBS} + + # Solaris + #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" + #LDFLAGS = ${LIBS} + + # compiler and linker +-CC = cc ++CC ?= cc From 8fedccfeac82d924adeada62092709eb02b51f9d Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 2 Sep 2024 10:56:15 +0200 Subject: [PATCH 06/14] tinyx: generalize xserver fbdev, fix keyboard mapping in xserver JIRA: RTOS-826, RTOS-861 --- tinyx/patches/tinyx/eed490/10-vga.patch | 78 ++++++ .../tinyx/eed490/11-keyboard-ctd.patch | 248 ++++++++++++++++++ 2 files changed, 326 insertions(+) create mode 100644 tinyx/patches/tinyx/eed490/10-vga.patch create mode 100644 tinyx/patches/tinyx/eed490/11-keyboard-ctd.patch diff --git a/tinyx/patches/tinyx/eed490/10-vga.patch b/tinyx/patches/tinyx/eed490/10-vga.patch new file mode 100644 index 0000000..5ad408b --- /dev/null +++ b/tinyx/patches/tinyx/eed490/10-vga.patch @@ -0,0 +1,78 @@ +diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c +--- a/kdrive/fbdev/fbdev.c 2024-08-21 13:07:32.038968445 +0200 ++++ b/kdrive/fbdev/fbdev.c 2024-08-21 12:26:44.467523732 +0200 +@@ -28,6 +28,15 @@ + #include + + #include ++#include ++ ++void refresher(void *arg) { ++ graph_t* g = (graph_t*) arg; ++ while (1) { ++ usleep(12588); // ~70Hz ++ graph_commit(g); ++ } ++} + + extern int KdTsPhyScreen; + +@@ -80,7 +89,6 @@ + + int k; + +- priv->bits_per_pixel = 32; + priv->smem_len = 0x2000; + + if ((k = graph_init()) < 0) { +@@ -92,15 +100,16 @@ + FatalError("failed to initialize graphics adapter: %s", strerror(k)); + } + +- if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_DEFFREQ)) < 0) { ++ if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_70Hz)) < 0) { + FatalError("failed to set graphics mode: %d", k); + } + +- if (priv->g.depth != 4) { +- FatalError(stderr, "32-bit video resolution required"); +- } ++ pthread_t thread; ++ ++ pthread_create(&thread, NULL, (void*) refresher, &priv->g); + + priv->fb = priv->g.data; ++ priv->bits_per_pixel = priv->g.depth * 8; + + priv->g.height = priv->g.height; + priv->g.width = priv->g.width; +@@ -316,22 +325,22 @@ + FbdevPriv *priv = screen->card->driver; + int depth = priv->bits_per_pixel; + +- screen->width = 640; +- screen->height = 400; ++ screen->width = priv->g.width; ++ screen->height = priv->g.height; + 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); ++ int offset = depth / 4; ++ screen->fb.redMask = Mask(offset * 2, offset); ++ screen->fb.greenMask = Mask(offset * 1, offset); ++ screen->fb.blueMask = Mask(0,offset); + screen->fb.bitsPerPixel = priv->bits_per_pixel; + + return fbdevMapFramebuffer(screen); diff --git a/tinyx/patches/tinyx/eed490/11-keyboard-ctd.patch b/tinyx/patches/tinyx/eed490/11-keyboard-ctd.patch new file mode 100644 index 0000000..f593c70 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/11-keyboard-ctd.patch @@ -0,0 +1,248 @@ +diff -u b/kdrive/phoenix/keyboard.c b/kdrive/phoenix/keyboard.c +--- b/kdrive/phoenix/keyboard.c 2024-08-28 18:27:18.002303324 +0200 ++++ b/kdrive/phoenix/keyboard.c 2024-09-02 10:32:16.393897703 +0200 +@@ -11,7 +11,8 @@ + + static int PhoenixKbdFd; + +-static const KeySym phoenix_to_x[128] = { ++static const KeySym phoenix_to_x[256] = { ++/* -- Normal -- */ + /* 0 unused */ NoSymbol, + /* 1 ESCape */ XK_Escape, + /* 2 1 */ XK_1, +@@ -54,7 +55,7 @@ + /* 39 ; */ XK_semicolon, + /* 40 ' */ XK_apostrophe, + /* 41 ` */ XK_grave, +-/* 42 shift */ XK_Shift_R, ++/* 42 shift */ XK_Shift_L, + /* 43 \ */ XK_backslash, + /* 44 z */ XK_z, + /* 45 x */ XK_x, +@@ -66,7 +67,7 @@ + /* 51 , */ XK_comma, + /* 52 . */ XK_period, + /* 53 / */ XK_slash, +-/* 54 shift */ XK_Shift_L, ++/* 54 shift */ XK_Shift_R, + /* 55 kp * */ NoSymbol, // TODO ????? + /* 56 alt */ XK_Alt_L, + /* 57 space */ XK_space, +@@ -103,8 +104,137 @@ + /* 88 f12 */ XK_F12, + /* 89 0 */ NoSymbol, + /* 90 0 */ NoSymbol, +-/* 91 0 */ NoSymbol, +-/* 92 0 */ NoSymbol, ++/* 91 0 */ XK_Super_L, ++/* 92 0 */ XK_Super_R, ++/* 93 0 */ NoSymbol, ++/* 94 0 */ NoSymbol, ++/* 95 0 */ NoSymbol, ++/* 96 extended */ NoSymbol, ++/* 97 0 */ NoSymbol, ++/* 98 0 */ NoSymbol, ++/* 99 0 */ NoSymbol, ++/* 100 */ NoSymbol, ++/* 101 */ NoSymbol, ++/* 102 */ NoSymbol, ++/* 103 */ XK_Up, ++/* 104 */ NoSymbol, ++/* 105 */ XK_Left, ++/* 106 */ XK_Right, ++/* 107 */ NoSymbol, ++/* 108 */ XK_Down, ++/* 109 */ NoSymbol, ++/* 110 */ NoSymbol, ++/* 111 */ NoSymbol, ++/* 112 */ NoSymbol, ++/* 113 */ NoSymbol, ++/* 114 */ NoSymbol, ++/* 115 */ NoSymbol, ++/* 116 */ NoSymbol, ++/* 117 */ NoSymbol, ++/* 118 */ NoSymbol, ++/* 119 */ NoSymbol, ++/* 120 */ NoSymbol, ++/* 121 */ NoSymbol, ++/* 122 */ NoSymbol, ++/* 123 */ NoSymbol, ++/* 124 */ NoSymbol, ++/* 125 */ NoSymbol, ++/* 126 */ NoSymbol, ++/* 127 */ NoSymbol, ++/* -- ShiftMask -- */ ++/* 0 unused */ NoSymbol, ++/* 1 ESCape */ XK_Escape, ++/* 2 1 */ XK_exclam, ++/* 3 2 */ XK_at, ++/* 4 3 */ XK_numbersign, ++/* 5 4 */ XK_dollar, ++/* 6 5 */ XK_percent, ++/* 7 6 */ XK_asciicircum, ++/* 8 7 */ XK_ampersand, ++/* 9 8 */ XK_asterisk, ++/* 10 9 */ XK_parenleft, ++/* 11 0 */ XK_parenright, ++/* 12 - */ XK_underscore, ++/* 13 = */ XK_plus, ++/* 14 backspace */ XK_BackSpace, ++/* 15 tab */ XK_ISO_Left_Tab, ++/* 16 q */ XK_Q, ++/* 17 w */ XK_W, ++/* 18 e */ XK_E, ++/* 19 r */ XK_R, ++/* 20 t */ XK_T, ++/* 21 y */ XK_Y, ++/* 22 u */ XK_U, ++/* 23 i */ XK_I, ++/* 24 o */ XK_O, ++/* 25 p */ XK_P, ++/* 26 [ */ XK_braceleft, ++/* 27 ] */ XK_braceright, ++/* 28 return */ XK_Return, ++/* 29 control */ XK_Control_L, ++/* 30 a */ XK_A, ++/* 31 s */ XK_S, ++/* 32 d */ XK_D, ++/* 33 f */ XK_F, ++/* 34 g */ XK_G, ++/* 35 h */ XK_H, ++/* 36 j */ XK_J, ++/* 37 k */ XK_K, ++/* 38 l */ XK_L, ++/* 39 ; */ XK_colon, ++/* 40 ' */ XK_quotedbl, ++/* 41 ` */ XK_asciitilde, ++/* 42 shift */ XK_Shift_L, ++/* 43 \ */ XK_bar, ++/* 44 z */ XK_Z, ++/* 45 x */ XK_X, ++/* 46 c */ XK_C, ++/* 47 v */ XK_V, ++/* 48 b */ XK_B, ++/* 49 n */ XK_N, ++/* 50 m */ XK_M, ++/* 51 , */ XK_less, ++/* 52 . */ XK_greater, ++/* 53 / */ XK_question, ++/* 54 shift */ XK_Shift_R, ++/* 55 kp * */ NoSymbol, // TODO ????? ++/* 56 alt */ XK_Alt_L, ++/* 57 space */ XK_space, ++/* 58 caps */ XK_Caps_Lock, ++/* 59 f1 */ XK_F1, ++/* 60 f2 */ XK_F2, ++/* 61 f3 */ XK_F3, ++/* 62 f4 */ XK_F4, ++/* 63 f5 */ XK_F5, ++/* 64 f6 */ XK_F6, ++/* 65 f7 */ XK_F7, ++/* 66 f8 */ XK_F8, ++/* 67 f9 */ XK_F9, ++/* 68 f10 */ XK_F10, ++/* 69 num lock */ XK_Num_Lock, ++/* 70 scroll lock*/ XK_Scroll_Lock, ++/* 71 kp 7 */ NoSymbol, ++/* 72 kp 8 */ NoSymbol, ++/* 73 kp 9 */ NoSymbol, ++/* 74 kp - */ NoSymbol, ++/* 75 kp 4 */ NoSymbol, ++/* 76 kp 5 */ NoSymbol, ++/* 77 kp 6 */ NoSymbol, ++/* 78 kp + */ NoSymbol, ++/* 79 kp 1 */ NoSymbol, ++/* 80 kp 2 */ NoSymbol, ++/* 81 kp 3 */ NoSymbol, ++/* 82 kp 0 */ NoSymbol, ++/* 83 kp . */ NoSymbol, ++/* 84 0 */ NoSymbol, ++/* 85 0 */ NoSymbol, ++/* 86 0 */ NoSymbol, ++/* 87 f11 */ XK_F11, ++/* 88 f12 */ XK_F12, ++/* 89 0 */ NoSymbol, ++/* 90 0 */ NoSymbol, ++/* 91 0 */ XK_Super_L, ++/* 92 0 */ XK_Super_R, + /* 93 0 */ NoSymbol, + /* 94 0 */ NoSymbol, + /* 95 0 */ NoSymbol, +@@ -139,25 +269,28 @@ + /* 124 */ NoSymbol, + /* 125 */ NoSymbol, + /* 126 */ NoSymbol, +-/* 127 */ NoSymbol ++/* 127 */ NoSymbol, + }; + + + static void* event_watcher(void* arg) { + printf("hello\n"); + int fd = *((int*) arg); +- unsigned char c; ++ ++ unsigned char buf[256], *b; ++ int n; + + while (1) { +- if (read(fd, &c, 1) > 0) { +- KdEnqueueKeyboardEvent(c & 0x7f, c & 0x80); ++ while ((n = read(fd, buf, sizeof(buf))) > 0) { ++ b = buf; ++ while (n--) { ++ KdEnqueueKeyboardEvent(b[0] & 0x7f, b[0] & 0x80); ++ b++; ++ } + } +- usleep(200); + } + } + +-#define NR_KEYS 101 +- + static void PhoenixKeyboardLoad(void) + { + kdMinScanCode = 0; +@@ -165,13 +298,10 @@ + + KeySym *k; + int i; +- int row; +- +- row = 0; +- for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i) { +- k = kdKeymap + row * KD_MAX_WIDTH; ++ for (i = 0; i < kdMaxScanCode; ++i) { ++ k = kdKeymap + i * KD_MAX_WIDTH; + k[0] = phoenix_to_x[i]; +- row++; ++ k[1] = phoenix_to_x[i+128]; + } + } + +unchanged: +--- a/kdrive/phoenix/phoenix.c 2024-08-19 10:04:19.200262718 +0200 ++++ b/kdrive/phoenix/phoenix.c 2024-08-29 12:03:47.660542800 +0200 +@@ -8,6 +8,10 @@ + #include + #include + ++static void signalHandler(int signo) ++{ ++} ++ + static int PhoenixInit(void) + { + return 1; +@@ -15,6 +19,9 @@ + + static void PhoenixEnable(void) + { ++ signal(SIGINT, signalHandler); ++ signal(SIGQUIT, signalHandler); ++ signal(SIGTERM, signalHandler); + } + + static Bool PhoenixSpecialKey(KeySym sym) From f6d8d0a9edca59a324464ca2f7e5097d881f155f Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:20:03 +0200 Subject: [PATCH 07/14] tinyx: add st port JIRA: RTOS-826, RTOS-889 --- tinyx/build.sh | 1 + tinyx/patches/st/0.2/01-st.patch | 180 ++++++++++++++++++ .../st/0.2/02-colormap-and-cursor.patch | 145 ++++++++++++++ tinyx/patches/st/0.2/03-resize.patch | 43 +++++ .../st/0.2/04-handle-wmdeletewin.patch | 59 ++++++ 5 files changed, 428 insertions(+) create mode 100644 tinyx/patches/st/0.2/01-st.patch create mode 100644 tinyx/patches/st/0.2/02-colormap-and-cursor.patch create mode 100644 tinyx/patches/st/0.2/03-resize.patch create mode 100644 tinyx/patches/st/0.2/04-handle-wmdeletewin.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 353b77c..90134f5 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -303,5 +303,6 @@ build_suckless dwm 5.1 # Build client apps build_x11_app ico 1.0.4 # requires gettext +build_suckless st 0.2 rm -rf "$TMP_DIR" diff --git a/tinyx/patches/st/0.2/01-st.patch b/tinyx/patches/st/0.2/01-st.patch new file mode 100644 index 0000000..ac93ca0 --- /dev/null +++ b/tinyx/patches/st/0.2/01-st.patch @@ -0,0 +1,180 @@ +diff -ruN a/config.def.h b/config.def.h +--- a/config.def.h 2024-08-27 09:42:15.347070749 +0200 ++++ b/config.def.h 2024-08-27 16:24:55.225065320 +0200 +@@ -1,7 +1,7 @@ + #define TAB 8 + #define TNAME "st-256color" +-#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*" +-#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*" ++#define FONT "fixed" ++#define BOLDFONT "fixed" + #define BORDER 2 + #define SHELL "/bin/sh" + +@@ -27,7 +27,7 @@ + + /* Default colors (colorname index) + foreground, background, cursor */ +-#define DefaultFG 7 ++#define DefaultFG 15 + #define DefaultBG 0 + #define DefaultCS 1 + +diff -ruN a/config.mk b/config.mk +--- a/config.mk 2024-08-27 09:42:15.347070749 +0200 ++++ b/config.mk 2024-08-27 09:37:08.443804778 +0200 +@@ -1,18 +1,15 @@ + # st version +-VERSION = 0.1.1 ++VERSION = 0.2 + + # Customize below to fit your system + + # paths +-PREFIX = /usr/local ++PREFIX ?= /usr/local + MANPREFIX = ${PREFIX}/share/man + +-X11INC = /usr/X11R6/include +-X11LIB = /usr/X11R6/lib +- + # includes and libs +-INCS = -I. -I/usr/include -I${X11INC} +-LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil ++INCS = -I. -I${PREFIX_H} ++LIBS = -L${PREFIX_A} -l:libX11.a -l:libphoenix.a + + # flags + CPPFLAGS = -DVERSION=\"${VERSION}\" +diff -ruN a/st.c b/st.c +--- a/st.c 2024-08-27 09:42:15.347070749 +0200 ++++ b/st.c 2024-08-27 16:29:06.650500521 +0200 +@@ -684,11 +684,20 @@ + void + ttynew(void) { + int m, s; +- +- /* seems to work fine on linux, openbsd and freebsd */ +- struct winsize w = {term.row, term.col, 0, 0}; +- if(openpty(&m, &s, NULL, NULL, &w) < 0) +- die("openpty failed: %s\n", SERRNO); ++ ++ m = open("/dev/ptmx", O_RDWR | O_NOCTTY); ++ ++ if (m < 0 || grantpt(m) < 0 || unlockpt(m) < 0) { ++ die("ptm went brr\n"); ++ } ++ ++ char *ptsn = ptsname(m); ++ if (ptsn == NULL) ++ die("ptsn\n"); ++ ++ s = open(ptsn, O_RDWR | O_NOCTTY); ++ if (s < 0) ++ die("pts\n"); + + switch(pid = fork()) { + case -1: +@@ -699,8 +708,6 @@ + dup2(s, STDIN_FILENO); + dup2(s, STDOUT_FILENO); + dup2(s, STDERR_FILENO); +- if(ioctl(s, TIOCSCTTY, NULL) < 0) +- die("ioctl TIOCSCTTY failed: %s\n", SERRNO); + close(s); + close(m); + execsh(); +@@ -757,6 +764,7 @@ + + void + ttyresize(int x, int y) { ++#if 0 + struct winsize w; + + w.ws_row = term.row; +@@ -764,6 +772,7 @@ + w.ws_xpixel = w.ws_ypixel = 0; + if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0) + fprintf(stderr, "Couldn't set window size: %s\n", SERRNO); ++#endif + } + + void +@@ -1680,13 +1689,23 @@ + } + + void ++phoenix_xgetfontinfo(int *ascent, int *descent, short *lbearing, short *rbearing) { ++ XFontStruct *xfonts; ++ ++ xfonts = XLoadQueryFont(xw.dpy, "fixed"); ++ if (!xfonts) ++ die("fixed failed"); ++ *ascent = MAX(*ascent, xfonts->ascent); ++ *descent = MAX(*descent, xfonts->descent); ++ *lbearing = MAX(*lbearing, xfonts->min_bounds.lbearing); ++ *rbearing = MAX(*rbearing, xfonts->max_bounds.rbearing); ++} ++ ++void + initfonts(char *fontstr, char *bfontstr) { +- if((dc.font.set = xinitfont(fontstr)) == NULL || +- (dc.bfont.set = xinitfont(bfontstr)) == NULL) +- die("Can't load font %s\n", dc.font.set ? BOLDFONT : FONT); +- xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent, ++ phoenix_xgetfontinfo(&dc.font.ascent, &dc.font.descent, + &dc.font.lbearing, &dc.font.rbearing); +- xgetfontinfo(dc.bfont.set, &dc.bfont.ascent, &dc.bfont.descent, ++ phoenix_xgetfontinfo(&dc.bfont.ascent, &dc.bfont.descent, + &dc.bfont.lbearing, &dc.bfont.rbearing); + } + +@@ -1736,11 +1755,13 @@ + xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dpy, xw.scr)); + + ++#if 0 + /* input methods */ + xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); + xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing + | XIMStatusNothing, XNClientWindow, xw.win, + XNFocusWindow, xw.win, NULL); ++#endif + /* gc */ + dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL); + +@@ -1789,8 +1810,7 @@ + } + } + +- XmbDrawImageString(xw.dpy, xw.buf, base.mode & ATTR_BOLD ? dc.bfont.set : dc.font.set, +- dc.gc, winx, winy, s, bytelen); ++ XDrawString(xw.dpy, xw.buf, dc.gc, winx, winy, s, bytelen); + + if(base.mode & ATTR_UNDERLINE) + XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1); +@@ -1958,7 +1978,7 @@ + + meta = e->state & Mod1Mask; + shift = e->state & ShiftMask; +- len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status); ++ len = XLookupString(e, buf, sizeof(buf), &ksym, &status); + + /* 1. custom keys from config.h */ + if((customkey = kmap(ksym, e->state))) +@@ -2012,6 +2032,7 @@ + + void + resize(XEvent *e) { ++#if 0 + int col, row; + + if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h) +@@ -2027,6 +2048,7 @@ + draw(); + ttyresize(col, row); + xresize(col, row); ++#endif + } + + bool diff --git a/tinyx/patches/st/0.2/02-colormap-and-cursor.patch b/tinyx/patches/st/0.2/02-colormap-and-cursor.patch new file mode 100644 index 0000000..a4add98 --- /dev/null +++ b/tinyx/patches/st/0.2/02-colormap-and-cursor.patch @@ -0,0 +1,145 @@ +diff -ruN a/config.def.h b/config.def.h +--- a/config.def.h 2024-08-28 16:09:41.718025427 +0200 ++++ b/config.def.h 2024-08-29 15:01:53.329920739 +0200 +@@ -8,17 +8,18 @@ + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { + "black", +- "red3", ++ "wheat", ++ "gray90", ++ "LightSteelBlue4", ++ "yellow", ++ "#5c5cff", + "green3", + "yellow3", + "blue2", + "magenta3", + "cyan3", +- "gray90", + "gray50", +- "red", + "green", +- "yellow", + "#5c5cff", + "magenta", + "cyan", +@@ -27,9 +28,9 @@ + + /* Default colors (colorname index) + foreground, background, cursor */ +-#define DefaultFG 15 +-#define DefaultBG 0 +-#define DefaultCS 1 ++#define DefaultFG 3 ++#define DefaultBG 2 ++#define DefaultCS 3 + + /* Special keys (change & recompile st.info accordingly) + Keep in mind that kpress() in st.c hardcodes some keys. +diff -ruN a/st.c b/st.c +--- a/st.c 2024-08-28 16:09:41.719025474 +0200 ++++ b/st.c 2024-08-30 13:45:22.624877365 +0200 +@@ -1610,6 +1610,7 @@ + for(r = 0; r < 6; r++) + for(g = 0; g < 6; g++) + for(b = 0; b < 6; b++) { ++#if 0 + color.red = r == 0 ? 0 : 0x3737 + 0x2828 * r; + color.green = g == 0 ? 0 : 0x3737 + 0x2828 * g; + color.blue = b == 0 ? 0 : 0x3737 + 0x2828 * b; +@@ -1618,16 +1619,21 @@ + fprintf(stderr, "Could not allocate color %d\n", i); + } else + dc.col[i] = color.pixel; ++#endif ++ dc.col[i] = white; + i++; + } + + for(r = 0; r < 24; r++, i++) { ++#if 0 + color.red = color.green = color.blue = 0x0808 + 0x0a0a * r; + if (!XAllocColor(xw.dpy, xw.cmap, &color)) { + dc.col[i] = white; + fprintf(stderr, "Could not allocate color %d\n", i); + } else + dc.col[i] = color.pixel; ++#endif ++ dc.col[i] = white; + } + } + +@@ -1816,6 +1822,32 @@ + XDrawLine(xw.dpy, xw.buf, dc.gc, winx, winy+1, winx+width-1, winy+1); + } + ++void ++xdrawu(char *s, Glyph base, int x, int y) { ++ ulong xfg = dc.col[base.fg], xbg = dc.col[base.bg], temp; ++ int winx = x*xw.cw, winy = (y + 1) * xw.ch - 2; ++ int i; ++ ++ /* only switch default fg/bg if term is in RV mode */ ++ if(IS_SET(MODE_REVERSE)) { ++ if(base.fg == DefaultFG) ++ xfg = dc.col[DefaultBG]; ++ if(base.bg == DefaultBG) ++ xbg = dc.col[DefaultFG]; ++ } ++ ++ if(base.mode & ATTR_REVERSE) ++ temp = xfg, xfg = xbg, xbg = temp; ++ ++ XSetBackground(xw.dpy, dc.gc, xbg); ++ XSetForeground(xw.dpy, dc.gc, xfg); ++ ++ XDrawRectangle(xw.dpy, xw.buf, dc.gc, winx+1, winy, xw.cw-2, 1); ++ ++ XSetBackground(xw.dpy, dc.gc, xfg); ++ XSetForeground(xw.dpy, dc.gc, xbg); ++} ++ + /* copy buffer pixmap to screen pixmap */ + void + xcopy(int x, int y, int cols, int rows) { +@@ -1829,7 +1861,7 @@ + static int oldx = 0; + static int oldy = 0; + int sl; +- Glyph g = {{' '}, ATTR_NULL, DefaultBG, DefaultCS, 0}; ++ Glyph g = {{'_'}, ATTR_NULL, DefaultCS, DefaultCS, 0}; + + LIMIT(oldx, 0, term.col-1); + LIMIT(oldy, 0, term.row-1); +@@ -1838,24 +1870,25 @@ + memcpy(g.c, term.line[term.c.y][term.c.x].c, UTF_SIZ); + + /* remove the old cursor */ ++ xclear(oldx, oldy, oldx, oldy); + if(term.line[oldy][oldx].state & GLYPH_SET) { + sl = utf8size(term.line[oldy][oldx].c); + xdraws(term.line[oldy][oldx].c, term.line[oldy][oldx], oldx, oldy, 1, sl); +- } else +- xclear(oldx, oldy, oldx, oldy); ++ } + +- xcopy(oldx, oldy, 1, 1); ++ xcopy(oldx-1, oldy-1, 3, 3); + + /* draw the new one */ + if(!(term.c.state & CURSOR_HIDE) && (xw.state & WIN_FOCUSED)) { + sl = utf8size(g.c); + if(IS_SET(MODE_REVERSE)) + g.mode |= ATTR_REVERSE, g.fg = DefaultCS, g.bg = DefaultFG; +- xdraws(g.c, g, term.c.x, term.c.y, 1, sl); ++ xdrawu(g.c, g, term.c.x, term.c.y); ++ + oldx = term.c.x, oldy = term.c.y; + } + +- xcopy(term.c.x, term.c.y, 1, 1); ++ xcopy(term.c.x-1, term.c.y-1, 3, 3); + } + + void diff --git a/tinyx/patches/st/0.2/03-resize.patch b/tinyx/patches/st/0.2/03-resize.patch new file mode 100644 index 0000000..ea5d963 --- /dev/null +++ b/tinyx/patches/st/0.2/03-resize.patch @@ -0,0 +1,43 @@ +diff -ruN a/st.c b/st.c +--- a/st.c 2024-09-02 10:01:36.967676919 +0200 ++++ b/st.c 2024-09-02 10:15:15.834559610 +0200 +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -764,7 +765,6 @@ + + void + ttyresize(int x, int y) { +-#if 0 + struct winsize w; + + w.ws_row = term.row; +@@ -772,7 +772,6 @@ + w.ws_xpixel = w.ws_ypixel = 0; + if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0) + fprintf(stderr, "Couldn't set window size: %s\n", SERRNO); +-#endif + } + + void +@@ -2065,7 +2064,6 @@ + + void + resize(XEvent *e) { +-#if 0 + int col, row; + + if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h) +@@ -2081,7 +2079,6 @@ + draw(); + ttyresize(col, row); + xresize(col, row); +-#endif + } + + bool diff --git a/tinyx/patches/st/0.2/04-handle-wmdeletewin.patch b/tinyx/patches/st/0.2/04-handle-wmdeletewin.patch new file mode 100644 index 0000000..9173b3e --- /dev/null +++ b/tinyx/patches/st/0.2/04-handle-wmdeletewin.patch @@ -0,0 +1,59 @@ +diff -ruN a/st.c b/st.c +--- a/st.c 2024-09-02 10:01:36.967676919 +0200 ++++ b/st.c 2024-10-07 16:14:10.351915872 +0200 +@@ -134,7 +134,7 @@ + Colormap cmap; + Window win; + Pixmap buf; +- Atom xembed; ++ Atom xembed, wmdeletewin; + XIM xim; + XIC xic; + int scr; +@@ -219,6 +219,7 @@ + static void ttyread(void); + static void ttyresize(int, int); + static void ttywrite(const char *, size_t); ++static void ttyhangup(void); + + static void xdraws(char *, Glyph, int, int, int, int); + static void xhints(void); +@@ -772,6 +773,13 @@ + w.ws_xpixel = w.ws_ypixel = 0; + if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0) + fprintf(stderr, "Couldn't set window size: %s\n", SERRNO); ++} ++ ++void ++ttyhangup(void) ++{ ++ /* Send SIGHUP to shell */ ++ kill(pid, SIGHUP); + } + + void +@@ -1779,6 +1787,8 @@ + &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000}); + + xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); ++ xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); ++ XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); + + XStoreName(xw.dpy, xw.win, opt_title ? opt_title : "st"); + XMapWindow(xw.dpy, xw.win); +@@ -2060,11 +2070,14 @@ + xw.state &= ~WIN_FOCUSED; + } + draw(); +- } ++ } else if (e->xclient.data.l[0] == xw.wmdeletewin) { ++ ttyhangup(); ++ exit(0); ++ } + } + + void + resize(XEvent *e) { + int col, row; + + if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h) From 8e8211d08ce17c45b82da411ad0615373170cac7 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:27:08 +0200 Subject: [PATCH 08/14] tinyx: port x11-apps (xmessage, xeyes, xclock, twm) JIRA: RTOS-826, RTOS-865, RTOS-889 --- tinyx/build.sh | 13 +- .../tinyxlib/9862f3/13-libxt-libxaw.patch | 424 ++++++++++++++++++ tinyx/patches/twm/1.0.12/01-twm.patch | 73 +++ tinyx/patches/xeyes/1.1.1/01-hypot.patch | 11 + 4 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 tinyx/patches/tinyxlib/9862f3/13-libxt-libxaw.patch create mode 100644 tinyx/patches/twm/1.0.12/01-twm.patch create mode 100644 tinyx/patches/xeyes/1.1.1/01-hypot.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 90134f5..fa398a2 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -250,6 +250,13 @@ build_x11_app() { exec_configure ${configure_opts} fi + # FIXME: this is brutal, see build_tinyx note + sedexpr='s/ -lXaw7/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;' + sedexpr+='s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g;' + sedexpr+='s/ -lXmuu/ -l:libXmuu.a -l:libXcursor.a -l:libXrender.a/g;s/ -lXcursor//g' + + find . -name 'Makefile' -print0 | xargs -0 sed -i "${sedexpr}" + mark_as_configured "${appname}/${version}" fi @@ -299,10 +306,14 @@ build_tinyx # Build window managers build_suckless dwm 5.1 +build_x11_app twm 1.0.12 # requires yacc # Build client apps -build_x11_app ico 1.0.4 # requires gettext build_suckless st 0.2 +build_x11_app ico 1.0.4 # requires gettext +build_x11_app xmessage 1.0.7 +build_x11_app xclock 1.1.1 --without-xft --without-xkb +build_x11_app xeyes 1.1.1 --without-xrender rm -rf "$TMP_DIR" diff --git a/tinyx/patches/tinyxlib/9862f3/13-libxt-libxaw.patch b/tinyx/patches/tinyxlib/9862f3/13-libxt-libxaw.patch new file mode 100644 index 0000000..eb70ec7 --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/13-libxt-libxaw.patch @@ -0,0 +1,424 @@ +diff -ruN a/include/X11/Xos_r.h b/include/X11/Xos_r.h +--- a/include/X11/Xos_r.h 2024-08-05 09:04:38.582732562 +0200 ++++ b/include/X11/Xos_r.h 2024-08-08 14:48:50.035850395 +0200 +@@ -320,6 +320,10 @@ + ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) + + #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ ++#ifdef __phoenix__ ++# define _XGetpwuid(u,p) getpwuid((u)) ++# define _XGetpwnam(u,p) getpwnam((u)) ++#else + /* Digital UNIX 4.0, but not (beta) T4.0-1 */ + # define X_NEEDS_PWPARAMS + typedef struct { +@@ -334,6 +338,7 @@ + # define _XGetpwnam(u,p) \ + ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == -1) ? \ + NULL : (p).pwp) ++#endif + #endif /* X_INCLUDE_PWD_H */ + + #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) +diff -ruN a/libICE/iceauth.c b/libICE/iceauth.c +--- a/libICE/iceauth.c 2024-08-05 09:04:38.583732565 +0200 ++++ b/libICE/iceauth.c 2024-08-08 13:36:23.677995326 +0200 +@@ -69,7 +69,6 @@ + } + #else + { +- long time (); + ldata[0] = time ((long *) 0); + ldata[1] = getpid (); + } +diff -ruN a/libICE/Makefile b/libICE/Makefile +--- a/libICE/Makefile 2024-08-05 09:04:38.583732565 +0200 ++++ b/libICE/Makefile 2024-08-08 15:17:59.543419943 +0200 +@@ -10,10 +10,6 @@ + + all: $(OBJS:.c=.o) + ar cr libICE.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libICE.so.6.3~ -shared -Wl,-soname,libICE.so.6 $(OBJS:.c=.o) +- mv -f libICE.so.6.3~ libICE.so.6.3 +- ln -s libICE.so.6.3 libICE.so.6 +- ln -s libICE.so.6.3 libICE.so + + @echo "prefix=$(PREDIR)" > ice.pc + @echo "exec_prefix=$(PREDIR)/bin" >> ice.pc +@@ -34,9 +30,6 @@ + + install: + cp -af libICE.a $(DESTDIR)$(LIBDIR) +- cp -af libICE.so.6.3 $(DESTDIR)$(LIBDIR) +- cp -af libICE.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libICE.so $(DESTDIR)$(LIBDIR) + + depend: +- gccmakedep -- $(CFLAGS) -- *.c +\ No newline at end of file ++ gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libSM/Makefile b/libSM/Makefile +--- a/libSM/Makefile 2024-08-05 09:04:38.584732568 +0200 ++++ b/libSM/Makefile 2024-08-08 15:18:09.088441165 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libSM.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libSM.so.6.0~ -shared -Wl,-soname,libSM.so.6 $(OBJS:.c=.o) +- mv -f libSM.so.6.0~ libSM.so.6.0 +- ln -s libSM.so.6.0 libSM.so.6 +- ln -s libSM.so.6.0 libSM.so + + @echo "prefix=$(PREDIR)" > sm.pc + @echo "exec_prefix=$(PREDIR)/bin" >> sm.pc +@@ -32,9 +28,6 @@ + + install: + cp -af libSM.a $(DESTDIR)$(LIBDIR) +- cp -af libSM.so.6.0 $(DESTDIR)$(LIBDIR) +- cp -af libSM.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libSM.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libtinyX11/Xlib.h b/libtinyX11/Xlib.h +--- a/libtinyX11/Xlib.h 2024-08-05 09:04:38.628732696 +0200 ++++ b/libtinyX11/Xlib.h 2024-08-08 14:06:02.954681025 +0200 +@@ -60,7 +60,7 @@ + #if 1 + //#define ISC + //#define USE_XMBTOWC +-//#define USE_XWCHAR_STRING ++#define USE_XWCHAR_STRING + #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) + #define wctomb(a,b) _Xwctomb(a,b) + #define mblen(a,b) _Xmblen(a,b) +diff -ruN a/libXaw/Makefile b/libXaw/Makefile +--- a/libXaw/Makefile 2024-08-05 09:04:38.587732577 +0200 ++++ b/libXaw/Makefile 2024-08-08 15:17:48.776393292 +0200 +@@ -1,6 +1,6 @@ + include ../standard_definitions.mk + +-DEFS=-DNOERROR -Dlinux -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H -DPROJECT_ROOT=\"/usr\" -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DUNIXCONN -DTCPCONN -DHAS_STICKY_DIR_BIT -DIPv6 -DICE_t ++DEFS=-DNOERROR -Dlinux -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DHAS_WCHAR_H -DNO_WIDEC_H -DPROJECT_ROOT=\"/usr\" -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DUNIXCONN -DTCPCONN -DHAS_STICKY_DIR_BIT -DIPv6 -DICE_t + + CFLAGS= -I../include -I../include/X11 $(COMMONDEFS) $(DEFS) + +@@ -8,11 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXaw.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXaw.so.7.1~ -shared -Wl,-soname,libXaw.so.7 $(OBJS:.c=.o) \ +- -L../libXpm -lXpm -L../libXmu -lXmu +- mv -f libXaw.so.7.1~ libXaw.so.7.1 +- ln -s libXaw.so.7.1 libXaw.so.7 +- ln -s libXaw.so.7.1 libXaw.so + + @echo "prefix=$(PREDIR)" > xaw7.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xaw7.pc +@@ -33,9 +28,6 @@ + + install: + cp -af libXaw.a $(DESTDIR)$(LIBDIR) +- cp -af libXaw.so.7.1 $(DESTDIR)$(LIBDIR) +- cp -af libXaw.so.7 $(DESTDIR)$(LIBDIR) +- cp -af libXaw.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libXaw/XawI18n.c b/libXaw/XawI18n.c +--- a/libXaw/XawI18n.c 2024-08-05 09:04:38.591732588 +0200 ++++ b/libXaw/XawI18n.c 2024-08-08 15:00:51.314562865 +0200 +@@ -68,10 +68,10 @@ + str[0] = c; + str[1] = '\0'; + +- mbtowc(&wc, str, 1); ++ // mbtowc(&wc, str, 1); + +- return (wc); +-} ++ return c; //shhh, will anybody notice? ++} + + + int +@@ -79,7 +79,40 @@ + { + unsigned char mb[sizeof(wchar_t)]; + +- wctomb((char*)mb, ch); ++ return (isalnum(ch)); ++} ++ ++size_t ++wcslen (const wchar_t *s) ++{ ++ size_t len = 0; ++ ++ while (s[len] != L'\0') ++ { ++ if (s[++len] == L'\0') ++ return len; ++ if (s[++len] == L'\0') ++ return len; ++ if (s[++len] == L'\0') ++ return len; ++ ++len; ++ } + +- return (isalnum(*mb)); ++ return len; ++} ++ ++wchar_t * ++wcscpy (wchar_t *dest, const wchar_t *src) ++{ ++ size_t size = strlen (src); ++ return memcpy (dest, src, size); ++} ++ ++wchar_t * ++wcsncpy (wchar_t *dest, const wchar_t *src, size_t n) ++{ ++ size_t size = strnlen (src, n); ++ if (size != n) ++ memset (dest + size, L'\0', n - size); ++ return memcpy (dest, src, size); + } +diff -ruN a/libXaw/XawI18n.h b/libXaw/XawI18n.h +--- a/libXaw/XawI18n.h 2024-08-05 09:04:38.591732588 +0200 ++++ b/libXaw/XawI18n.h 2024-08-08 14:24:32.431379921 +0200 +@@ -25,6 +25,7 @@ + ********************************************************/ + /* $XFree86: xc/lib/Xaw/XawI18n.h,v 3.16 2005/03/28 02:50:59 dawes Exp $ */ + ++#include + #ifdef HAS_WCTYPE_H + #include + #ifndef NO_WIDEC_H +@@ -35,9 +36,10 @@ + #endif + #endif + +-#ifdef HAS_WCHAR_H +-#include +-#endif ++// #ifdef HAS_WCHAR_H ++// #include ++// #endif ++ + + + +@@ -45,6 +47,13 @@ + + #include + ++size_t ++wcslen (const wchar_t *s); ++ ++wchar_t * ++wcsncpy (wchar_t *dest, const wchar_t *src, size_t n); ++ ++ + #ifdef USE_XWCHAR_STRING + int _Xwcslen + ( +diff -ruN a/libXmu/Makefile b/libXmu/Makefile +--- a/libXmu/Makefile 2024-08-05 09:04:38.604732626 +0200 ++++ b/libXmu/Makefile 2024-08-08 15:18:37.310492246 +0200 +@@ -1,6 +1,6 @@ + include ../standard_definitions.mk + +-DEFS=-Dlinux -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DXTSTRINGDEFINES -DUNIXCONN -DTCPCONN -DHAS_STICKY_DIR_BIT -DIPv6 -DBITMAPDIR=\"/usr/include/X11/bitmaps\" -DTINY ++DEFS=-Dlinux -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DXTSTRINGDEFINES -DUNIXCONN -DHAS_STICKY_DIR_BIT -DIPv6 -DBITMAPDIR=\"/usr/include/X11/bitmaps\" -DTINY + + CFLAGS= -I../include -I../include/X11 $(COMMONDEFS) $(DEFS) + +@@ -8,11 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXmu.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXmu.so.6.2~ -shared -Wl,-soname,libXmu.so.6 $(OBJS:.c=.o) \ +- -L../libXt -lXt +- mv -f libXmu.so.6.2~ libXmu.so.6.2 +- ln -s libXmu.so.6.2 libXmu.so.6 +- ln -s libXmu.so.6.2 libXmu.so + + @echo "prefix=$(PREDIR)" > xmu.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xmu.pc +@@ -33,9 +28,6 @@ + + install: + cp -af libXmu.a $(DESTDIR)$(LIBDIR) +- cp -af libXmu.so.6.2 $(DESTDIR)$(LIBDIR) +- cp -af libXmu.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXmu.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libXpm/Makefile b/libXpm/Makefile +--- a/libXpm/Makefile 2024-08-05 09:04:38.607732635 +0200 ++++ b/libXpm/Makefile 2024-08-08 14:36:39.861273294 +0200 +@@ -7,10 +7,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXpm.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXpm.so.1.0~ -shared -Wl,-soname,libXpm.so.1 $(OBJS:.c=.o) +- mv -f libXpm.so.1.0~ libXpm.so.1.0 +- ln -s libXpm.so.1.0 libXpm.so.1 +- ln -s libXpm.so.1.0 libXpm.so + + @echo "prefix=$(PREDIR)" > xpm.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xpm.pc +@@ -31,9 +27,6 @@ + + install: + cp -af libXpm.a $(DESTDIR)$(LIBDIR) +- cp -af libXpm.so.1.0 $(DESTDIR)$(LIBDIR) +- cp -af libXpm.so.1 $(DESTDIR)$(LIBDIR) +- cp -af libXpm.so $(DESTDIR)$(LIBDIR) + + depend: +- gccmakedep -- $(CFLAGS) -- *.c +\ No newline at end of file ++ gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libXt/Makefile b/libXt/Makefile +--- a/libXt/Makefile 2024-08-05 09:04:38.610732644 +0200 ++++ b/libXt/Makefile 2024-08-08 13:33:58.740577856 +0200 +@@ -10,34 +10,12 @@ + + all: $(OBJS:.c=.o) + ar cr libXt.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXt.so.6.1~ -shared -Wl,-soname,libXt.so.6 $(OBJS:.c=.o) \ +- -L../libSM -lSM -L../libICE -lICE -L../libtinyX11 -lX11 +- mv -f libXt.so.6.1~ libXt.so.6.1 +- ln -s libXt.so.6.1 libXt.so.6 +- ln -s libXt.so.6.1 libXt.so +- +- @echo "prefix=$(PREDIR)" > xt.pc +- @echo "exec_prefix=$(PREDIR)/bin" >> xt.pc +- @echo "libdir=$(PREDIR)/lib" >> xt.pc +- @echo "includedir=$(PREDIR)/include" >> xt.pc +- @echo "" >> xt.pc +- @echo "Name: Xt" >> xt.pc +- @echo "Description: X Toolkit Library" >> xt.pc +- @echo "Version: 1.0.5" >> xt.pc +- @echo "Requires: sm ice x11 xau xdmcp" >> xt.pc +- @echo "Requires.private: sm ice x11 xau xdmcp" >> xt.pc +- @echo "Cflags: -I$(PREDIR)/include" >> xt.pc +- @echo "Libs: -L$(PREDIR)/lib -lXt" >> xt.pc +- @echo "Libs.private: -L$(PREDIR)/lib -lXt" >> xt.pc + + clean: + rm -f *.o *.a *.so* xt.pc + + install: + cp -af libXt.a $(DESTDIR)$(LIBDIR) +- cp -af libXt.so.6.1 $(DESTDIR)$(LIBDIR) +- cp -af libXt.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXt.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/Makefile b/Makefile +--- a/Makefile 2024-08-05 09:04:38.631732705 +0200 ++++ b/Makefile 2024-08-08 14:36:56.618114068 +0200 +@@ -1,19 +1,37 @@ + all: + cd libXau; make ++ cd libSM; make ++ cd libICE; make ++ cd libXt; make ++ cd libXmu; make ++ cd libXaw; make + cd libXext; make + cd libtinyX11; make ++ cd libXpm; make + cd libXdmcp; make + mkdir -p include/pkgconfig && cd include/pkgconfig && ln -sf ../../lib*/*.pc ./ + clean: + cd libtinyX11; make clean + cd libXext; make clean + cd libXau; make clean ++ cd libXmu; make clean ++ cd libSM; make clean ++ cd libICE; make clean ++ cd libXaw; make clean ++ cd libXt; make clean ++ cd libXpm; make clean + cd libXdmcp; make clean + install: + cd libXau; make install ++ cd libXmu; make install ++ cd libSM; make install ++ cd libICE; make install ++ cd libXaw; make install + cd libtinyX11; make install + cd libXext; make install ++ cd libXt; make install + cd libXdmcp; make install ++ cd libXpm; make install + cd include; make install + tarball: clean + ./make-tarball.sh +diff -ruN a/libXaw/TextTr.c b/libXaw/TextTr.c +--- a/libXaw/TextTr.c 2024-10-07 10:28:11.853320915 +0200 ++++ b/libXaw/TextTr.c 2024-10-07 13:13:04.171028209 +0200 +@@ -125,7 +125,6 @@ + "Return:" "newline()\n" + ":KP_Enter:" "newline()\n" + "cbackslash:" "reconnect-im()\n" +-"Kanji:" "reconnect-im()\n" + #ifndef OLDXAW + ":0:" "numeric(0)\n" + ":1:" "numeric(1)\n" +diff -ruN a/libXaw/XawIm.c b/libXaw/XawIm.c +--- a/libXaw/XawIm.c 2024-10-07 10:28:11.855320961 +0200 ++++ b/libXaw/XawIm.c 2024-10-07 13:22:39.892551306 +0200 +@@ -1256,6 +1256,7 @@ + static void + Register(Widget inwidg, XawVendorShellExtPart* ve) + { ++ return; + if (ve->im.xim == NULL) + { + OpenIM(ve); +@@ -1284,6 +1285,7 @@ + static void + Unregister(Widget inwidg, XawVendorShellExtPart *ve) + { ++ return; + if (!IsRegistered(inwidg, ve)) return; + + DestroyIC(inwidg, ve); +@@ -1327,6 +1329,7 @@ + static void + Reconnect(XawVendorShellExtPart *ve) + { ++ return; + XawIcTableList p; + + ve->im.open_im = True; +diff -ruN a/libXt/Initialize.c b/libXt/Initialize.c +--- a/libXt/Initialize.c 2024-10-07 13:41:24.958653758 +0200 ++++ b/libXt/Initialize.c 2024-10-07 15:32:19.579428509 +0200 +@@ -328,6 +328,8 @@ + String xnl, + XtPointer closure) /* unused */ + { ++ return setlocale(LC_ALL, "C"); /* we don't need more than C locale */ ++ + if (! setlocale(LC_ALL, xnl)) + XtWarning("locale not supported by C library, locale unchanged"); + +@@ -348,6 +350,8 @@ + { + XtLanguageProc old; + ++ return _XtDefaultLanguageProc; /* we don't need i18n */ ++ + if (!proc) { + proc = _XtDefaultLanguageProc; + closure = NULL; diff --git a/tinyx/patches/twm/1.0.12/01-twm.patch b/tinyx/patches/twm/1.0.12/01-twm.patch new file mode 100644 index 0000000..1d05eeb --- /dev/null +++ b/tinyx/patches/twm/1.0.12/01-twm.patch @@ -0,0 +1,73 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2022-04-02 20:36:49.000000000 +0200 ++++ b/configure.ac 2024-08-20 10:45:57.220251974 +0200 +@@ -50,10 +50,6 @@ + + # Checks for pkg-config packages + PKG_CHECK_MODULES([TWM], [x11 xext xt xmu ice sm xproto >= 7.0.17]) +-PKG_CHECK_MODULES([XRANDR], [xrandr], [have_xrandr=yes], [have_xrandr=no]) +-if test "$have_xrandr" = yes; then +- AC_DEFINE([HAVE_XRANDR], [1], [Define to 1 if you have the xrandr headers/libraries]) +-fi + + AC_CONFIG_FILES([Makefile + src/Makefile +diff -ruN a/src/menus.c b/src/menus.c +--- a/src/menus.c 2022-04-02 20:36:49.000000000 +0200 ++++ b/src/menus.c 2024-08-20 10:53:18.394309064 +0200 +@@ -79,7 +79,9 @@ + #include "session.h" + #include + #include "version.h" +-#include ++#include ++#include ++#include + #include + + int RootFunction = 0; +@@ -1906,6 +1908,7 @@ + Bell(XkbBI_MinorError, 0, tmp_win->w); + break; + ++#if 0 + case F_CIRCLEUP: + XCirculateSubwindowsUp(dpy, Scr->Root); + break; +@@ -1913,6 +1916,7 @@ + case F_CIRCLEDOWN: + XCirculateSubwindowsDown(dpy, Scr->Root); + break; ++#endif + + case F_EXEC: + PopDownMenu(); +diff -ruN a/src/parse.c b/src/parse.c +--- a/src/parse.c 2022-04-02 20:36:49.000000000 +0200 ++++ b/src/parse.c 2024-08-20 10:48:18.826964856 +0200 +@@ -69,8 +69,10 @@ + #include "gram.h" + #include "parse.h" + ++#include + #include +-#include ++#include ++#include + + #ifndef SYSTEM_INIT_FILE + #define SYSTEM_INIT_FILE "/usr/lib/X11/twm/system.twmrc" +diff -ruN a/src/twm.c b/src/twm.c +--- a/src/twm.c 2022-04-02 20:36:49.000000000 +0200 ++++ b/src/twm.c 2024-08-20 10:53:07.850111898 +0200 +@@ -81,7 +81,9 @@ + #include + #include + #include +-#include ++#include ++#include ++#include + #include + + #ifdef XPRINT diff --git a/tinyx/patches/xeyes/1.1.1/01-hypot.patch b/tinyx/patches/xeyes/1.1.1/01-hypot.patch new file mode 100644 index 0000000..e8ac80a --- /dev/null +++ b/tinyx/patches/xeyes/1.1.1/01-hypot.patch @@ -0,0 +1,11 @@ +diff -ruN a/Eyes.c b/Eyes.c +--- a/Eyes.c 2024-08-19 11:59:47.698361121 +0200 ++++ b/Eyes.c 2024-08-19 12:00:01.299368023 +0200 +@@ -55,6 +55,7 @@ + + #define offset(field) XtOffsetOf(EyesRec, eyes.field) + #define goffset(field) XtOffsetOf(WidgetRec, core.field) ++#define hypot(x,y) sqrt(((x)*(x))+((y)*(y))) + + static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), From 79af7fd5c7882fc56884423f001a5d2ee8b018fc Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 30 Aug 2024 11:40:45 +0200 Subject: [PATCH 09/14] tinyx: port x11-apps (xsetroot, xinit, xrdb, xgc) JIRA: RTOS-826, RTOS-889 --- tinyx/build.sh | 4 + .../9862f3/01-standard_definitions.mk.patch | 3 +- .../9862f3/14-libxcursor-libxmuu.patch | 119 ++++++++++++++++++ 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 tinyx/patches/tinyxlib/9862f3/14-libxcursor-libxmuu.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index fa398a2..75a048c 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -315,5 +315,9 @@ build_x11_app ico 1.0.4 # requires gettext build_x11_app xmessage 1.0.7 build_x11_app xclock 1.1.1 --without-xft --without-xkb build_x11_app xeyes 1.1.1 --without-xrender +build_x11_app xsetroot 1.1.1 +build_x11_app xinit 1.3.3 +build_x11_app xrdb 1.2.2 +build_x11_app xgc 1.0.6 rm -rf "$TMP_DIR" diff --git a/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch b/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch index d758b33..3a520e0 100644 --- a/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch +++ b/tinyx/patches/tinyxlib/9862f3/01-standard_definitions.mk.patch @@ -12,7 +12,8 @@ diff -ruN a/standard_definitions.mk b/standard_definitions.mk -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 +-COMMONDEFS=$(COMPFLAGS) -D_BSD_SOURCE -D_GNU_SOURCE -DUSECMS ++COMMONDEFS=$(COMPFLAGS) -D_BSD_SOURCE -D_GNU_SOURCE -LDFLAGS=-Wl,--gc-sections,--sort-common,-s +# LDFLAGS=-Wl,--gc-sections,--sort-common,-s,-static diff --git a/tinyx/patches/tinyxlib/9862f3/14-libxcursor-libxmuu.patch b/tinyx/patches/tinyxlib/9862f3/14-libxcursor-libxmuu.patch new file mode 100644 index 0000000..3051e8b --- /dev/null +++ b/tinyx/patches/tinyxlib/9862f3/14-libxcursor-libxmuu.patch @@ -0,0 +1,119 @@ +diff -ruN a/libXcursor/Makefile b/libXcursor/Makefile +--- a/libXcursor/Makefile 2024-08-26 13:20:10.616454141 +0200 ++++ b/libXcursor/Makefile 2024-08-30 08:32:08.333724292 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXcursor.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXcursor.so.6.0~ -shared -Wl,-soname,libXcursor.so.6 $(OBJS:.c=.o) +- mv -f libXcursor.so.6.0~ libXcursor.so.6.0 +- ln -s libXcursor.so.6.0 libXcursor.so.6 +- ln -s libXcursor.so.6.0 libXcursor.so + + @echo "prefix=$(PREDIR)" > xcursor.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xcursor.pc +@@ -32,9 +28,6 @@ + + install: + cp -af libXcursor.a $(DESTDIR)$(LIBDIR) +- cp -af libXcursor.so.6.0 $(DESTDIR)$(LIBDIR) +- cp -af libXcursor.so.6 $(DESTDIR)$(LIBDIR) +- cp -af libXcursor.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libXmuu/Makefile b/libXmuu/Makefile +--- a/libXmuu/Makefile 2024-08-26 13:20:10.634452382 +0200 ++++ b/libXmuu/Makefile 2024-08-30 08:31:47.436732683 +0200 +@@ -8,10 +8,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXmuu.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXmuu.so.1.0~ -shared -Wl,-soname,libXmuu.so.1 $(OBJS:.c=.o) +- mv -f libXmuu.so.1.0~ libXmuu.so.1.0 +- ln -s libXmuu.so.1.0 libXmuu.so.1 +- ln -s libXmuu.so.1.0 libXmuu.so + + @echo "prefix=$(PREDIR)" > xmuu.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xmuu.pc +@@ -32,9 +28,6 @@ + + install: + cp -af libXmuu.a $(DESTDIR)$(LIBDIR) +- cp -af libXmuu.so.1.0 $(DESTDIR)$(LIBDIR) +- cp -af libXmuu.so.1 $(DESTDIR)$(LIBDIR) +- cp -af libXmuu.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/libXrender/Makefile b/libXrender/Makefile +--- a/libXrender/Makefile 2024-08-26 13:20:10.638451991 +0200 ++++ b/libXrender/Makefile 2024-08-30 08:42:13.960234209 +0200 +@@ -9,10 +9,6 @@ + + all: $(OBJS:.c=.o) + ar cr libXrender.a $(OBJS:.c=.o) +- $(CC) $(LDFLAGS) -o libXrender.so.1.1~ -shared -Wl,-soname,libXrender.so.1 $(OBJS:.c=.o) +- mv -f libXrender.so.1.1~ libXrender.so.1.1 +- ln -s libXrender.so.1.1 libXrender.so.1 +- ln -s libXrender.so.1.1 libXrender.so + + @echo "prefix=$(PREDIR)" > xrender.pc + @echo "exec_prefix=$(PREDIR)/bin" >> xrender.pc +@@ -33,9 +29,6 @@ + + install: + cp -af libXrender.a $(DESTDIR)$(LIBDIR) +- cp -af libXrender.so.1.1 $(DESTDIR)$(LIBDIR) +- cp -af libXrender.so.1 $(DESTDIR)$(LIBDIR) +- cp -af libXrender.so $(DESTDIR)$(LIBDIR) + + depend: + gccmakedep -- $(CFLAGS) -- *.c +diff -ruN a/Makefile b/Makefile +--- a/Makefile 2024-08-26 13:20:10.647451111 +0200 ++++ b/Makefile 2024-08-30 08:42:00.167211711 +0200 +@@ -4,26 +4,33 @@ + cd libICE; make + cd libXt; make + cd libXmu; make ++ cd libXcursor; make + cd libXaw; make + cd libXext; make + cd libtinyX11; make + cd libXpm; make + cd libXdmcp; make ++ cd libXmuu; make ++ cd libXrender; make + mkdir -p include/pkgconfig && cd include/pkgconfig && ln -sf ../../lib*/*.pc ./ + clean: + cd libtinyX11; make clean + cd libXext; make clean + cd libXau; make clean + cd libXmu; make clean ++ cd libXmuu; make clean ++ cd libXcursor; make clean + cd libSM; make clean + cd libICE; make clean + cd libXaw; make clean + cd libXt; make clean + cd libXpm; make clean + cd libXdmcp; make clean ++ cd libXrender; make clean + install: + cd libXau; make install + cd libXmu; make install ++ cd libXcursor; make install + cd libSM; make install + cd libICE; make install + cd libXaw; make install +@@ -31,7 +38,9 @@ + cd libXext; make install + cd libXt; make install + cd libXdmcp; make install ++ cd libXmuu; make install + cd libXpm; make install ++ cd libXrender; make install + cd include; make install + tarball: clean + ./make-tarball.sh From 16d246b41d5b18834ad70a286af5342b2a12f50d Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Thu, 29 Aug 2024 11:00:50 +0200 Subject: [PATCH 10/14] tinyx: fix colormap in xserver JIRA: RTOS-862 --- .../patches/tinyx/eed490/12-colors-fix.patch | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 tinyx/patches/tinyx/eed490/12-colors-fix.patch diff --git a/tinyx/patches/tinyx/eed490/12-colors-fix.patch b/tinyx/patches/tinyx/eed490/12-colors-fix.patch new file mode 100644 index 0000000..6d770e4 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/12-colors-fix.patch @@ -0,0 +1,146 @@ +diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c +--- a/kdrive/fbdev/fbdev.c 2024-08-21 12:36:43.433667825 +0200 ++++ b/kdrive/fbdev/fbdev.c 2024-08-29 13:35:37.289274844 +0200 +@@ -33,7 +33,7 @@ + void refresher(void *arg) { + graph_t* g = (graph_t*) arg; + while (1) { +- usleep(12588); // ~70Hz ++ usleep(33333); // ~30Hz + graph_commit(g); + } + } +@@ -100,7 +100,7 @@ + FatalError("failed to initialize graphics adapter: %s", strerror(k)); + } + +- if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_70Hz)) < 0) { ++ if ((k = graph_mode(&priv->g, GRAPH_DEFMODE, GRAPH_DEFFREQ)) < 0) { + FatalError("failed to set graphics mode: %d", k); + } + +@@ -134,7 +134,6 @@ + return TRUE; + } + +-#if 0 + static Pixel fbdevMakeContig(Pixel orig, Pixel others) + { + Pixel low; +@@ -147,6 +146,7 @@ + return orig; + } + ++#if 0 + static Bool fbdevModeSupported(KdScreenInfo * screen, const KdMonitorTiming * t) + { + return TRUE; +@@ -328,7 +328,6 @@ + screen->width = priv->g.width; + screen->height = priv->g.height; + screen->rate = 30; +- screen->fb.depth = depth; + + /* Calculate line_length if it's zero */ + if (!priv->line_length) +@@ -343,6 +342,32 @@ + screen->fb.blueMask = Mask(0,offset); + screen->fb.bitsPerPixel = priv->bits_per_pixel; + ++ screen->fb.redMask = fbdevMakeContig(screen->fb.redMask, ++ screen->fb. ++ greenMask | screen-> ++ fb.blueMask); ++ ++ screen->fb.greenMask = ++ fbdevMakeContig(screen->fb.greenMask, ++ screen->fb.redMask | screen->fb. ++ blueMask); ++ ++ screen->fb.blueMask = fbdevMakeContig(screen->fb.blueMask, ++ screen->fb.redMask | ++ screen->fb. ++ greenMask); ++ ++ Pixel allbits; ++ ++ allbits = ++ screen->fb.redMask | screen->fb.greenMask | screen-> ++ fb.blueMask; ++ depth = priv->bits_per_pixel; ++ while (depth && !(allbits & (1 << (depth - 1)))) ++ depth--; ++ ++ screen->fb.depth = depth; ++ + return fbdevMapFramebuffer(screen); + } + +@@ -362,6 +387,7 @@ + return TRUE; + } + ++#if 0 + static void *fbdevWindowLinear(ScreenPtr pScreen, + CARD32 row, + CARD32 offset, int mode, CARD32 * size, void *closure) +@@ -374,6 +400,7 @@ + *size = priv->line_length; + return (CARD8 *) priv->fb + row * priv->line_length + offset; + } ++#endif + + static Bool fbdevMapFramebuffer(KdScreenInfo * screen) + { +@@ -625,26 +652,21 @@ + + static Bool fbdevCreateColormap(ColormapPtr pmap) + { +- ScreenPtr pScreen = pmap->pScreen; + VisualPtr pVisual; + int i; + int nent; +- xColorItem *pdefs; ++ int val; + + 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); ++ printf("%d\n", nent); ++ + 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; ++ val = i * 65535 / (nent - 1); ++ pmap->red[i].co.local.red = val; ++ pmap->green[i].co.local.green = val; ++ pmap->blue[i].co.local.blue = val; + } +- free(pdefs); + return TRUE; + } + +@@ -782,6 +804,7 @@ + void fbdevGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs) + { + int p; ++#if 0 + int k; + int min, max; + +@@ -793,8 +816,9 @@ + if (pdefs[k].pixel > max) + max = pdefs[k].pixel; + } ++#endif + while (n--) { + p = pdefs->pixel; + pdefs->red = pdefs->green = pdefs->blue = p; + pdefs++; + } From 3eab46be04c6ac4d80f6b140434aea4296af0b7f Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 2 Sep 2024 11:51:50 +0200 Subject: [PATCH 11/14] tinyx: fix SIGINT handling in st and xserver Pressing ^C in X session is now captured by client apps instead of killing the X server. Pressing ^C in st sends SIGINT to the process inside pty instead of doing nothing. JIRA: RTOS-826, RTOS-861, RTOS-889 --- tinyx/patches/st/0.2/05-tiocstty.patch | 12 ++++++++ tinyx/patches/tinyx/eed490/13-tiocnotty.patch | 29 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tinyx/patches/st/0.2/05-tiocstty.patch create mode 100644 tinyx/patches/tinyx/eed490/13-tiocnotty.patch diff --git a/tinyx/patches/st/0.2/05-tiocstty.patch b/tinyx/patches/st/0.2/05-tiocstty.patch new file mode 100644 index 0000000..f835de7 --- /dev/null +++ b/tinyx/patches/st/0.2/05-tiocstty.patch @@ -0,0 +1,12 @@ +diff -ruN a/st.c b/st.c +--- a/st.c 2024-09-02 10:01:36.967676919 +0200 ++++ b/st.c 2024-09-02 11:46:12.263350519 +0200 +@@ -708,6 +709,8 @@ + dup2(s, STDIN_FILENO); + dup2(s, STDOUT_FILENO); + dup2(s, STDERR_FILENO); ++ if(ioctl(s, TIOCSCTTY, NULL) < 0) ++ die("ioctl TIOCSCTTY failed: %s\n", SERRNO); + close(s); + close(m); + execsh(); diff --git a/tinyx/patches/tinyx/eed490/13-tiocnotty.patch b/tinyx/patches/tinyx/eed490/13-tiocnotty.patch new file mode 100644 index 0000000..b001fe9 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/13-tiocnotty.patch @@ -0,0 +1,29 @@ +diff -ruN a/kdrive/phoenix/phoenix.c b/kdrive/phoenix/phoenix.c +--- a/kdrive/phoenix/phoenix.c 2024-09-02 10:24:29.020264244 +0200 ++++ b/kdrive/phoenix/phoenix.c 2024-09-02 11:36:26.806165111 +0200 +@@ -4,6 +4,7 @@ + #include "kdrive.h" + #include + #include ++#include + #include + #include + #include +@@ -14,6 +15,17 @@ + + static int PhoenixInit(void) + { ++ int fd; ++ if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) { ++ FatalError("PhoenixInit: Cannot open /dev/tty0 (%s)\n", ++ strerror(errno)); ++ } ++ ++ if (ioctl(fd, TIOCNOTTY, NULL) < 0) { ++ FatalError("PhoenixInit: TIOCNOTTY failed\n"); ++ } ++ close(fd); ++ + return 1; + } + From 7ec77d04648db5d2bad19bf0ad1c5fddce02c86d Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Wed, 18 Sep 2024 17:04:41 +0200 Subject: [PATCH 12/14] tinyx: use platformctl to draw on higher VGA framebuffer resolutions in xserver JIRA: RTOS-902, RTOS-906 --- .../eed490/14-vesa-via-platformctl.patch | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 tinyx/patches/tinyx/eed490/14-vesa-via-platformctl.patch diff --git a/tinyx/patches/tinyx/eed490/14-vesa-via-platformctl.patch b/tinyx/patches/tinyx/eed490/14-vesa-via-platformctl.patch new file mode 100644 index 0000000..8a22c73 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/14-vesa-via-platformctl.patch @@ -0,0 +1,112 @@ +diff -ruN a/kdrive/fbdev/fbdev.c b/kdrive/fbdev/fbdev.c +--- a/kdrive/fbdev/fbdev.c 2024-09-16 14:38:25.534289942 +0200 ++++ b/kdrive/fbdev/fbdev.c 2024-09-18 17:01:13.606892680 +0200 +@@ -29,6 +29,8 @@ + + #include + #include ++#include ++#include + + void refresher(void *arg) { + graph_t* g = (graph_t*) arg; +@@ -87,6 +89,7 @@ + priv->fb = priv->fb_base + off; + #endif + ++#if 0 + int k; + + priv->smem_len = 0x2000; +@@ -113,6 +116,28 @@ + + priv->g.height = priv->g.height; + priv->g.width = priv->g.width; ++#endif ++ ++ int err = 0; ++ ++ platformctl_t pctl = {.action = pctl_get, .type = pctl_graphmode }; ++ ++ if ((err = platformctl(&pctl)) < 0) { ++ printf("platformctl failed: %d\n", err); ++ return err; ++ } ++ ++ size_t memsz = (pctl.graphmode.pitch * pctl.graphmode.height * (pctl.graphmode.bpp / 8) + _PAGE_SIZE - 1) & ~(_PAGE_SIZE - 1); ++ if ((priv->fb = mmap(NULL, memsz, PROT_READ | PROT_WRITE, MAP_DEVICE | MAP_SHARED | MAP_UNCACHED | MAP_ANONYMOUS | MAP_PHYSMEM, -1, pctl.graphmode.framebuffer)) == MAP_FAILED) { ++ printf("mmap failed\n"); ++ return -ENOMEM; ++ } ++ ++ priv->smem_len = memsz; ++ priv->bits_per_pixel = pctl.graphmode.bpp; ++ priv->height = pctl.graphmode.height; ++ priv->width = pctl.graphmode.width; ++ priv->line_length = pctl.graphmode.pitch; + + return TRUE; + } +@@ -325,13 +350,13 @@ + FbdevPriv *priv = screen->card->driver; + int depth = priv->bits_per_pixel; + +- screen->width = priv->g.width; +- screen->height = priv->g.height; ++ screen->width = priv->width; ++ screen->height = priv->height; + screen->rate = 30; + + /* Calculate line_length if it's zero */ + if (!priv->line_length) +- priv->line_length = (priv->g.width * depth + 7) / 8; ++ priv->line_length = (priv->width * depth + 7) / 8; + + screen->fb.visuals = (1 << TrueColor); + +@@ -410,17 +435,18 @@ + + scrpriv->shadow = FALSE; + ++ screen->width = priv->width; ++ screen->height = priv->height; ++ + KdComputeMouseMatrix(&m, RR_Rotate_0, screen->width, screen->height); + + KdSetMouseMatrix(&m); + +- screen->width = priv->g.width; +- screen->height = priv->g.height; + screen->memory_base = (CARD8 *) (priv->fb); + screen->memory_size = priv->smem_len; + +- screen->fb.byteStride = (priv->g.width * priv->bits_per_pixel + 7) / 8; +- screen->fb.pixelStride = priv->g.width; ++ screen->fb.byteStride = priv->line_length; ++ screen->fb.pixelStride = priv->width; + screen->fb.frameBuffer = (CARD8 *) (priv->fb); + screen->off_screen_base = screen->fb.byteStride * screen->height; + +@@ -792,8 +818,10 @@ + { + FbdevPriv *priv = card->driver; + ++#if 0 + graph_close(&priv->g); + graph_done(); ++#endif + free(priv); + } + +diff -ruN a/kdrive/fbdev/fbdev.h b/kdrive/fbdev/fbdev.h +--- a/kdrive/fbdev/fbdev.h 2024-09-16 14:38:25.534289942 +0200 ++++ b/kdrive/fbdev/fbdev.h 2024-09-18 16:59:34.092072626 +0200 +@@ -35,6 +35,8 @@ + 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 */ ++ uint16_t width; ++ uint16_t height; + char *fb; + } FbdevPriv; + From 846ef0772c8c55f0b1ee13dbdbed138e5956dae0 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Wed, 2 Oct 2024 13:17:24 +0200 Subject: [PATCH 13/14] tinyx: disable fbcon while server is running Use the TTYSETMODE ioctl to stop the fbcon from drawing to the same framebuffer xserver is using JIRA: RTOS-906, RTOS-925 --- .../tinyx/eed490/15-set-tty-mode.patch | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tinyx/patches/tinyx/eed490/15-set-tty-mode.patch diff --git a/tinyx/patches/tinyx/eed490/15-set-tty-mode.patch b/tinyx/patches/tinyx/eed490/15-set-tty-mode.patch new file mode 100644 index 0000000..cb896bb --- /dev/null +++ b/tinyx/patches/tinyx/eed490/15-set-tty-mode.patch @@ -0,0 +1,39 @@ +diff -ruN a/kdrive/phoenix/phoenix.c b/kdrive/phoenix/phoenix.c +--- a/kdrive/phoenix/phoenix.c 2024-10-01 15:21:58.698012684 +0200 ++++ b/kdrive/phoenix/phoenix.c 2024-10-02 13:10:42.440162376 +0200 +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -24,6 +25,10 @@ + if (ioctl(fd, TIOCNOTTY, NULL) < 0) { + FatalError("PhoenixInit: TIOCNOTTY failed\n"); + } ++ ++ if (ioctl(fd, FBCONSETMODE, FBCON_DISABLED) < 0) { ++ FatalError("PhoenixInit: FBCONSETMODE failed\n"); ++ } + close(fd); + + return 1; +@@ -47,6 +52,16 @@ + + static void PhoenixFini(void) + { ++ int fd; ++ if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) { ++ FatalError("PhoenixInit: Cannot open /dev/tty0 (%s)\n", ++ strerror(errno)); ++ } ++ ++ if (ioctl(fd, FBCONSETMODE, FBCON_ENABLED) < 0) { ++ FatalError("PhoenixInit: FBCONSETMODE failed\n"); ++ } ++ close(fd); + } + + static const KdOsFuncs PhoenixFuncs = { From 5d487785ce38c66398dd20807e9431fa63d6cf4a Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 7 Oct 2024 12:47:22 +0200 Subject: [PATCH 14/14] tinyx: add xbill port JIRA: RTOS-889 --- tinyx/build.sh | 44 +++++++++++++++++++ tinyx/patches/xbill/2.1/01-configure.in.patch | 20 +++++++++ 2 files changed, 64 insertions(+) create mode 100644 tinyx/patches/xbill/2.1/01-configure.in.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 75a048c..4821278 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -295,6 +295,46 @@ build_suckless() { } +build_xbill() { + appname="xbill" + version="2.1" + + b_log "tinyx: building ${appname}" + + archive_filename="${appname}-${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + b_port_download "http://www.xbill.org/download/" "${archive_filename}" + + if should_reconfigure "${appname}/${version}"; then + extract_sources + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure --datadir="/usr/share/" + fi + + # FIXME: this is brutal, see build_tinyx note + sedexpr='s/ -lXaw/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;' + sedexpr+='s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g;' + sedexpr+='s/ -lXmuu/ -l:libXmuu.a -l:libXcursor.a -l:libXrender.a/g;s/ -lXcursor//g' + + find . -name 'Makefile' -print0 | xargs -0 sed -i "${sedexpr}" + + mark_as_configured "${appname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" + + $STRIP -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/${appname}" + + b_install "${PREFIX_PORT_SRC}/pixmaps"/* /usr/share/xbill/pixmaps/ + b_install "${PREFIX_PORT_SRC}/bitmaps"/* /usr/share/xbill/bitmaps/ + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + # Build xlib and xserver (call ordering is important here) build_tinyxlib @@ -320,4 +360,8 @@ build_x11_app xinit 1.3.3 build_x11_app xrdb 1.2.2 build_x11_app xgc 1.0.6 +# Fun stuff + +build_xbill + rm -rf "$TMP_DIR" diff --git a/tinyx/patches/xbill/2.1/01-configure.in.patch b/tinyx/patches/xbill/2.1/01-configure.in.patch new file mode 100644 index 0000000..734b0f6 --- /dev/null +++ b/tinyx/patches/xbill/2.1/01-configure.in.patch @@ -0,0 +1,20 @@ +diff -ruN a/configure.in b/configure.in +--- a/configure.in 2024-10-07 11:50:36.720475289 +0200 ++++ b/configure.in 2024-10-07 12:46:54.984035534 +0200 +@@ -84,6 +84,16 @@ + AC_SUBST(WIDGET_OBJS) + fi + ++dnl force athena ++AC_DEFINE(USE_ATHENA) ++WIDGET_LIBS="$WIDGET_LIBS -lXaw -lXmu" ++WIDGET_OBJS="$WIDGET_OBJS x11-athena.o" ++ ++WIDGET_LIBS="$WIDGET_LIBS -lXt -lXpm -lX11" ++WIDGET_OBJS="$WIDGET_OBJS x11.o" ++AC_SUBST(WIDGET_LIBS) ++AC_SUBST(WIDGET_OBJS) ++ + AC_ARG_ENABLE(gtk, + [ --enable-gtk build with the GTK widget set]) +