Conversation
9ae74d5 to
b9b90ed
Compare
This build libXt-compat.so from pinned upstream libXt-1.3.1 against the SDL2-backed Xlib shim. Output exports 299 Xt symbols; depends only on libX11-compat.so and libSystem. Fill the Xlib symbols libXt actually calls. XAddConnectionWatch, XRemoveConnectionWatch, XInternalConnectionNumbers, XProcessInternalConnection: stubs, since the SDL backend has no internal connections to fold into the event loop. XConvertCase: carved verbatim from libX11 KeyBind.c with attribution, since the surrounding KeyBind.c overlaps with src/input.c's SDL-backed keysym handling. XrmQGetResource, XrmQGetSearchList, XrmQGetSearchResource: bridge the quark API onto the existing string-based database by encoding the database pointer plus the widget prefix arrays into the search list, then reassembling the full quark path on lookup. The previous always-False stubs sent libXt's _XtDisplayInitialize into an alloca-doubling loop until the stack smashed. mk/libxt.mk compiles util/makestrs.c as a host tool, runs it to generate StringDefs.c, StringDefs.h, and Shell.h, then compiles the 53 libXt translation units with -DHAVE_CONFIG_H -DLIBXT_COMPILATION -DXT_NO_SM. include/libxt-build/config.h is the synthesized autoconf output. include/X11/Xmu/Editres.h, include/X11/SM/SMlib.h, include/X11/ICE/ICElib.h satisfy unconditional libXt header includes without dragging libXmu, libSM, or libICE into the link closure. scripts/sync-upstream-headers.py gains per-source src_take_all and util_files knobs, plus a SRC_PATCHES entry that works around a real upstream bug in libXt-1.3.1's SessionSetValues, where a misplaced XT_NO_SM #endif leaves widget casts referenced outside their declaration scope. On Linux, bake -Wl,-rpath,$ORIGIN into libXt-compat.so so its DT_NEEDED reference to libX11-compat.so (recorded by basename from -lX11-compat) resolves from the sibling build directory at runtime. macOS encodes a relative install_name and already worked from a repo-root cwd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This build libXt-compat.so from pinned upstream libXt-1.3.1 against the SDL2-backed Xlib shim. Output exports 299 Xt symbols; depends only on libX11-compat.so and libSystem.
Fill the Xlib symbols libXt actually calls.
XAddConnectionWatch, XRemoveConnectionWatch, XInternalConnectionNumbers, XProcessInternalConnection: stubs, since the SDL backend has no internal connections to fold into the event loop.
XConvertCase: carved verbatim from libX11 KeyBind.c with attribution, since the surrounding KeyBind.c overlaps with src/input.c's SDL-backed keysym handling.
XrmQGetResource, XrmQGetSearchList, XrmQGetSearchResource: bridge the quark API onto the existing string-based database by encoding the database pointer plus the widget prefix arrays into the search list, then reassembling the full quark path on lookup.
The previous always-False stubs sent libXt's _XtDisplayInitialize into an alloca-doubling loop until the stack smashed.
mk/libxt.mk compiles util/makestrs.c as a host tool, runs it to generate StringDefs.c, StringDefs.h, and Shell.h, then compiles the 53 libXt translation units with -DHAVE_CONFIG_H -DLIBXT_COMPILATION -DXT_NO_SM. include/libxt-build/config.h is the synthesized autoconf output. include/X11/Xmu/Editres.h, include/X11/SM/SMlib.h, include/X11/ICE/ICElib.h satisfy unconditional libXt header includes without dragging libXmu, libSM, or libICE into the link closure.
scripts/sync-upstream-headers.py gains per-source src_take_all and util_files knobs, plus a SRC_PATCHES entry that works around a real upstream bug in libXt-1.3.1's SessionSetValues, where a misplaced XT_NO_SM #endif leaves widget casts referenced outside their declaration scope.
Summary by cubic
Builds
libXt-compat.sofrom pinnedlibXt-1.3.1and wires it into the build, enabling Xt apps to run on our SDL2-backed Xlib without new system deps. Implements missing Xlib hooks and a robust Xrm quark bridge so initialization and resource lookups work correctly, including deep prefixes.New Features
libXt-compat.soexporting 299 Xt symbols; links only tolibX11-compat.soandlibSystem.XrmQGetResource,XrmQGetSearchList,XrmQGetSearchResource) with prefix encoding and correct buffer-size semantics to unblock_XtDisplayInitializeand support deep resource paths.XConvertCase(from upstreamlibX11) for correct keysym case folding.XAddConnectionWatch,XRemoveConnectionWatch,XInternalConnectionNumbers,XProcessInternalConnection) for the SDL backend.XrmParseCommandto only NULL-terminateargvwhen compression frees a slot, avoiding an overrun; matches upstream behavior.test-libxt-link,test-libxt-micro) covering init, events, callbacks, GC, and fallback resources; integrated intomake check.Dependencies
mk/libxt.mk; compile 53 upstream sources, build hostmakestrsto generateStringDefs.{c,h}andShell.h, and link with-DXT_NO_SM.StringDefs.h/Shell.hunder the staged X11 include tree so<X11/Shell.h>resolves for downstream consumers.X11/Xmu/Editres.h,X11/SM/SMlib.h,X11/ICE/ICElib.hto avoid pullinglibXmu,libSM, orlibICE.include/libxt-build/config.h(enablesUSE_POLL,XTHREADS; disables SM).scripts/sync-upstream-headers.pywith per-sourcesrc_take_all/util_files, stagelibXtsrc/util into separate dirs, and patchlibXt-1.3.1Shell.cSessionSetValuesforXT_NO_SM.mk/libxt.mkfrom the top-levelMakefile; add test rules linkinglibXt-compat.soandlibX11-compat.so. On Linux, add-Wl,-rpath,'$ORIGIN'for runtime and-Wl,-rpath-link,$OUTon tests.Written for commit 8ba599c. Summary will update on new commits.