diff --git a/build.sh b/build.sh index 8b68b537..ae32a94e 100755 --- a/build.sh +++ b/build.sh @@ -65,6 +65,7 @@ ports=( "coremark" "coreMQTT" "lsb_vsx" + "x11" ) diff --git a/x11/build.sh b/x11/build.sh new file mode 100755 index 00000000..5880a9eb --- /dev/null +++ b/x11/build.sh @@ -0,0 +1,554 @@ +#!/usr/bin/env bash + +set -e + +# FIXME: libxcb fails to find pkgconfig without this export, why? +export PKG_CONFIG_PATH="${PREFIX_A}/pkgconfig" + + +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_no_reconf() { + # set LIBBSD_LIBS/LIBBSD_CFLAGS to whitespace so that '-lbsd' is not included in build dependencies + # penultimate line is a shotgun (some builds support these, some don't) + (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 --disable-devel-docs --disable-docs \ + "${@}" + ) +} + + +# exec_configure([configure_opts]) +exec_configure() { + (cd "${PREFIX_PORT_SRC}" && + autoreconf -vfi && # reconf, as there may be patches to configure.ac + exec_configure_no_reconf "${@}" + ) +} + + +# 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}" +} + + +build_xorg_pkg() { + local type="${1:?type missing}" + local pkgname="${2:?pkgname missing}" + local version="${3:?version missing}" + local configure_opts=${*:4} + + b_log "x11: building ${pkgname}" + + local archive_filename="${pkgname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${pkgname}" + + b_port_download "https://www.x.org/archive/individual/${type}/" "${archive_filename}" + + if should_reconfigure "${pkgname}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${pkgname}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + # shellcheck disable=SC2086 + exec_configure ${configure_opts} + fi + + mark_as_configured "${pkgname}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install +} + + +build_a_lib() { + local pkgname="$1" + local version="$2" + local configure_opts=${*:3} + + build_xorg_pkg "lib" "${pkgname}" "${version}" "${configure_opts}" + + if [ "${pkgname}" = "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_tinyx() { + b_log "x11: building tinyx (xserver)" + + local pkgname="tinyx" + local ref="eed4902840732f170a7020cedb381017de99f2e6" + local archive_filename="${ref}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${pkgname}" + b_port_download "https://github.com/tinycorelinux/tinyx/archive/" "${archive_filename}" + + if should_reconfigure "${pkgname}"; 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}" "${pkgname}" + + 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 "${pkgname}" + fi + + make -C "${PREFIX_PORT_SRC}" + + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/Xfbdev" "${PREFIX_PORT_SRC}/kdrive/fbdev/Xfbdev" + cp -a "${PREFIX_PORT_SRC}/kdrive/fbdev/Xfbdev" "${PREFIX_PROG}/Xfbdev" + + b_install "${PREFIX_PORTS_INSTALL}/Xfbdev" /usr/bin +} + + +build_x11_app() { + local appname="$1" + local version="$2" + local configure_opts=${*:3} + + b_log "x11: building ${appname}" + + local archive_filename="${appname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}" + + b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}" + + if should_reconfigure "${appname}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + # shellcheck disable=SC2086 + exec_configure ${configure_opts} + fi + + # FIXME: this is brutal, see build_tinyx note + 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}" + + mark_as_configured "${appname}" + fi + + make -C "${PREFIX_PORT_SRC}" + + binpath="${PREFIX_PORT_SRC}/${appname}" + if [ ! -f "${binpath}" ]; then + binpath="${PREFIX_PORT_SRC}/src/${appname}" + fi + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/${appname}" "${binpath}" + + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + +build_suckless() { + local appname="$1" + local version="$2" + + b_log "x11: building ${appname}" + + local archive_filename="${appname}-${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}" + + b_port_download "https://dl.suckless.org/${appname}/" "${archive_filename}" + + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${appname}" + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" + + # TODO: termcap/terminfo + # if [ ${appname} == "st" ]; then + # cp -a "${PREFIX_PORT_SRC}/st.info" "${PREFIX_PORT_SRC}/termcap" + # b_install "${PREFIX_PORT_SRC}/st.info" /etc/termcap + # fi + + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/${appname}" + + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + +build_xbill() { + local appname="xbill" + local version="2.1" + + b_log "x11: building ${appname}" + + local 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: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}" + + mark_as_configured "${appname}/${version}" + fi + + make -C "${PREFIX_PORT_SRC}" PREFIX="${PREFIX_PORT_BUILD}" + + ${STRIP} -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/${appname}" + + b_install "${PREFIX_PORT_SRC}/pixmaps"/* /usr/share/xbill/pixmaps/ + b_install "${PREFIX_PORT_SRC}/bitmaps"/* /usr/share/xbill/bitmaps/ + b_install "${PREFIX_PORTS_INSTALL}/${appname}" /usr/bin +} + + +build_freetype() { + local appname="freetype" + local version="2.13.3" + + b_log "x11: building ${appname}" + + local 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() { + local appname="imlib2" + local version="1.12.3" + + b_log "x11: building ${appname}" + + local archive_filename="${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}" + + # 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}"; 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}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure --x-includes="${PREFIX_H}/X11" --x-libraries="${PREFIX_A}" + fi + + mark_as_configured "${appname}" + 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() { + local appname="feh" + local version="3.10.3" + + b_log "png: building ${appname}" + + local archive_filename="${version}.tar.gz" + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${appname}" + + 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}" + + 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 +} + + +build_expat() { + local libname="expat" + local version="2.6.4" + + b_log "x11: building ${libname}" + + local archive_filename="${libname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}" + + # NOTE: URL depends on ${version} (FIXME) + b_port_download "https://github.com/libexpat/libexpat/releases/download/R_2_6_4/" "${archive_filename}" + + if should_reconfigure "${libname}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure_no_reconf + fi + + mark_as_configured "${libname}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install +} + + +build_fontconfig() { + local libname="fontconfig" + local version="2.15.0" + + b_log "x11: building ${libname}" + + local archive_filename="${libname}-${version}.tar.gz" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${libname}" + + b_port_download "https://www.freedesktop.org/software/fontconfig/release/" "${archive_filename}" + + if should_reconfigure "${libname}"; then + extract_sources "${PREFIX_PORT_SRC}" + + b_port_apply_patches "${PREFIX_PORT_SRC}" "${libname}" + + if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then + exec_configure_no_reconf --prefix="${PREFIX_PORT_SRC}" --localstatedir="/var" + fi + + mark_as_configured "${libname}" + fi + + make -C "${PREFIX_PORT_SRC}" + make -C "${PREFIX_PORT_SRC}" install + + b_install "${PREFIX_PORT_SRC}/fc-list/fc-list" /usr/bin +} + + +install_dejavu() { + b_log "x11: installing dejavu fonts" + + local pkgname="dejavu-fonts-ttf" + local version="2.37" + + local archive_filename="${pkgname}-${version}.tar.bz2" + + PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/${pkgname}" + + b_port_download "https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/" ${archive_filename} + + extract_sources "${PREFIX_PORT_SRC}" + + b_install "${PREFIX_PORT_SRC}/ttf/DejaVuSansMono.ttf" /usr/share/fonts + b_install "${PREFIX_PORT_SRC}/ttf/DejaVuSansMono-Bold.ttf" /usr/share/fonts +} + + +# +# Build xlib (call ordering is important here) +# + +build_xorg_pkg proto xorgproto 2023.1 --disable-specs +build_xorg_pkg proto xextproto 7.3.0 --disable-specs +build_xorg_pkg data xbitmaps 1.1.2 +build_a_lib libXau 1.0.12 + +# FIXME: set pyexecdir instead of shotgunning prefix +build_xorg_pkg xcb xcb-proto 1.17.0 --prefix="${PREFIX_PORT_BUILD}/xcb-proto/1.17.0" --libdir="${PREFIX_A}" --includedir="${PREFIX_H}" --datadir="${PREFIX_H}" + +build_xorg_pkg xcb libxcb 1.17.0 + +build_a_lib xtrans 1.5.2 + +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_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 + +install_dejavu + +# +# Finally build xserver +# +build_tinyx + +# +# Build client apps +# + +# Window managers +build_suckless dwm 5.1 +build_x11_app twm 1.0.12 # requires yacc + +build_suckless st 0.7 + +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 +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 diff --git a/x11/patches/dwm/01-Makefile.patch b/x11/patches/dwm/01-Makefile.patch new file mode 100644 index 00000000..4591daa9 --- /dev/null +++ b/x11/patches/dwm/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 -l:libxcb.a -l:libXau.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 diff --git a/x11/patches/feh/01-no-scandir.patch b/x11/patches/feh/01-no-scandir.patch new file mode 100644 index 00000000..051329ad --- /dev/null +++ b/x11/patches/feh/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/x11/patches/feh/02-lround.patch b/x11/patches/feh/02-lround.patch new file mode 100644 index 00000000..86c6b05d --- /dev/null +++ b/x11/patches/feh/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/x11/patches/feh/03-config.mk.patch b/x11/patches/feh/03-config.mk.patch new file mode 100644 index 00000000..58d21511 --- /dev/null +++ b/x11/patches/feh/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 -l:libxcb.a -l:libXau.a diff --git a/x11/patches/feh/04-no-fonts.patch b/x11/patches/feh/04-no-fonts.patch new file mode 100644 index 00000000..cc3802da --- /dev/null +++ b/x11/patches/feh/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/x11/patches/feh/05-rint.patch b/x11/patches/feh/05-rint.patch new file mode 100644 index 00000000..01b745a9 --- /dev/null +++ b/x11/patches/feh/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/x11/patches/fontconfig/01-fontconfig.patch b/x11/patches/fontconfig/01-fontconfig.patch new file mode 100644 index 00000000..e9fafbd9 --- /dev/null +++ b/x11/patches/fontconfig/01-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/x11/patches/ico/01-ico.c.patch b/x11/patches/ico/01-ico.c.patch new file mode 100644 index 00000000..d0b41833 --- /dev/null +++ b/x11/patches/ico/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/x11/patches/ico/02-keysym.patch b/x11/patches/ico/02-keysym.patch new file mode 100644 index 00000000..0d3f51ff --- /dev/null +++ b/x11/patches/ico/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; diff --git a/x11/patches/imlib2/01-imlib.patch b/x11/patches/imlib2/01-imlib.patch new file mode 100644 index 00000000..6afa905c --- /dev/null +++ b/x11/patches/imlib2/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/x11/patches/imlib2/02-loaders-no-dl.patch b/x11/patches/imlib2/02-loaders-no-dl.patch new file mode 100644 index 00000000..6b0fe4aa --- /dev/null +++ b/x11/patches/imlib2/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); diff --git a/x11/patches/libICE/libice.patch b/x11/patches/libICE/libice.patch new file mode 100644 index 00000000..0e8d3054 --- /dev/null +++ b/x11/patches/libICE/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/x11/patches/libX11/libx11.patch b/x11/patches/libX11/libx11.patch new file mode 100644 index 00000000..6824c922 --- /dev/null +++ b/x11/patches/libX11/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/x11/patches/libXaw/libxaw.patch b/x11/patches/libXaw/libxaw.patch new file mode 100644 index 00000000..a90789c9 --- /dev/null +++ b/x11/patches/libXaw/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/x11/patches/libXext/01-libxext.patch b/x11/patches/libXext/01-libxext.patch new file mode 100644 index 00000000..a61154c9 --- /dev/null +++ b/x11/patches/libXext/01-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/x11/patches/libXfont/01-src-bitmap-bitscale.c.patch b/x11/patches/libXfont/01-src-bitmap-bitscale.c.patch new file mode 100644 index 00000000..f5fead8f --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont/02-src-fc-fslibos.h.patch b/x11/patches/libXfont/02-src-fc-fslibos.h.patch new file mode 100644 index 00000000..8b5d922b --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont/03-src-fontfile-dirfile.c.patch b/x11/patches/libXfont/03-src-fontfile-dirfile.c.patch new file mode 100644 index 00000000..558e9bed --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont/04-src-fontfile-fontscale.c.patch b/x11/patches/libXfont/04-src-fontfile-fontscale.c.patch new file mode 100644 index 00000000..c4eb47b2 --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont/05-src-util-fontxlfd.c.patch b/x11/patches/libXfont/05-src-util-fontxlfd.c.patch new file mode 100644 index 00000000..3eb5dbb1 --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont/06-configure.ac.patch b/x11/patches/libXfont/06-configure.ac.patch new file mode 100644 index 00000000..032d3889 --- /dev/null +++ b/x11/patches/libXfont/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/x11/patches/libXfont2/01-libxfont2.patch b/x11/patches/libXfont2/01-libxfont2.patch new file mode 100644 index 00000000..267da73c --- /dev/null +++ b/x11/patches/libXfont2/01-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/x11/patches/libXrender/01-libxrender.patch b/x11/patches/libXrender/01-libxrender.patch new file mode 100644 index 00000000..5406f5d1 --- /dev/null +++ b/x11/patches/libXrender/01-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/x11/patches/libXt/01-libxt.patch b/x11/patches/libXt/01-libxt.patch new file mode 100644 index 00000000..0aa692d3 --- /dev/null +++ b/x11/patches/libXt/01-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/x11/patches/libxcb/01-libxcb.patch b/x11/patches/libxcb/01-libxcb.patch new file mode 100644 index 00000000..f8877b83 --- /dev/null +++ b/x11/patches/libxcb/01-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/x11/patches/st/01-st.patch b/x11/patches/st/01-st.patch new file mode 100644 index 00000000..3459af63 --- /dev/null +++ b/x11/patches/st/01-st.patch @@ -0,0 +1,138 @@ +diff -ruN a/config.def.h b/config.def.h +--- a/config.def.h 2025-02-20 18:57:25.613701469 +0100 ++++ b/config.def.h 2025-03-03 12:21:49.425726381 +0100 +@@ -5,7 +5,7 @@ + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +-static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; ++static char font[] = "DejaVu Sans Mono:pixelsize=12:antialias=true:autohint=true"; + static int borderpx = 2; + + /* +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-03-03 11:03:59.041719599 +0100 +@@ -1387,6 +1387,9 @@ + exit(0); + } + ++#ifndef _POSIX_ARG_MAX ++#define _POSIX_ARG_MAX 100 ++#endif + + void + stty(void) +@@ -1416,7 +1419,9 @@ + ttynew(void) + { + int m, s; ++#ifndef __phoenix__ + struct winsize w = {term.row, term.col, 0, 0}; ++#endif + + if (opt_io) { + term.mode |= MODE_PRINT; +@@ -1436,9 +1441,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 +1534,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 +2952,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 +4244,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 +4274,15 @@ + FD_SET(cmdfd, &rfd); + FD_SET(xfd, &rfd); + +- if (pselect(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { ++ if (tv != NULL) { ++ tvv.tv_sec = tv->tv_sec; ++ tvv.tv_usec = tv->tv_nsec / 1000; ++ } else { ++ tvv.tv_sec = 0; ++ tvv.tv_usec = 100; ++ } ++ ++ 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/x11/patches/tinyx/01-configure.ac.patch b/x11/patches/tinyx/01-configure.ac.patch new file mode 100644 index 00000000..22bdb970 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/02-kdrive-phoenix.patch b/x11/patches/tinyx/02-kdrive-phoenix.patch new file mode 100644 index 00000000..39d1232e --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/03-mi.patch b/x11/patches/tinyx/03-mi.patch new file mode 100644 index 00000000..5f0c63f8 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/04-dixfonts.patch b/x11/patches/tinyx/04-dixfonts.patch new file mode 100644 index 00000000..4956aa47 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/05-os.patch b/x11/patches/tinyx/05-os.patch new file mode 100644 index 00000000..5e7c7612 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/06-Xext.patch b/x11/patches/tinyx/06-Xext.patch new file mode 100644 index 00000000..3741b7e1 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/07-kdrive-fbdev.patch b/x11/patches/tinyx/07-kdrive-fbdev.patch new file mode 100644 index 00000000..97370334 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/08-mouse.patch b/x11/patches/tinyx/08-mouse.patch new file mode 100644 index 00000000..993138dc --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/09-keyboard.patch b/x11/patches/tinyx/09-keyboard.patch new file mode 100644 index 00000000..a46fe866 --- /dev/null +++ b/x11/patches/tinyx/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) diff --git a/x11/patches/tinyx/10-vga.patch b/x11/patches/tinyx/10-vga.patch new file mode 100644 index 00000000..5ad408b3 --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/tinyx/11-keyboard-ctd.patch b/x11/patches/tinyx/11-keyboard-ctd.patch new file mode 100644 index 00000000..f593c701 --- /dev/null +++ b/x11/patches/tinyx/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) diff --git a/x11/patches/tinyx/12-colors-fix.patch b/x11/patches/tinyx/12-colors-fix.patch new file mode 100644 index 00000000..6d770e45 --- /dev/null +++ b/x11/patches/tinyx/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++; + } diff --git a/x11/patches/tinyx/13-tiocnotty.patch b/x11/patches/tinyx/13-tiocnotty.patch new file mode 100644 index 00000000..b001fe91 --- /dev/null +++ b/x11/patches/tinyx/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; + } + diff --git a/x11/patches/tinyx/14-vesa-via-platformctl.patch b/x11/patches/tinyx/14-vesa-via-platformctl.patch new file mode 100644 index 00000000..8a22c735 --- /dev/null +++ b/x11/patches/tinyx/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; + diff --git a/x11/patches/tinyx/15-set-tty-mode.patch b/x11/patches/tinyx/15-set-tty-mode.patch new file mode 100644 index 00000000..cb896bbb --- /dev/null +++ b/x11/patches/tinyx/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 = { diff --git a/x11/patches/tinyx/16-fix-xdmcp-include.patch b/x11/patches/tinyx/16-fix-xdmcp-include.patch new file mode 100644 index 00000000..2fc8733c --- /dev/null +++ b/x11/patches/tinyx/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/x11/patches/twm/01-twm.patch b/x11/patches/twm/01-twm.patch new file mode 100644 index 00000000..1d05eebc --- /dev/null +++ b/x11/patches/twm/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/x11/patches/xbill/01-configure.in.patch b/x11/patches/xbill/01-configure.in.patch new file mode 100644 index 00000000..734b0f6f --- /dev/null +++ b/x11/patches/xbill/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]) + diff --git a/x11/patches/xeyes/01-hypot.patch b/x11/patches/xeyes/01-hypot.patch new file mode 100644 index 00000000..e8ac80a8 --- /dev/null +++ b/x11/patches/xeyes/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), diff --git a/x11/patches/xorgproto/01-xorgproto.patch b/x11/patches/xorgproto/01-xorgproto.patch new file mode 100644 index 00000000..5f02e83e --- /dev/null +++ b/x11/patches/xorgproto/01-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/x11/patches/xtrans/01-xtrans.patch b/x11/patches/xtrans/01-xtrans.patch new file mode 100644 index 00000000..83498ae5 --- /dev/null +++ b/x11/patches/xtrans/01-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 */