From 0b47c0b679c3436702fdb05b570b3790c2071c05 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:03:24 +0200 Subject: [PATCH 01/16] tinyx: add build.sh skeleton, add tinyx to root build.sh JIRA: RTOS-826 --- build.sh | 1 + tinyx/build.sh | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100755 tinyx/build.sh diff --git a/build.sh b/build.sh index 8b68b53..598e8b6 100755 --- a/build.sh +++ b/build.sh @@ -65,6 +65,7 @@ ports=( "coremark" "coreMQTT" "lsb_vsx" + "tinyx" ) diff --git a/tinyx/build.sh b/tinyx/build.sh new file mode 100755 index 0000000..1a22549 --- /dev/null +++ b/tinyx/build.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +set -e + +PREFIX_SHARE="${PREFIX_A}/share/" + + +inner_log() { + echo -e "$1" +} + + +# extract_sources(dest_dir_path) +extract_sources() { + local destdir="${1:?destdir missing}" + + if [ ! -d "${destdir}" ]; then + echo "Extracting sources from ${archive_filename}" + mkdir -p "${destdir}" + tar -axf "${PREFIX_PORT}/${archive_filename}" --strip-components 1 -C "${destdir}" + fi +} + + +# exec_configure([configure_opts]) +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" --bindir="${PREFIX_PROG}" --sbindir="${PREFIX_PROG}" \ + --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datarootdir="${PREFIX_A}" "${@}" \ + --disable-shared --enable-static --enable-silent-rules + ) +} + + +# md5_checksum(dir) +# Returns md5 checksum of a given directory +md5_checksum() { + local dir="${1:?dir missing}" + tar cfP - "${dir}" | md5sum +} + + +# port_cleanup(appname) +port_cleanup() { + local appname="${1:?appname missing}" + rm -rf "${PREFIX_PORT_SRC}" + rm -rf "${PREFIX_PORT_BUILD}/markers/${appname}" +} + + +# should_reconfigure(appname) +# Reconfigures appname build project if patches changed +should_reconfigure() { + local appname="${1:?appname missing}" + + local marker_dir="${PREFIX_PORT_BUILD}/markers/${appname}" + local patch_dir="${PREFIX_PORT}/patches/${appname}" + local built_md5_path="${marker_dir}/built.md5" + + if [ ! -f "${built_md5_path}" ]; then + inner_log "Patch and configure ${appname} from scratch" + port_cleanup "${appname}" + + true + else + patch_md5=$(md5_checksum "${patch_dir}") + if [ "${patch_md5}" = "$(cat "${built_md5_path}")" ]; then + inner_log "${appname} up-to-date, not reconfiguring" + false + else + inner_log "Cleaning ${appname} up after previous patch set" + port_cleanup "${appname}" + + inner_log "Patch and reconfigure ${appname} from scratch" + true + fi + fi +} + + +# mark_as_configured(appname) +# Marks autotools in given appname project as configured +mark_as_configured() { + local appname="${1:?appname missing}" + local marker_dir="${PREFIX_PORT_BUILD}/markers/${appname}" + local patch_dir="${PREFIX_PORT}/patches/${appname}" + local built_md5_path="${marker_dir}/built.md5" + + mkdir -p "${marker_dir}" + md5_checksum "${patch_dir}" > "${built_md5_path}" +} From 9826d6784d639afe49ad34975ef024182879e1d4 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:05:53 +0200 Subject: [PATCH 02/16] tinyx: add tinyx and its dependencies ports JIRA: RTOS-826, RTOS-861 --- tinyx/build.sh | 149 +++++++ .../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, 1951 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 1a22549..4f8f07e 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -91,3 +91,152 @@ mark_as_configured() { mkdir -p "${marker_dir}" md5_checksum "${patch_dir}" > "${built_md5_path}" } + + +_build_xorgproto() { + b_log "tinyx: building xorgproto" + + version="2023.1" + archive_filename="xorgproto-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/xorgproto/${version}" + b_port_download "https://www.x.org/archive/individual/proto/" "${archive_filename}" + + port_cleanup "xorgproto/${version}" + + extract_sources "${PREFIX_PORT_SRC}" + + 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 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 "${PREFIX_PORT_SRC}" + + 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" + + 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 "${PREFIX_PORT_SRC}" + + 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 "${PREFIX_PORT_SRC}" + + 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 +} + + +# FIXME there *should* be a clean way to disable doc building via autotools config +TMP_DIR=$(mktemp -d) + +# 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 5db262c62f48eeb58d96d10f17f366aed9efa472 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:08:23 +0200 Subject: [PATCH 03/16] 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 | 41 +++++++++++++++++++++++++ tinyx/patches/ico/1.0.4/01-ico.c.patch | 31 +++++++++++++++++++ tinyx/patches/ico/1.0.4/02-keysym.patch | 11 +++++++ 3 files changed, 83 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 4f8f07e..524f9a6 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -228,6 +228,43 @@ build_tinyx() { } +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 "${PREFIX_PORT_SRC}" + + 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 +} + + # FIXME there *should* be a clean way to disable doc building via autotools config TMP_DIR=$(mktemp -d) @@ -239,4 +276,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 69f935ae2be8a7f97897034abf32fb3c77fafe26 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:11:53 +0200 Subject: [PATCH 04/16] 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 aed24f7e16645932614efd2049b9ecdecd2b6974 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:18:53 +0200 Subject: [PATCH 05/16] 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 524f9a6..fb16eb0 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 "${PREFIX_PORT_SRC}" + + 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 +} + + # FIXME there *should* be a clean way to disable doc building via autotools config TMP_DIR=$(mktemp -d) @@ -276,6 +299,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 ac5d4383d2c88c29a20f2334d1edf41c4af03e0d Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 2 Sep 2024 10:56:15 +0200 Subject: [PATCH 06/16] 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 2c20597a0e5d3691e14694abe5a19e1fa6ce650f Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:20:03 +0200 Subject: [PATCH 07/16] 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 ++++++ tinyx/patches/st/0.2/06-coloring-fix.patch | 143 ++++++++++++++ 6 files changed, 571 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 create mode 100644 tinyx/patches/st/0.2/06-coloring-fix.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index fb16eb0..838d77d 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -306,5 +306,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) diff --git a/tinyx/patches/st/0.2/06-coloring-fix.patch b/tinyx/patches/st/0.2/06-coloring-fix.patch new file mode 100644 index 0000000..98211eb --- /dev/null +++ b/tinyx/patches/st/0.2/06-coloring-fix.patch @@ -0,0 +1,143 @@ +diff -ruN a/config.def.h b/config.def.h +--- a/config.def.h 2025-01-29 19:10:02.743099213 +0100 ++++ b/config.def.h 2025-01-30 09:19:56.743128381 +0100 +@@ -10,17 +10,17 @@ + "black", + "wheat", + "gray90", +- "LightSteelBlue4", ++ "LightSteelBlue2", + "yellow", +- "#5c5cff", + "green3", +- "yellow3", ++ "green3", ++ "LightSteelBlue2", + "blue2", + "magenta3", + "cyan3", + "gray50", + "green", +- "#5c5cff", ++ "green", + "magenta", + "cyan", + "white" +@@ -28,9 +28,9 @@ + + /* Default colors (colorname index) + foreground, background, cursor */ +-#define DefaultFG 3 ++#define DefaultFG 0 + #define DefaultBG 2 +-#define DefaultCS 3 ++#define DefaultCS 0 + + /* 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 2025-01-29 19:10:02.743099213 +0100 ++++ b/st.c 2025-01-30 10:52:27.932837513 +0100 +@@ -74,7 +74,7 @@ + enum { CURSOR_DEFAULT = 0, CURSOR_HIDE = 1, CURSOR_WRAPNEXT = 2 }; + enum { GLYPH_SET=1, GLYPH_DIRTY=2 }; + enum { MODE_WRAP=1, MODE_INSERT=2, MODE_APPKEYPAD=4, MODE_ALTSCREEN=8, +- MODE_CRLF=16, MODE_MOUSEBTN=32, MODE_MOUSEMOTION=64, MODE_MOUSE=32|64, MODE_REVERSE=128 }; ++ MODE_CRLF=16, MODE_MOUSEBTN=32, MODE_MOUSEMOTION=64, MODE_MOUSE=32|64, MODE_REVERSE=128, MODE_BRCKTPASTE = 1 << 16 }; + enum { ESC_START=1, ESC_CSI=2, ESC_OSC=4, ESC_TITLE=8, ESC_ALTCHARSET=16 }; + enum { WIN_VISIBLE=1, WIN_REDRAW=2, WIN_FOCUSED=4 }; + +@@ -524,7 +524,11 @@ + fprintf(stderr, "Clipboard allocation failed\n"); + return; + } ++ if (IS_SET(MODE_BRCKTPASTE) && ofs == 0) ++ ttywrite("\033[200~", 6); + ttywrite((const char *) data, nitems * format / 8); ++ if (IS_SET(MODE_BRCKTPASTE) && rem == 0) ++ ttywrite("\033[201~", 6); + XFree(data); + /* number of 32-bit chunks returned */ + ofs += nitems * format / 32; +@@ -959,6 +963,7 @@ + void + tclearregion(int x1, int y1, int x2, int y2) { + int x, y, temp; ++ Glyph *gp; + + if(x1 > x2) + temp = x1, x1 = x2, x2 = temp; +@@ -972,8 +977,13 @@ + + for(y = y1; y <= y2; y++) { + term.dirty[y] = 1; +- for(x = x1; x <= x2; x++) +- term.line[y][x].state = 0; ++ for(x = x1; x <= x2; x++) { ++ gp = &term.line[y][x]; ++ gp->fg = term.c.attr.fg; ++ gp->bg = term.c.attr.bg; ++ gp->mode = 0; ++ memcpy(gp->c, " ", 2); ++ } + } + } + +@@ -1090,7 +1100,7 @@ + else if(BETWEEN(attr[i], 90, 97)) + term.c.attr.fg = attr[i] - 90 + 8; + else if(BETWEEN(attr[i], 100, 107)) +- term.c.attr.fg = attr[i] - 100 + 8; ++ term.c.attr.bg = attr[i] - 100 + 8; + else + fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]), csidump(); + +@@ -1231,7 +1241,8 @@ + term.mode &= ~MODE_CRLF; + break; + case 25: +- term.c.state |= CURSOR_HIDE; ++ // FIXME: hidden cursor is not redrawn after unhiding ++ // term.c.state |= CURSOR_HIDE; + break; + case 1000: /* disable X11 xterm mouse reporting */ + term.mode &= ~MODE_MOUSEBTN; +@@ -1304,7 +1315,7 @@ + if(escseq.narg > 1 && escseq.arg[1] != 25) + break; + case 25: +- term.c.state &= ~CURSOR_HIDE; ++ // term.c.state &= ~CURSOR_HIDE; + break; + case 1000: /* 1000,1002: enable xterm mouse report */ + term.mode |= MODE_MOUSEBTN; +@@ -1324,6 +1335,9 @@ + case 1048: + tcursor(CURSOR_SAVE); + break; ++ case 2004: /* 2004: bracketed paste mode */ ++ term.mode |= MODE_BRCKTPASTE; ++ break; + default: goto unknown; + } + } else { +@@ -1813,6 +1827,9 @@ + if(base.mode & ATTR_REVERSE) + temp = xfg, xfg = xbg, xbg = temp; + ++ XSetForeground(xw.dpy, dc.gc, xbg); ++ XFillRectangle(xw.dpy, xw.buf, dc.gc, winx, winy-xw.ch+1, width, xw.ch); ++ + XSetBackground(xw.dpy, dc.gc, xbg); + XSetForeground(xw.dpy, dc.gc, xfg); + +@@ -1853,9 +1870,6 @@ + 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 */ From 3f77ab3b196ffa090b8889a484095e53abc64fdc Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 6 Sep 2024 12:27:08 +0200 Subject: [PATCH 08/16] 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 838d77d..b59b513 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 @@ -302,10 +309,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 74cfdbfe1b0c81425ed6a5f23544a369d373f947 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Fri, 30 Aug 2024 11:40:45 +0200 Subject: [PATCH 09/16] 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 b59b513..6993999 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -318,5 +318,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 7406bb72c784c40efbb691dbd8131c95e23b2878 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Thu, 29 Aug 2024 11:00:50 +0200 Subject: [PATCH 10/16] 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 06d9693386d8f5430866da49f33cca379744de69 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 2 Sep 2024 11:51:50 +0200 Subject: [PATCH 11/16] 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 aeae15a2b3a31d7f70430ecdc4f1ad6068c1a98b Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Wed, 18 Sep 2024 17:04:41 +0200 Subject: [PATCH 12/16] 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 997a59c660c682bff3b7569e999a19bf56b37354 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Wed, 2 Oct 2024 13:17:24 +0200 Subject: [PATCH 13/16] 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 1ad605bbd1d7ae8d9c9abfcf82ff2e5ad5cc37f4 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 7 Oct 2024 12:47:22 +0200 Subject: [PATCH 14/16] 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 6993999..8ba6f36 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 "${PREFIX_PORT_SRC}" + + 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 +} + + # FIXME there *should* be a clean way to disable doc building via autotools config TMP_DIR=$(mktemp -d) @@ -323,4 +363,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]) + From fd02d4205a50332f5ba377f9ce4cc0aee3a0b71a Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 21 Oct 2024 08:39:08 +0200 Subject: [PATCH 15/16] tinyx: add feh port (png-only) Adds a port of feh image viewer with png support from imlib2. The support is hardcoded into imlib2 loaders.c as a workaround for the lack of dynamic lib support (dlopen(), dlsym() etc.) JIRA: RTOS-955 --- tinyx/build.sh | 91 ++++++++++ tinyx/patches/feh/3.10.3/01-no-scandir.patch | 20 +++ tinyx/patches/feh/3.10.3/02-lround.patch | 12 ++ tinyx/patches/feh/3.10.3/03-config.mk.patch | 16 ++ tinyx/patches/feh/3.10.3/04-no-fonts.patch | 47 ++++++ tinyx/patches/feh/3.10.3/05-rint.patch | 12 ++ tinyx/patches/imlib2/1.12.3/01-imlib.patch | 158 ++++++++++++++++++ .../imlib2/1.12.3/02-loaders-no-dl.patch | 141 ++++++++++++++++ 8 files changed, 497 insertions(+) create mode 100644 tinyx/patches/feh/3.10.3/01-no-scandir.patch create mode 100644 tinyx/patches/feh/3.10.3/02-lround.patch create mode 100644 tinyx/patches/feh/3.10.3/03-config.mk.patch create mode 100644 tinyx/patches/feh/3.10.3/04-no-fonts.patch create mode 100644 tinyx/patches/feh/3.10.3/05-rint.patch create mode 100644 tinyx/patches/imlib2/1.12.3/01-imlib.patch create mode 100644 tinyx/patches/imlib2/1.12.3/02-loaders-no-dl.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 8ba6f36..95d5c1f 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -335,6 +335,91 @@ build_xbill() { } +build_freetype() { + appname="freetype" + version="2.13.3" + + b_log "tinyx: building ${appname}" + + archive_filename="${appname}-${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + b_port_download "https://download.savannah.gnu.org/releases/${appname}/" "${archive_filename}" + + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" PLATFORM="unix" \ + CFG="--host="${HOST%phoenix}linux" --bindir="${PREFIX_PROG}" --sbindir="${PREFIX_PROG}" \ + --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" \ + --prefix="${PREFIX_PORT_INSTALL}" --datarootdir="${PREFIX_A}" "${@}" \ + --disable-shared --enable-static --enable-silent-rules --without-brotli --without-harfbuzz" \ + CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" install +} + + +build_imlib2() { + appname="imlib2" + version="1.12.3" + + b_log "tinyx: building ${appname}" + + archive_filename="${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + # TODO find a better source/mirror - wanted to use git.enlightement.org, but their + # tar.gz downloading seems to be dead :( + b_port_download "https://github.com/gijsbers/imlib2/archive/refs/tags/" "${archive_filename}" + + if should_reconfigure "${appname}/${version}"; then + extract_sources "${PREFIX_PORT_SRC}" + + # This is a workaround that adds the contents of png loader module to the + # loaders.c that is then patched with 02-loaders-no-dl.patch. It is here + # until dynamic library support gets merged + cat "${PREFIX_PORT_SRC}/src/modules/loaders/loader_png.c" >> "${PREFIX_PORT_SRC}/src/lib/loaders.c" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure + fi + + mark_as_configured "${appname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" LDFLAGS="${LDFLAGS} -l:libpng.a" + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" install +} + + +build_feh() { + appname="feh" + version="3.10.3" + + b_log "png: building ${appname}" + + archive_filename="${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}/${version}" + + b_port_download "https://github.com/derf/feh/archive/refs/tags/" "${archive_filename}" + + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" + + mkdir -p "${PREFIX_PORT_SRC}/out" + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_SRC}/out" xinerama=0 curl=0 + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_SRC}/out" install + + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/out/bin/${appname}" + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + # FIXME there *should* be a clean way to disable doc building via autotools config TMP_DIR=$(mktemp -d) @@ -367,4 +452,10 @@ build_x11_app xgc 1.0.6 build_xbill +# Image viewer (requires libpng port) + +build_freetype +build_imlib2 +build_feh + rm -rf "$TMP_DIR" diff --git a/tinyx/patches/feh/3.10.3/01-no-scandir.patch b/tinyx/patches/feh/3.10.3/01-no-scandir.patch new file mode 100644 index 0000000..051329a --- /dev/null +++ b/tinyx/patches/feh/3.10.3/01-no-scandir.patch @@ -0,0 +1,20 @@ +diff -ruN a/src/filelist.c b/src/filelist.c +--- a/src/filelist.c 2024-10-18 11:22:12.323252291 +0200 ++++ b/src/filelist.c 2024-10-18 13:13:25.876576966 +0200 +@@ -240,6 +240,8 @@ + } + + if ((S_ISDIR(st.st_mode)) && (level != FILELIST_LAST)) { ++ weprintf("opening directories unsupported"); ++#if 0 + struct dirent **de; + DIR *dir; + int cnt, n; +@@ -283,6 +285,7 @@ + free(de); + } + closedir(dir); ++#endif + } else if (S_ISREG(st.st_mode)) { + D(("Adding regular file %s to filelist\n", path)); + filelist = gib_list_add_front(filelist, feh_file_new(path)); diff --git a/tinyx/patches/feh/3.10.3/02-lround.patch b/tinyx/patches/feh/3.10.3/02-lround.patch new file mode 100644 index 0000000..86c6b05 --- /dev/null +++ b/tinyx/patches/feh/3.10.3/02-lround.patch @@ -0,0 +1,12 @@ +diff -ruN a/src/winwidget.c b/src/winwidget.c +--- a/src/winwidget.c 2024-10-18 11:22:12.326252314 +0200 ++++ b/src/winwidget.c 2024-10-18 11:34:01.967793299 +0200 +@@ -39,6 +39,8 @@ + static void winwidget_register(winwidget win); + static winwidget winwidget_allocate(void); + ++#define lround(x) ((long)round(x)) ++ + + int window_num = 0; /* For window list */ + winwidget *windows = NULL; /* List of windows to loop though */ diff --git a/tinyx/patches/feh/3.10.3/03-config.mk.patch b/tinyx/patches/feh/3.10.3/03-config.mk.patch new file mode 100644 index 0000000..f79c29d --- /dev/null +++ b/tinyx/patches/feh/3.10.3/03-config.mk.patch @@ -0,0 +1,16 @@ +diff -ruN a/config.mk b/config.mk +--- a/config.mk 2024-10-18 11:22:12.317252245 +0200 ++++ b/config.mk 2025-01-28 11:16:47.137332890 +0100 +@@ -1,5 +1,5 @@ + PACKAGE ?= feh +-VERSION ?= ${shell git describe --dirty} ++VERSION ?= 3.10.3 + + app ?= 0 + curl ?= 1 +@@ -112,4 +112,4 @@ + CFLAGS += -DPREFIX=\"${PREFIX}\" \ + -DPACKAGE=\"${PACKAGE}\" -DVERSION=\"${VERSION}\" + +-LDLIBS += -lm -lpng -lX11 -lImlib2 ++LDLIBS += -lm -l:libImlib2.a -l:libpng.a -l:libXext.a -l:libX11.a -l:libz.a -l:libfreetype.a diff --git a/tinyx/patches/feh/3.10.3/04-no-fonts.patch b/tinyx/patches/feh/3.10.3/04-no-fonts.patch new file mode 100644 index 0000000..cc3802d --- /dev/null +++ b/tinyx/patches/feh/3.10.3/04-no-fonts.patch @@ -0,0 +1,47 @@ +diff -ruN a/src/gib_imlib.c b/src/gib_imlib.c +--- a/src/gib_imlib.c 2024-10-18 11:22:12.324252299 +0200 ++++ b/src/gib_imlib.c 2024-10-18 12:08:43.242781146 +0200 +@@ -27,6 +27,8 @@ + #include "utils.h" + #include "debug.h" + ++#define imlib_context_set_angle(a) do {} while (0) ++ + /* + int + gib_imlib_load_image(Imlib_Image * im, char *filename) +diff -ruN a/src/imlib.c b/src/imlib.c +--- a/src/imlib.c 2024-10-18 11:22:12.324252299 +0200 ++++ b/src/imlib.c 2024-10-18 12:09:43.025313887 +0200 +@@ -111,9 +111,11 @@ + + void init_imlib_fonts(void) + { ++#if 0 + /* Set up the font stuff */ + imlib_add_path_to_font_path("."); + imlib_add_path_to_font_path(PREFIX "/share/feh/fonts"); ++#endif + + return; + } +diff -ruN a/src/menu.c b/src/menu.c +--- a/src/menu.c 2024-10-18 11:22:12.325252307 +0200 ++++ b/src/menu.c 2024-10-18 12:10:32.595839790 +0200 +@@ -934,6 +934,7 @@ + + void feh_menu_init_common(void) + { ++#if 0 + int num_desks, i; + char buf[30]; + feh_menu *m; +@@ -1051,7 +1052,7 @@ + } + } + common_menus = 1; +- ++#endif + return; + } + diff --git a/tinyx/patches/feh/3.10.3/05-rint.patch b/tinyx/patches/feh/3.10.3/05-rint.patch new file mode 100644 index 0000000..01b745a --- /dev/null +++ b/tinyx/patches/feh/3.10.3/05-rint.patch @@ -0,0 +1,12 @@ +diff -ruN a/src/menu.c b/src/menu.c +--- a/src/menu.c 2024-10-18 11:22:12.325252307 +0200 ++++ b/src/menu.c 2024-10-18 12:55:33.116616496 +0200 +@@ -48,6 +48,8 @@ + void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short data); + void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i); + ++#define rint(x) ((int)round(x)) ++ + enum { + CB_CLOSE = 1, + CB_EXIT, diff --git a/tinyx/patches/imlib2/1.12.3/01-imlib.patch b/tinyx/patches/imlib2/1.12.3/01-imlib.patch new file mode 100644 index 0000000..6afa905 --- /dev/null +++ b/tinyx/patches/imlib2/1.12.3/01-imlib.patch @@ -0,0 +1,158 @@ +diff -ruN a/src/bin/imlib2_show.c b/src/bin/imlib2_show.c +--- a/src/bin/imlib2_show.c 2024-10-18 14:26:20.397180731 +0200 ++++ b/src/bin/imlib2_show.c 2024-10-18 14:25:49.799547110 +0200 +@@ -13,6 +13,8 @@ + + #include "prog_x11.h" + ++#define mblen(a, b) (-1) ++ + static Window win; + + void progress(Imlib_Image * im, char percent, int update_x, +diff -ruN a/src/lib/dynamic_filters.c b/src/lib/dynamic_filters.c +--- a/src/lib/dynamic_filters.c 2024-10-18 14:26:20.400180697 +0200 ++++ b/src/lib/dynamic_filters.c 2024-10-18 14:25:49.805547033 +0200 +@@ -1,7 +1,7 @@ + #include "common.h" + + #include +-#include ++// #include + #include + #include + #include +@@ -23,6 +23,10 @@ + #define FDEBUG + */ + ++#define dlopen(a, b) (NULL) ++#define dlsym(a, b) (NULL) ++#define dlclose(a) do {} while (0) ++ + static ImlibExternalFilter * + __imlib_LoadFilter(char *file) + { +diff -ruN a/src/lib/x11_grab.c b/src/lib/x11_grab.c +--- a/src/lib/x11_grab.c 2024-10-18 14:26:20.402180675 +0200 ++++ b/src/lib/x11_grab.c 2024-10-18 14:25:49.805547033 +0200 +@@ -4,8 +4,10 @@ + #include + #include + #include ++#if 0 + #include + #include ++#endif + + #include "x11_grab.h" + #include "x11_ximage.h" +diff -ruN a/src/lib/x11_rend.c b/src/lib/x11_rend.c +--- a/src/lib/x11_rend.c 2024-10-18 14:26:20.402180675 +0200 ++++ b/src/lib/x11_rend.c 2024-10-18 14:25:49.804547046 +0200 +@@ -4,7 +4,9 @@ + #include + #include + #include ++#if 0 + #include ++#endif + + #include "blend.h" + #include "colormod.h" +@@ -474,26 +476,32 @@ + gcm = XCreateGC(x11->dpy, m, GCGraphicsExposures, &gcv); + } + /* write the mask */ ++#if 0 + if (shm) + /* write shm XImage */ + XShmPutImage(x11->dpy, m, gcm, mxim, 0, 0, dx, dy, dw, dh, False); + /* write regular XImage */ + else ++#endif + XPutImage(x11->dpy, m, gcm, mxim, 0, 0, dx, dy, dw, dh); + } + + /* write the image */ ++#if 0 + if (shm) + /* write shm XImage */ + XShmPutImage(x11->dpy, w, gc, xim, 0, 0, dx, dy, dw, dh, False); + /* write regular XImage */ + else ++#endif + XPutImage(x11->dpy, w, gc, xim, 0, 0, dx, dy, dw, dh); + + /* free the XImage and put onto our free list */ + /* wait for the write to be done */ ++#if 0 + if (shm) + XSync(x11->dpy, False); ++#endif + __imlib_ConsumeXImage(x11, xim); + if (m) + __imlib_ConsumeXImage(x11, mxim); +diff -ruN a/src/lib/x11_ximage.c b/src/lib/x11_ximage.c +--- a/src/lib/x11_ximage.c 2024-10-18 14:26:20.402180675 +0200 ++++ b/src/lib/x11_ximage.c 2024-10-18 14:25:49.805547033 +0200 +@@ -11,8 +11,10 @@ + #include + #include + #endif ++#if 0 + #include + #include ++#endif + + #include "x11_ximage.h" + +@@ -52,6 +54,9 @@ + static void + ShmCheck(Display *d) + { ++ x_does_shm = 0; ++ return; ++#if 0 + const char *s; + int val; + +@@ -106,6 +111,7 @@ + + printf("%s: list_max_count=%d\n", __func__, list_max_count); + } ++#endif + } + + XImage * +@@ -119,6 +125,7 @@ + + if (!x_does_shm) + return NULL; ++#if 0 + + /* try create an shm image */ + xim = XShmCreateImage(x11->dpy, x11->vis, depth, ZPixmap, NULL, si, w, h); +@@ -236,12 +243,14 @@ + XDestroyImage(xim); + + return NULL; ++#endif + } + + void + __imlib_ShmDestroyXImage(const ImlibContextX11 *x11, XImage *xim, + XShmSegmentInfo *si) + { ++#if 0 + XSync(x11->dpy, False); + XShmDetach(x11->dpy, si); + #ifdef HAVE_X11_SHM_FD +@@ -256,6 +265,7 @@ + shmctl(si->shmid, IPC_RMID, 0); + } + XDestroyImage(xim); ++#endif + } + + void diff --git a/tinyx/patches/imlib2/1.12.3/02-loaders-no-dl.patch b/tinyx/patches/imlib2/1.12.3/02-loaders-no-dl.patch new file mode 100644 index 0000000..6b0fe4a --- /dev/null +++ b/tinyx/patches/imlib2/1.12.3/02-loaders-no-dl.patch @@ -0,0 +1,141 @@ +# This is a workaround that adds the contents of png loader module to the +# loaders.c. It is here until dynamic library support gets merged +# This patch therefore assumes that the loaders.c is appended with +# the contents of src/modules/loaders/loader_png.c i.e. via +# +# cat src/modules/loaders/loader_png.c >> src/lib/loaders.c +# +diff -ruN a/src/lib/loaders.c b/src/lib/loaders.c +--- a/src/lib/loaders.c 2024-10-21 08:47:17.655432152 +0200 ++++ b/src/lib/loaders.c 2024-10-18 15:36:38.778314765 +0200 +@@ -1,6 +1,6 @@ + #include "common.h" + +-#include ++// #include + #include + #include + #include +@@ -11,9 +11,52 @@ + #include "image.h" + #include "loaders.h" + ++const char *const _formats[] = { "png" }; ++ ++#define IMLIB_LOADER_(_fmts, _ldr, _svr, _inex, _flags) \ ++ __EXPORT__ ImlibLoaderModule loader = { \ ++ .ldr_version = IMLIB2_LOADER_VERSION, \ ++ .ldr_flags = _flags, \ ++ .num_formats = ARRAY_SIZE(_fmts), \ ++ .formats = _fmts, \ ++ .inex = _inex, \ ++ .load = _ldr, \ ++ .save = _svr, \ ++ } ++ ++#define IMLIB_LOADER(_fmts, _ldr, _svr) \ ++ IMLIB_LOADER_(_fmts, _ldr, _svr, NULL, 0) ++ ++#define QUIT_WITH_RC(_err) { rc = _err; goto quit; } ++ ++#define PCAST(T, p) ((T)(const void *)(p)) ++ ++#define DC(fmt...) ++#define D(fmt...) ++#define Dx(fmt...) ++#define DL(fmt...) ++ ++typedef struct _ImlibImageFileInfo { ++ struct _ImlibImageFileInfo *next; ++ char *name; ++ FILE *fp; ++ const void *fdata; ++ off_t fsize; ++} ImlibImageFileInfo; ++ ++static int _load(ImlibImage *im, int load_data); ++ ++static int _save(ImlibImage *im); ++ ++IMLIB_LOADER(_formats, _load, _save); ++ + #define DBG_PFX "LOAD" + #define DP(fmt...) DC(DBG_LOAD, fmt) + ++#define dlopen(a, b) (NULL) ++#define dlsym(a, b) (NULL) ++#define dlclose(a) do {} while (0) ++ + static ImlibLoader *loaders = NULL; + static ImlibLoader *loaders_unloaded = NULL; + static char loaders_loaded = 0; +@@ -190,6 +233,7 @@ + goto found; + } + ++#if 0 + l = malloc(sizeof(ImlibLoader)); + if (!l) + goto bail; +@@ -207,6 +251,10 @@ + DP("%s: dlerror: %s\n", __func__, dlerror()); + goto bail; + } ++#endif ++ l = malloc(sizeof(ImlibLoader)); ++ l->handle = NULL; ++ l->module = m = &loader; + + /* Check version and that we have at least load() or save() */ + if (m->ldr_version != IMLIB2_LOADER_VERSION || +@@ -216,7 +264,7 @@ + goto bail; + } + +- l->file = strdup(file); ++ l->file = NULL; + l->name = m->formats[0]; + + found: +@@ -333,11 +381,15 @@ + l = NULL; + if (kl) + { ++#if 0 + dso = __imlib_ModuleFind(__imlib_PathToLoaders(), kl->dso); + l = __imlib_LookupLoaderByModulePath(dso); + if (!l) +- l = __imlib_ProduceLoader(dso); ++#endif ++ l = __imlib_ProduceLoader(NULL); ++#if 0 + free(dso); ++#endif + } + DP("%s: '%s' -> '%s': %p\n", __func__, format, kl ? kl->dso : "-", l); + return l; +@@ -426,16 +478,13 @@ + DP("%s: fmt='%s': %s\n", __func__, format, l ? l->file : "-"); + return l; + } +-#include "config.h" +-#include "Imlib2_Loader.h" ++ + + #include + #include + #include + +-#define DBG_PFX "LDR-png" +- +-static const char *const _formats[] = { "png" }; ++// static const char *const _formats[] = { "png" }; + + #define USE_IMLIB2_COMMENT_TAG 0 + +@@ -1184,5 +1233,3 @@ + + return rc; + } +- +-IMLIB_LOADER(_formats, _load, _save); From 839146a84dc76e94d8276720ead446221d2d6292 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Thu, 20 Feb 2025 12:19:26 +0100 Subject: [PATCH 16/16] update to new xlib --- tinyx/build.sh | 273 +++++++++++++----- tinyx/patches/dwm/5.1/01-Makefile.patch | 2 +- tinyx/patches/feh/3.10.3/03-config.mk.patch | 2 +- .../fontconfig/2.15.0/fontconfig.patch | 71 +++++ tinyx/patches/libICE/1.1.2/libice.patch | 25 ++ tinyx/patches/libX11/1.8/libx11.patch | 25 ++ tinyx/patches/libXaw/1.0.16/libxaw.patch | 20 ++ tinyx/patches/libXext/1.3.6/libxext.patch | 12 + tinyx/patches/libXfont2/2.0.7/libxfont2.patch | 29 ++ .../libXrender/0.9.12/libxrender.patch | 12 + tinyx/patches/libXt/1.3.1/libxt.patch | 26 ++ tinyx/patches/libxcb/1.17.0/libxcb.patch | 51 ++++ tinyx/patches/st/0.2/07-st-info.patch | 177 ++++++++++++ tinyx/patches/st/0.7/st.patch | 111 +++++++ .../tinyx/eed490/16-fix-xdmcp-include.patch | 56 ++++ .../{2023.1 => }/01-include-X11-Xpoll.h.patch | 0 .../xorgproto/2023.1/00-xorgproto.patch | 87 ++++++ .../2023.1/02-include-X11-Xos_r.h.patch | 13 - tinyx/patches/xtrans/1.5.2/xtrans.patch | 36 +++ 19 files changed, 942 insertions(+), 86 deletions(-) create mode 100644 tinyx/patches/fontconfig/2.15.0/fontconfig.patch create mode 100644 tinyx/patches/libICE/1.1.2/libice.patch create mode 100644 tinyx/patches/libX11/1.8/libx11.patch create mode 100644 tinyx/patches/libXaw/1.0.16/libxaw.patch create mode 100644 tinyx/patches/libXext/1.3.6/libxext.patch create mode 100644 tinyx/patches/libXfont2/2.0.7/libxfont2.patch create mode 100644 tinyx/patches/libXrender/0.9.12/libxrender.patch create mode 100644 tinyx/patches/libXt/1.3.1/libxt.patch create mode 100644 tinyx/patches/libxcb/1.17.0/libxcb.patch create mode 100644 tinyx/patches/st/0.2/07-st-info.patch create mode 100644 tinyx/patches/st/0.7/st.patch create mode 100644 tinyx/patches/tinyx/eed490/16-fix-xdmcp-include.patch rename tinyx/patches/xorgproto/{2023.1 => }/01-include-X11-Xpoll.h.patch (100%) create mode 100644 tinyx/patches/xorgproto/2023.1/00-xorgproto.patch delete mode 100644 tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch create mode 100644 tinyx/patches/xtrans/1.5.2/xtrans.patch diff --git a/tinyx/build.sh b/tinyx/build.sh index 95d5c1f..04bd2af 100755 --- a/tinyx/build.sh +++ b/tinyx/build.sh @@ -9,6 +9,9 @@ inner_log() { echo -e "$1" } +# FIXME: libxcb fails to find pkgconfig without this export, why? +export PKG_CONFIG_PATH="${PREFIX_A}/pkgconfig" + # extract_sources(dest_dir_path) extract_sources() { @@ -22,14 +25,24 @@ extract_sources() { } +# set LIBBSD_LIBS/LIBBSD_CFLAGS to whitespace so that '-lbsd' is not included in lib dependencies +exec_configure_no_reconf() { + (cd "${PREFIX_PORT_SRC}" && + "${PREFIX_PORT_SRC}/configure" CFLAGS="-DMALLOC_0_RETURNS_NULL ${CFLAGS}" LDFLAGS="${LDFLAGS}" \ + LIBBSD_LIBS=" " LIBBSD_CFLAGS=" " \ + --host="${HOST%phoenix}linux" --target="${HOST%phoenix}linux" \ + --bindir="${PREFIX_PROG}" --sbindir="${PREFIX_PROG}" \ + --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datarootdir="${PREFIX_A}" \ + --disable-shared --enable-static --disable-specs --enable-silent-rules "${@}" + ) +} + + # exec_configure([configure_opts]) 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" --bindir="${PREFIX_PROG}" --sbindir="${PREFIX_PROG}" \ - --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datarootdir="${PREFIX_A}" "${@}" \ - --disable-shared --enable-static --enable-silent-rules + exec_configure_no_reconf ${@} ) } @@ -92,71 +105,75 @@ mark_as_configured() { md5_checksum "${patch_dir}" > "${built_md5_path}" } +build_xorg_pkg() { + local pkgname="${1:?pkgname missing}" + local version="${2:?version missing}" + local type="${3:?type missing}" + local configure_opts=${@:4} -_build_xorgproto() { - b_log "tinyx: building xorgproto" - - version="2023.1" - archive_filename="xorgproto-${version}.tar.gz" + b_log "tinyx: building ${pkgname}" - PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/xorgproto/${version}" - b_port_download "https://www.x.org/archive/individual/proto/" "${archive_filename}" + local archive_filename="${pkgname}-${version}.tar.gz" - port_cleanup "xorgproto/${version}" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${pkgname}/${version}" + b_port_download "https://www.x.org/archive/individual/${type}/" "${archive_filename}" +if should_reconfigure "${pkgname}/${version}"; then extract_sources "${PREFIX_PORT_SRC}" + b_port_apply_patches "${PREFIX_PORT_SRC}" "${pkgname}/${version}" + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then - exec_configure --disable-specs --docdir="${TMP_DIR}/doc" + exec_configure ${configure_opts} fi - b_port_apply_patches "${PREFIX_PORT_SRC}" "xorgproto/${version}" + mark_as_configured "${pkgname}/${version}" +fi make -C "${PREFIX_PORT_SRC}" make -C "${PREFIX_PORT_SRC}" install - - rm -rf "${PREFIX_H}/GL" # GL headers unnecessary for now } -build_tinyxlib() { - b_log "tinyx: building tinyxlib" +build_a_lib() { + libname="$1" + version="$2" + configure_opts=${@:3} - ref="9862f359a745be8ee8f6505571e09c38e2439c6d" - short_ref=$(echo ${ref} | cut -c -6) - archive_filename="${ref}.tar.gz" + b_log "tinyx: building ${libname}" - PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/tinyxlib/${short_ref}" - b_port_download "https://github.com/idunham/tinyxlib/archive/" "${archive_filename}" + archive_filename="${libname}-${version}.tar.gz" - # TODO move make outside of reconfigure block - if should_reconfigure "tinyxlib/${short_ref}"; then - extract_sources "${PREFIX_PORT_SRC}" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}/${version}" - b_port_apply_patches "${PREFIX_PORT_SRC}" "tinyxlib/${short_ref}" + b_port_download "https://www.x.org/archive/individual/lib/" "${archive_filename}" - # set up a dir for X11 files (currently just for XKeysymDB) - mkdir -p "$PREFIX_SHARE/X11" + if should_reconfigure "${libname}/${version}"; then + extract_sources "${PREFIX_PORT_SRC}" - make -C "${PREFIX_PORT_SRC}" - make -C "${PREFIX_PORT_SRC}" LIBDIR="${PREFIX_A}" INCDIR="${PREFIX_H}" install + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}/${version}" - # 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" + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure ${configure_opts} + fi - # remove sync.h, syncstr.h to avoid conflict with xorgproto - rm "${PREFIX_H}/X11/extensions/sync.h" - rm "${PREFIX_H}/X11/extensions/syncstr.h" + mark_as_configured "${libname}/${version}" + fi - _build_xorgproto + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install - mark_as_configured "tinyxlib/${short_ref}" - fi + if [ ${libname} = "libX11" ]; then + b_install "${PREFIX_A}/X11/locale/compose.dir" /usr/lib/X11/locale + b_install "${PREFIX_A}/X11/locale/locale.dir" /usr/lib/X11/locale + b_install "${PREFIX_A}/X11/locale/locale.alias" /usr/lib/X11/locale + b_install "${PREFIX_A}/X11/locale/C/"* /usr/lib/X11/locale/C + fi } -build_a_lib() { +# TODO: generalize +build_a_lib_xcb() { libname="$1" version="$2" configure_opts=${@:3} @@ -167,7 +184,7 @@ build_a_lib() { PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}/${version}" - b_port_download "https://www.x.org/archive/individual/lib/" "${archive_filename}" + b_port_download "https://www.x.org/archive/individual/xcb/" "${archive_filename}" if should_reconfigure "${libname}/${version}"; then extract_sources "${PREFIX_PORT_SRC}" @@ -251,9 +268,10 @@ build_x11_app() { 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' + sedexpr='s/ -lXaw7/ -l:libXaw7.a/g;s/ -lXt/ -l:libXt.a -l:libXpm.a/g;' + sedexpr+='s/ -lX11/ -l:libXcursor.a -l:libXfixes.a -l:libXrender.a -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libX11.a -l:libxcb.a -l:libXau.a/g;' + sedexpr+='s/ -lXmuu/ -l:libXmuu.a/g;s/ -lXcursor//g;' + sedexpr+='s/ -lXft/ -l:libXft.a -l:libfontconfig.a -l:libexpat.a/g;' find . -name 'Makefile' -print0 | xargs -0 sed -i "${sedexpr}" @@ -315,10 +333,15 @@ build_xbill() { exec_configure --datadir="/usr/share/" fi + # maybe unneeded? -l:libXdmcp.a -l:libXpm.a # 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' + # sedexpr='s/ -lXaw/ -l:libXaw7.a/g;s/ -lXt/ -l:libXt.a/g;' + # sedexpr+='s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libX11.a/g;' + # sedexpr+='s/ -lXmuu/ -l:libXmuu.a -l:libXcursor.a -l:libXrender.a/g;s/ -lXcursor//g' + sedexpr='s/ -lXaw/ -l:libXaw7.a/g;s/ -lXt/ -l:libXt.a -l:libXpm.a/g;' + sedexpr+='s/ -lX11/ -l:libXcursor.a -l:libXfixes.a -l:libXrender.a -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libX11.a -l:libxcb.a -l:libXau.a/g;' + sedexpr+='s/ -lXmuu/ -l:libXmuu.a/g;s/ -lXcursor//g;' + sedexpr+='s/ -lXft/ -l:libXft.a -l:libfontconfig.a -l:libexpat.a/g;' find . -name 'Makefile' -print0 | xargs -0 sed -i "${sedexpr}" @@ -384,7 +407,7 @@ build_imlib2() { b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}/${version}" if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then - exec_configure + exec_configure --x-includes="${PREFIX_H}/X11" --x-libraries="${PREFIX_A}" fi mark_as_configured "${appname}/${version}" @@ -420,42 +443,150 @@ build_feh() { } +build_expat() { + libname="expat" + version="2.6.4" + 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://github.com/libexpat/libexpat/releases/download/R_2_6_4/" "${archive_filename}" + + if should_reconfigure "${libname}/${version}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure_no_reconf ${configure_opts} + fi + + mark_as_configured "${libname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install +} + + +build_fontconfig() { + libname="fontconfig" + version="2.15.0" + + b_log "tinyx: building ${libname}" + + archive_filename="${libname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}/${version}" + + b_port_download "https://www.freedesktop.org/software/fontconfig/release/" "${archive_filename}" + + if should_reconfigure "${libname}/${version}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}/${version}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure_no_reconf --prefix="${PREFIX_PORT_SRC}" --localstatedir="/var" + fi + + mark_as_configured "${libname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install + + b_install "${PREFIX_PORT_SRC}/fc-list/fc-list" /usr/bin + + # FIXME: use X11 fonts in st config + b_install "${HOME}/Downloads/LiberationMono-Regular.ttf" /usr/share/fonts + + # b_install "${PREFIX_PORT_SRC}/etc/fonts/fonts.conf" /etc/fonts + # b_install "${PREFIX_PORT_SRC}/etc/fonts/conf.d/"* /etc/fonts/conf.d +} + + # FIXME there *should* be a clean way to disable doc building via autotools config TMP_DIR=$(mktemp -d) -# Build xlib and xserver (call ordering is important here) +# +# Build xlib (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_xorg_pkg xorgproto 2023.1 proto --disable-specs --docdir="${TMP_DIR}/doc" +build_xorg_pkg xextproto 7.3.0 proto --disable-specs --docdir="${TMP_DIR}/doc" +build_xorg_pkg xbitmaps 1.1.2 data +build_a_lib libXau 1.0.12 -build_tinyx +# FIXME: set pyexecdir instead of shotgunning prefix +build_xorg_pkg xcb-proto 1.17.0 xcb --docdir="${TMP_DIR}/doc" --prefix="${PREFIX_PORT_BUILD}/xcb-proto/1.17.0" --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datadir="${PREFIX_H}" + +build_a_lib_xcb libxcb 1.17.0 + +build_a_lib xtrans 1.5.2 -# Build window managers +build_a_lib libX11 1.8 + +build_a_lib libXext 1.3.6 + +build_a_lib libfontenc 1.1.8 +build_freetype +build_a_lib libXfont 1.5.4 # used by tinyx (sigh) +build_a_lib libXfont2 2.0.7 # requires libpng -build_suckless dwm 5.1 -build_x11_app twm 1.0.12 # requires yacc +build_a_lib libICE 1.1.2 +build_a_lib libSM 1.0.0 +build_a_lib libXt 1.3.1 +build_a_lib libXmu 1.2.1 +build_a_lib libXrender 0.9.12 +build_a_lib libXfixes 6.0.1 +build_a_lib libXcursor 1.2.3 + +build_a_lib libXpm 3.5.17 +build_a_lib libXaw 1.0.16 + +build_expat +build_fontconfig # requires gperf on host +build_a_lib libXft 2.3.8 + +# +# Finally build xserver +# +build_tinyx + +# # Build client apps +# -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 -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 +# Window managers +build_suckless dwm 5.1 +build_x11_app twm 1.0.12 # requires yacc -# Fun stuff +# FIXME: st 0.7 currently crashes during draw attempt, 0.2 is patched but is too old to build with new libx11 +# build_suckless st 0.7 -build_xbill +build_x11_app ico 1.0.4 # requires gettext +build_x11_app xmessage 1.0.7 -# Image viewer (requires libpng port) +# FIXME: xclock has some xkbfile related issues (maybe XKB def is wrongly set?) +build_x11_app xclock 1.1.1 --without-xft --without-xkb -build_freetype -build_imlib2 +build_x11_app xeyes 1.1.1 +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 + +# Fun stuff +build_xbill + +# Image viewer +build_imlib2 # requires freetype build_feh rm -rf "$TMP_DIR" diff --git a/tinyx/patches/dwm/5.1/01-Makefile.patch b/tinyx/patches/dwm/5.1/01-Makefile.patch index b9cb8c0..4591daa 100644 --- a/tinyx/patches/dwm/5.1/01-Makefile.patch +++ b/tinyx/patches/dwm/5.1/01-Makefile.patch @@ -20,7 +20,7 @@ diff -ruN a/config.mk b/config.mk -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 ++LIBS = -L${PREFIX_A} -l:libX11.a -l:libphoenix.a -l:libxcb.a -l:libXau.a # flags -CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} diff --git a/tinyx/patches/feh/3.10.3/03-config.mk.patch b/tinyx/patches/feh/3.10.3/03-config.mk.patch index f79c29d..58d2151 100644 --- a/tinyx/patches/feh/3.10.3/03-config.mk.patch +++ b/tinyx/patches/feh/3.10.3/03-config.mk.patch @@ -13,4 +13,4 @@ diff -ruN a/config.mk b/config.mk -DPACKAGE=\"${PACKAGE}\" -DVERSION=\"${VERSION}\" -LDLIBS += -lm -lpng -lX11 -lImlib2 -+LDLIBS += -lm -l:libImlib2.a -l:libpng.a -l:libXext.a -l:libX11.a -l:libz.a -l:libfreetype.a ++LDLIBS += -lm -l:libImlib2.a -l:libpng.a -l:libXext.a -l:libX11.a -l:libz.a -l:libfreetype.a -l:libxcb.a -l:libXau.a diff --git a/tinyx/patches/fontconfig/2.15.0/fontconfig.patch b/tinyx/patches/fontconfig/2.15.0/fontconfig.patch new file mode 100644 index 0000000..e9fafbd --- /dev/null +++ b/tinyx/patches/fontconfig/2.15.0/fontconfig.patch @@ -0,0 +1,71 @@ +diff -ruN a/src/fccache.c b/src/fccache.c +--- a/src/fccache.c 2025-02-20 13:18:29.168121587 +0100 ++++ b/src/fccache.c 2025-02-20 13:23:21.910668257 +0100 +@@ -1035,6 +1035,10 @@ + FcCacheObjectDereference (cache); + } + ++ ++#define timercmp_ph(a, b, CMP) \ ++ (((a)->tv_sec == (b)->tv_sec && (a)->tv_usec CMP (b)->tv_usec) || (a)->tv_sec CMP (b)->tv_sec) ++ + static FcBool + FcDirCacheMapHelper (FcConfig *config, int fd, struct stat *fd_stat, struct stat *dir_stat, struct timeval *latest_cache_mtime, void *closure) + { +@@ -1053,25 +1057,25 @@ + dir_mtime.tv_usec = 0; + #endif + /* special take care of OSTree */ +- if (!timercmp (&zero_mtime, &dir_mtime, !=)) ++ if (!timercmp_ph (&zero_mtime, &dir_mtime, !=)) + { +- if (!timercmp (&zero_mtime, &cache_mtime, !=)) ++ if (!timercmp_ph (&zero_mtime, &cache_mtime, !=)) + { + if (*((FcCache **) closure)) + FcDirCacheUnload (*((FcCache **) closure)); + } +- else if (*((FcCache **) closure) && !timercmp (&zero_mtime, latest_cache_mtime, !=)) ++ else if (*((FcCache **) closure) && !timercmp_ph (&zero_mtime, latest_cache_mtime, !=)) + { + FcDirCacheUnload (cache); + return FcFalse; + } +- else if (timercmp (latest_cache_mtime, &cache_mtime, <)) ++ else if (timercmp_ph (latest_cache_mtime, &cache_mtime, <)) + { + if (*((FcCache **) closure)) + FcDirCacheUnload (*((FcCache **) closure)); + } + } +- else if (timercmp (latest_cache_mtime, &cache_mtime, <)) ++ else if (timercmp_ph (latest_cache_mtime, &cache_mtime, <)) + { + if (*((FcCache **) closure)) + FcDirCacheUnload (*((FcCache **) closure)); +diff -ruN a/src/fccompat.c b/src/fccompat.c +--- a/src/fccompat.c 2025-02-20 13:18:29.169121576 +0100 ++++ b/src/fccompat.c 2025-02-20 13:25:54.886919723 +0100 +@@ -209,7 +209,7 @@ + #else + random_r (&fcrandbuf, &result); + #endif +-#elif HAVE_RANDOM ++#elif HAVE_RANDOM && !defined(__phoenix__) + static char statebuf[256]; + char *state; + static FcBool initialized = FcFalse; +diff -ruN a/src/fcxml.c b/src/fcxml.c +--- a/src/fcxml.c 2025-02-20 13:18:29.170121564 +0100 ++++ b/src/fcxml.c 2025-02-20 14:03:02.194536995 +0100 +@@ -27,6 +27,10 @@ + #include + #include + ++#ifdef __phoenix__ ++#include ++#endif ++ + #ifdef HAVE_DIRENT_H + #include + #endif diff --git a/tinyx/patches/libICE/1.1.2/libice.patch b/tinyx/patches/libICE/1.1.2/libice.patch new file mode 100644 index 0000000..0e8d305 --- /dev/null +++ b/tinyx/patches/libICE/1.1.2/libice.patch @@ -0,0 +1,25 @@ +diff -ruN a/src/iceauth.c b/src/iceauth.c +--- a/src/iceauth.c 2025-02-20 10:30:27.381904891 +0100 ++++ b/src/iceauth.c 2025-02-20 10:31:06.062301524 +0100 +@@ -65,7 +65,9 @@ + } + #else /* ITIMER_REAL */ + { ++#ifndef __phoenix__ + long time (); ++#endif + ldata[0] = time ((long *) 0); + ldata[1] = getpid (); + } +diff -ruN a/src/process.c b/src/process.c +--- a/src/process.c 2025-02-20 10:30:27.381904891 +0100 ++++ b/src/process.c 2025-02-20 10:34:30.229255389 +0100 +@@ -67,7 +67,7 @@ + return (0);\ + } + +-#ifndef HAVE_ASPRINTF ++#if !defined(HAVE_ASPRINTF) && !defined(__phoenix__) + # include + + /* sprintf variant found in newer libc's which allocates string to print to */ diff --git a/tinyx/patches/libX11/1.8/libx11.patch b/tinyx/patches/libX11/1.8/libx11.patch new file mode 100644 index 0000000..6824c92 --- /dev/null +++ b/tinyx/patches/libX11/1.8/libx11.patch @@ -0,0 +1,25 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2025-02-19 14:48:18.276317308 +0100 ++++ b/configure.ac 2025-02-19 14:50:53.284078776 +0100 +@@ -397,8 +397,6 @@ + XERRORDB="${X11_DATADIR}/XErrorDB" + AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database]) + +-XORG_CHECK_MALLOC_ZERO +- + AC_CONFIG_FILES([Makefile + include/Makefile + man/Makefile +diff -ruN a/include/X11/Xlibint.h b/include/X11/Xlibint.h +--- a/include/X11/Xlibint.h 2025-02-19 14:48:18.273317311 +0100 ++++ b/include/X11/Xlibint.h 2025-02-19 16:12:03.524420538 +0100 +@@ -1441,4 +1441,9 @@ + + _XFUNCPROTOEND + ++#ifdef __phoenix__ ++#define mbtowc(pwc, str_ptr, n) (-1) ++#define mblen(a, b) (-1) ++#endif ++ + #endif /* _X11_XLIBINT_H_ */ diff --git a/tinyx/patches/libXaw/1.0.16/libxaw.patch b/tinyx/patches/libXaw/1.0.16/libxaw.patch new file mode 100644 index 0000000..a90789c --- /dev/null +++ b/tinyx/patches/libXaw/1.0.16/libxaw.patch @@ -0,0 +1,20 @@ +diff -ruN a/src/XawI18n.h b/src/XawI18n.h +--- a/src/XawI18n.h 2025-02-21 13:42:01.414732516 +0100 ++++ b/src/XawI18n.h 2025-02-21 15:19:48.321243638 +0100 +@@ -34,9 +34,16 @@ + #endif + #endif + ++#ifdef __phoenix__ ++/* no real utf8/wchar support on phoenix */ ++#define USE_XWCHAR_STRING ++#define USE_XMBTOWC ++typedef unsigned int wint_t; ++#else + #ifdef HAVE_WCHAR_H + #include + #endif ++#endif + + #include + diff --git a/tinyx/patches/libXext/1.3.6/libxext.patch b/tinyx/patches/libXext/1.3.6/libxext.patch new file mode 100644 index 0000000..a61154c --- /dev/null +++ b/tinyx/patches/libXext/1.3.6/libxext.patch @@ -0,0 +1,12 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2025-02-19 16:26:51.644525039 +0100 ++++ b/configure.ac 2025-02-19 16:27:09.924987341 +0100 +@@ -28,7 +28,7 @@ + XORG_WITH_FOP + XORG_WITH_XSLTPROC + XORG_CHECK_SGML_DOCTOOLS(1.8) +-XORG_CHECK_MALLOC_ZERO ++# XORG_CHECK_MALLOC_ZERO + + # Determine .so library version per platform + # based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl diff --git a/tinyx/patches/libXfont2/2.0.7/libxfont2.patch b/tinyx/patches/libXfont2/2.0.7/libxfont2.patch new file mode 100644 index 0000000..267da73 --- /dev/null +++ b/tinyx/patches/libXfont2/2.0.7/libxfont2.patch @@ -0,0 +1,29 @@ +diff -ruN a/src/fc/fslibos.h b/src/fc/fslibos.h +--- a/src/fc/fslibos.h 2025-02-19 14:42:00.979117191 +0100 ++++ b/src/fc/fslibos.h 2025-02-19 14:46:09.751396785 +0100 +@@ -43,6 +43,11 @@ + * makedepend screws up on #undef OPEN_MAX, so we define a new symbol + */ + ++#ifdef __phoenix__ ++#include ++#define NOFILES_MAX RLIMIT_NOFILE ++#endif ++ + # ifndef FONT_OPEN_MAX + + # ifdef _POSIX_SOURCE +diff -ruN a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c +--- a/src/fontfile/dirfile.c 2025-02-19 14:42:00.983117201 +0100 ++++ b/src/fontfile/dirfile.c 2025-02-19 14:43:10.974265983 +0100 +@@ -51,6 +51,10 @@ + #define O_CLOEXEC 0 + #endif + ++#ifdef __phoenix__ ++#define O_NOFOLLOW 0 ++#endif ++ + static Bool AddFileNameAliases ( FontDirectoryPtr dir ); + static int ReadFontAlias ( char *directory, Bool isFile, + FontDirectoryPtr *pdir ); diff --git a/tinyx/patches/libXrender/0.9.12/libxrender.patch b/tinyx/patches/libXrender/0.9.12/libxrender.patch new file mode 100644 index 0000000..5406f5d --- /dev/null +++ b/tinyx/patches/libXrender/0.9.12/libxrender.patch @@ -0,0 +1,12 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2025-02-20 10:54:25.943211268 +0100 ++++ b/configure.ac 2025-02-20 10:54:39.329650568 +0100 +@@ -50,7 +50,7 @@ + [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) + XORG_MACROS_VERSION(1.8) + XORG_DEFAULT_OPTIONS +-XORG_CHECK_MALLOC_ZERO ++# XORG_CHECK_MALLOC_ZERO + + # Check render configuration, strip extra digits from package version to + # find the required protocol version diff --git a/tinyx/patches/libXt/1.3.1/libxt.patch b/tinyx/patches/libXt/1.3.1/libxt.patch new file mode 100644 index 0000000..0aa692d --- /dev/null +++ b/tinyx/patches/libXt/1.3.1/libxt.patch @@ -0,0 +1,26 @@ +diff -ruN a/configure.ac b/configure.ac +--- a/configure.ac 2025-02-19 17:21:09.341698355 +0100 ++++ b/configure.ac 2025-02-19 17:21:28.960697839 +0100 +@@ -45,7 +45,6 @@ + [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])]) + XORG_MACROS_VERSION(1.16) + XORG_DEFAULT_OPTIONS +-XORG_CHECK_MALLOC_ZERO + XORG_ENABLE_SPECS + XORG_WITH_XMLTO(0.0.20) + XORG_WITH_FOP +diff -ruN a/src/NextEvent.c b/src/NextEvent.c +--- a/src/NextEvent.c 2025-02-19 17:21:09.317698417 +0100 ++++ b/src/NextEvent.c 2025-02-20 11:20:53.456151663 +0100 +@@ -369,6 +369,11 @@ + IoWait(wait_times_ptr_t wt, wait_fds_ptr_t wf) + { + #ifdef USE_POLL ++#ifdef __phoenix__ ++ if (wt->poll_wait == -1) { ++ wt->poll_wait = 100; ++ } ++#endif + return poll(wf->fdlist, (nfds_t) wf->fdlistlen, wt->poll_wait); + #else + return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask, diff --git a/tinyx/patches/libxcb/1.17.0/libxcb.patch b/tinyx/patches/libxcb/1.17.0/libxcb.patch new file mode 100644 index 0000000..f8877b8 --- /dev/null +++ b/tinyx/patches/libxcb/1.17.0/libxcb.patch @@ -0,0 +1,51 @@ +diff -ruN a/src/xcb_conn.c b/src/xcb_conn.c +--- a/src/xcb_conn.c 2025-02-19 15:17:38.977170598 +0100 ++++ b/src/xcb_conn.c 2025-02-20 11:52:16.034294036 +0100 +@@ -507,7 +507,13 @@ + pthread_mutex_unlock(&c->iolock); + do { + #if USE_POLL ++#ifdef __phoenix__ ++ do { ++ ret = poll(&fd, 1, 10); ++ } while (ret == 0); ++#else + ret = poll(&fd, 1, -1); ++#endif + /* If poll() returns an event we didn't expect, such as POLLNVAL, treat + * it as if it failed. */ + if(ret >= 0 && (fd.revents & ~fd.events)) +diff -ruN a/src/xcb_in.c b/src/xcb_in.c +--- a/src/xcb_in.c 2025-02-19 15:17:38.978170594 +0100 ++++ b/src/xcb_in.c 2025-02-20 11:52:30.922356775 +0100 +@@ -391,7 +391,13 @@ + pfd.events = POLLIN; + pfd.revents = 0; + do { +- ret = poll(&pfd, 1, -1); ++#ifdef __phoenix__ ++ do { ++ ret = poll(&pfd, 1, 10); ++ } while (ret == 0); ++#else ++ ret = poll(&pfd, 1, -1); ++#endif + } while (ret == -1 && errno == EINTR); + #else + fd_set fds; +diff -ruN a/src/xcbint.h b/src/xcbint.h +--- a/src/xcbint.h 2025-02-19 15:17:38.979170589 +0100 ++++ b/src/xcbint.h 2025-02-19 15:20:45.620359596 +0100 +@@ -48,6 +48,12 @@ + # define XCB_ALLOW_FALLTHRU /* FALLTHRU */ + #endif + ++#ifdef __phoenix__ ++#include ++#define MSG_TRUNC 0 ++#define MSG_CTRUNC 0 ++#endif ++ + enum workarounds { + WORKAROUND_NONE, + WORKAROUND_GLX_GET_FB_CONFIGS_BUG, diff --git a/tinyx/patches/st/0.2/07-st-info.patch b/tinyx/patches/st/0.2/07-st-info.patch new file mode 100644 index 0000000..1986766 --- /dev/null +++ b/tinyx/patches/st/0.2/07-st-info.patch @@ -0,0 +1,177 @@ +diff -ruN a/st.info b/st.info +--- a/st.info 2025-02-18 18:15:58.157534152 +0100 ++++ b/st.info 2025-02-18 18:16:53.495807257 +0100 +@@ -3,9 +3,9 @@ + st| simpleterm, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + am, +-# bce, ++ bce, + bel=^G, +-# blink=\E[5m, ++ blink=\E[5m, + bold=\E[1m, + cbt=\E[Z, + cvvis=\E[?25h, +@@ -33,6 +33,7 @@ + ed=\E[J, + el=\E[K, + el1=\E[1K, ++ enacs=\E)0, + flash=\E[?5h\E[?5l, + fsl=^G, + home=\E[H, +@@ -46,22 +47,37 @@ + ind=^J, + indn=\E[%p1%dS, + invis=\E[8m, ++ is2=\E[4l\E>\E[?1034l, + it#8, ++ kel=\E[1;2F, ++ ked=\E[1;5F, ++ ka1=\E[1~, ++ ka3=\E[5~, ++ kc1=\E[4~, ++ kc3=\E[6~, + kbs=\177, +- kcub1=\E[D, +- kcud1=\E[B, +- kcuf1=\E[C, +- kcuu1=\E[A, +- kLFT=\E[d, +- kRIT=\E[c, +- kind=\E[a, +- kri=\E[b, ++ kcbt=\E[Z, ++ kb2=\EOu, ++ kcub1=\EOD, ++ kcud1=\EOB, ++ kcuf1=\EOC, ++ kcuu1=\EOA, ++ kDC=\E[3;2~, ++ kent=\EOM, ++ kEND=\E[1;2F, ++ kIC=\E[2;2~, ++ kNXT=\E[6;2~, ++ kPRV=\E[5;2~, ++ kHOM=\E[1;2H, ++ kLFT=\E[1;2D, ++ kRIT=\E[1;2C, ++ kind=\E[1;2B, ++ kri=\E[1;2A, ++ kclr=\E[3;5~, ++ kdl1=\E[3;2~, + kdch1=\E[3~, + kich1=\E[2~, + kend=\E[4~, +- kf10=\E[21~, +- kf11=\E[23~, +- kf12=\E[24~, + kf1=\EOP, + kf2=\EOQ, + kf3=\EOR, +@@ -71,7 +87,64 @@ + kf7=\E[18~, + kf8=\E[19~, + kf9=\E[20~, ++ kf10=\E[21~, ++ kf11=\E[23~, ++ kf12=\E[24~, ++ kf13=\E[1;2P, ++ kf14=\E[1;2Q, ++ kf15=\E[1;2R, ++ kf16=\E[1;2S, ++ kf17=\E[15;2~, ++ kf18=\E[17;2~, ++ kf19=\E[18;2~, ++ kf20=\E[19;2~, ++ kf21=\E[20;2~, ++ kf22=\E[21;2~, ++ kf23=\E[23;2~, ++ kf24=\E[24;2~, ++ kf25=\E[1;5P, ++ kf26=\E[1;5Q, ++ kf27=\E[1;5R, ++ kf28=\E[1;5S, ++ kf29=\E[15;5~, ++ kf30=\E[17;5~, ++ kf31=\E[18;5~, ++ kf32=\E[19;5~, ++ kf33=\E[20;5~, ++ kf34=\E[21;5~, ++ kf35=\E[23;5~, ++ kf36=\E[24;5~, ++ kf37=\E[1;6P, ++ kf38=\E[1;6Q, ++ kf39=\E[1;6R, ++ kf40=\E[1;6S, ++ kf41=\E[15;6~, ++ kf42=\E[17;6~, ++ kf43=\E[18;6~, ++ kf44=\E[19;6~, ++ kf45=\E[20;6~, ++ kf46=\E[21;6~, ++ kf47=\E[23;6~, ++ kf48=\E[24;6~, ++ kf49=\E[1;3P, ++ kf50=\E[1;3Q, ++ kf51=\E[1;3R, ++ kf52=\E[1;3S, ++ kf53=\E[15;3~, ++ kf54=\E[17;3~, ++ kf55=\E[18;3~, ++ kf56=\E[19;3~, ++ kf57=\E[20;3~, ++ kf58=\E[21;3~, ++ kf59=\E[23;3~, ++ kf60=\E[24;3~, ++ kf61=\E[1;4P, ++ kf62=\E[1;4Q, ++ kf63=\E[1;4R, + khome=\E[1~, ++ kil1=\E[2;5~, ++ krmir=\E[2;2~, ++ kich1=\E[2~, + knp=\E[6~, + kmous=\E[M, + kpp=\E[5~, +@@ -84,23 +157,37 @@ + rc=\E8, + rev=\E[7m, + ri=\EM, ++ ritm=\E[23m, + rmacs=\E(B, + rmcup=\E[?1049l, +- rmso=\E[m, ++ rmir=\E[4l, ++ rmkx=\E[?1l\E>, ++ rmm=\E[?1034l, ++ rmso=\E[27m, + rmul=\E[m, ++ rs1=\Ec, ++ rs2=\E[4l\E>\E[?1034l, + sc=\E7, + setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, ++ setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, ++ setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + sgr0=\E[0m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, ++ sitm=\E[3m, + smacs=\E(0, + smcup=\E[?1049h, ++ smir=\E[4h, ++ smkx=\E[?1h\E=, ++ smm=\E[?1034h, + smso=\E[7m, + smul=\E[4m, +- tbc=\E[2g, ++ tbc=\E[3g, + tsl=\E]0;, + ul, + xenl, ++ vpa=\E[%i%p1%dd, ++ + + st-256color| simpleterm with 256 colors, + use=st, diff --git a/tinyx/patches/st/0.7/st.patch b/tinyx/patches/st/0.7/st.patch new file mode 100644 index 0000000..0311b7b --- /dev/null +++ b/tinyx/patches/st/0.7/st.patch @@ -0,0 +1,111 @@ +diff -ruN a/config.mk b/config.mk +--- a/config.mk 2025-02-20 18:57:25.613701469 +0100 ++++ b/config.mk 2025-02-20 19:01:34.898720872 +0100 +@@ -4,19 +4,17 @@ + # 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} \ ++INCS = -I. -I${PREFIX_H} \ + `pkg-config --cflags fontconfig` \ + `pkg-config --cflags freetype2` +-LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \ ++LIBS = -L${PREFIX_A} -l:libXext.a -l:libXft.a -l:libXrender.a -l:libX11.a -l:libxcb.a -l:libXau.a -l:libphoenix.a \ + `pkg-config --libs fontconfig` \ +- `pkg-config --libs freetype2` ++ `pkg-config --libs freetype2` \ ++ `pkg-config --libs expat` + + # flags + CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600 +diff -ruN a/st.c b/st.c +--- a/st.c 2025-02-20 18:57:25.613701469 +0100 ++++ b/st.c 2025-02-20 19:13:34.180383688 +0100 +@@ -1387,6 +1387,9 @@ + exit(0); + } + ++#ifndef _POSIX_ARG_MAX ++#define _POSIX_ARG_MAX 100 ++#endif + + void + stty(void) +@@ -1436,9 +1439,25 @@ + return; + } + ++#ifdef __phoenix__ ++ 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"); ++#else + /* seems to work fine on linux, openbsd and freebsd */ + if (openpty(&m, &s, NULL, NULL, &w) < 0) + die("openpty failed: %s\n", strerror(errno)); ++#endif + + switch (pid = fork()) { + case -1: +@@ -1513,7 +1532,7 @@ + FD_SET(cmdfd, &rfd); + + /* Check if we can write. */ +- if (pselect(cmdfd+1, &rfd, &wfd, NULL, NULL, NULL) < 0) { ++ if (select(cmdfd+1, &rfd, &wfd, NULL, NULL) < 0) { + if (errno == EINTR) + continue; + die("select failed: %s\n", strerror(errno)); +@@ -2931,10 +2950,14 @@ + + control = ISCONTROL(u); + len = utf8encode(u, c); ++#ifdef __phoenix__ ++ width = 1; ++#else + if (!control && (width = wcwidth(u)) == -1) { + memcpy(c, "\357\277\275", 4); /* UTF_INVALID */ + width = 1; + } ++#endif + + if (IS_SET(MODE_PRINT)) + tprinter(c, len); +@@ -4219,6 +4242,7 @@ + int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0; + struct timespec drawtimeout, *tv = NULL, now, last, lastblink; + long deltatime; ++ struct timeval tvv; + + /* Waiting for window mapping */ + do { +@@ -4248,7 +4272,10 @@ + FD_SET(cmdfd, &rfd); + FD_SET(xfd, &rfd); + +- if (pselect(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { ++ tvv.tv_sec = tv->tv_sec; ++ tvv.tv_usec = tv->tv_nsec / 1000; ++ ++ if (select(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, &tvv) < 0) { + if (errno == EINTR) + continue; + die("select failed: %s\n", strerror(errno)); diff --git a/tinyx/patches/tinyx/eed490/16-fix-xdmcp-include.patch b/tinyx/patches/tinyx/eed490/16-fix-xdmcp-include.patch new file mode 100644 index 0000000..2fc8733 --- /dev/null +++ b/tinyx/patches/tinyx/eed490/16-fix-xdmcp-include.patch @@ -0,0 +1,56 @@ +diff -ruN a/mi/miinitext.c b/mi/miinitext.c +--- a/mi/miinitext.c 2025-02-19 16:36:51.391001828 +0100 ++++ b/mi/miinitext.c 2025-02-19 17:03:08.693627096 +0100 +@@ -90,8 +90,10 @@ + + #define _XSHM_SERVER_ + #include ++#ifndef __phoenix__ + #define _XTEST_SERVER_ + #include ++#endif + #ifdef XF86BIGFONT + #include + #endif +diff -ruN a/os/osdep.h b/os/osdep.h +--- a/os/osdep.h 2025-02-19 16:36:51.404002187 +0100 ++++ b/os/osdep.h 2025-02-19 16:41:52.639244394 +0100 +@@ -61,7 +61,9 @@ + #define MAXBUFSIZE (1 << 22) + #endif + ++#ifdef XDMCP + #include ++#endif + + #ifdef _POSIX_SOURCE + #include +@@ -109,10 +111,12 @@ + + #include + ++#ifdef XDMCP + typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); + typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); + typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name, + unsigned data_length, char *data); ++#endif + + typedef struct _connectionInput { + struct _connectionInput *next; +@@ -245,6 +249,7 @@ + /* in secauth.c */ + extern XID AuthSecurityCheck (AuthCheckArgs); + ++#ifdef XDMCP + /* in xdmcp.c */ + extern void XdmcpUseMsg (void); + extern int XdmcpOptions(int argc, char **argv, int i); +@@ -273,6 +278,7 @@ + + struct sockaddr_in; + extern void XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr); ++#endif + + #ifdef HASXDMAUTH + extern void XdmAuthenticationInit (const char *cookie, int cookie_length); diff --git a/tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch b/tinyx/patches/xorgproto/01-include-X11-Xpoll.h.patch similarity index 100% rename from tinyx/patches/xorgproto/2023.1/01-include-X11-Xpoll.h.patch rename to tinyx/patches/xorgproto/01-include-X11-Xpoll.h.patch diff --git a/tinyx/patches/xorgproto/2023.1/00-xorgproto.patch b/tinyx/patches/xorgproto/2023.1/00-xorgproto.patch new file mode 100644 index 0000000..5f02e83 --- /dev/null +++ b/tinyx/patches/xorgproto/2023.1/00-xorgproto.patch @@ -0,0 +1,87 @@ +diff -ruN a/include/X11/Xalloca.h b/include/X11/Xalloca.h +--- a/include/X11/Xalloca.h 2025-02-19 14:55:32.463374051 +0100 ++++ b/include/X11/Xalloca.h 2025-02-20 10:36:36.613372018 +0100 +@@ -65,6 +65,7 @@ + #endif + + #ifdef INCLUDE_ALLOCA_H ++# include + # include + #endif + +diff -ruN a/include/X11/Xos_r.h b/include/X11/Xos_r.h +--- a/include/X11/Xos_r.h 2025-02-19 14:58:24.895819569 +0100 ++++ b/include/X11/Xos_r.h 2025-02-19 15:32:44.236582491 +0100 +@@ -248,7 +248,7 @@ + */ + + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ +- defined(__APPLE__) || defined(__DragonFly__) ++ defined(__APPLE__) || defined(__DragonFly__) || defined(__phoenix__) + static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) + { + memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)); +@@ -261,11 +261,17 @@ + (p).len = strlen((p).pwp->pw_passwd); + strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd); + ++#if !defined(__phoenix__) + (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1; + (p).len = strlen((p).pwp->pw_class); + strcpy((p).pws.pw_class, (p).pwp->pw_class); ++#endif + ++#if defined(__phoenix__) ++ (p).pws.pw_gecos = (p).pws.pw_passwd + (p).len + 1; ++#else + (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1; ++#endif + (p).len = strlen((p).pwp->pw_gecos); + strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos); + +@@ -318,7 +324,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; +@@ -407,6 +413,10 @@ + #include + #endif + ++#ifdef __phoenix__ ++#define MAXHOSTNAMELEN HOST_NAME_MAX ++#endif ++ + typedef struct { + struct hostent hent; + char h_name[MAXHOSTNAMELEN]; +diff -ruN a/include/X11/Xpoll.h.in b/include/X11/Xpoll.h.in +--- a/include/X11/Xpoll.h.in 2025-02-19 14:55:32.463374051 +0100 ++++ b/include/X11/Xpoll.h.in 2025-02-19 15:39:53.852526126 +0100 +@@ -50,6 +50,10 @@ + #ifndef _XPOLL_H_ + #define _XPOLL_H_ + ++#ifdef __phoenix__ ++typedef uint32_t fd_mask; ++#endif ++ + #if !defined(WIN32) || defined(__CYGWIN__) + + #ifndef USE_POLL +@@ -163,7 +167,11 @@ + } + + #else /* USE_POLL */ ++#ifdef __phoenix__ ++#include ++#else + #include ++#endif + #endif /* USE_POLL */ + + #else /* WIN32 */ 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 deleted file mode 100644 index d353922..0000000 --- a/tinyx/patches/xorgproto/2023.1/02-include-X11-Xos_r.h.patch +++ /dev/null @@ -1,13 +0,0 @@ -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; - diff --git a/tinyx/patches/xtrans/1.5.2/xtrans.patch b/tinyx/patches/xtrans/1.5.2/xtrans.patch new file mode 100644 index 0000000..83498ae --- /dev/null +++ b/tinyx/patches/xtrans/1.5.2/xtrans.patch @@ -0,0 +1,36 @@ +diff -ruN a/Xtranssock.c b/Xtranssock.c +--- a/Xtranssock.c 2025-02-20 10:25:40.658591768 +0100 ++++ b/Xtranssock.c 2025-02-20 11:14:08.213481827 +0100 +@@ -74,6 +74,10 @@ + #include + #endif + ++#ifdef __phoenix__ ++#define h_addr h_addr_list[0] ++#endif ++ + #ifndef WIN32 + + #if defined(TCPCONN) || defined(UNIXCONN) +@@ -1985,6 +1989,21 @@ + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); + return ret; + } ++#elif __phoenix__ ++/* 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; + #else + return ioctl (ciptr->fd, FIONREAD, (char *) pend); + #endif /* WIN32 */