Klammertext runs natively on Windows; a Windows source-install guide; the bundled sh for @eval :shell

Assembled from klammertext-dev f344a37d0f6e. The commands, the library,
the Standard Klammer Set, the reflection klammerset and the Python
binding build and run natively on Windows (MSYS2 UCRT64 gcc, python.org
Python), and both test tiers pass there. doc/install/windows_source_install.md
is the fifth install guide: a source install parallel to the Linux and
macOS ones, verified by following it on a pristine Windows 11.

Behaviour on every system: paths Klammertext prints use forward slashes;
output is LF; the command line is UTF-8 on Windows; @eval :shell is a
POSIX shell command everywhere -- on Windows it runs the sh Klammertext
ships, BusyBox for Windows (win/busybox/, GPLv2, with its licence and the
source pointer). KLAMMERTEXT_FONTS and KLAMMERTEXT_KLAMMERSETS are lists in
the system's PATH convention (';' on Windows). On Linux and macOS nothing
observable changes.
This commit is contained in:
ack committed 2026-09-25 00:32:55 +02:00
1 parent f9af1ff869
commit fe475e774a
55 files changed
+1182 -153

No files matched your search

+30 -7
View File
@@ -28,6 +28,20 @@ LIBRARY := $(LIBDIR)/libklammertext.so
# Linker flags for commands
COM_LDFLAGS := $(EXPORT_DYNAMIC) -Wl,-rpath,'$(ORIGIN)/../lib' -L$(LIBDIR)
# Windows: the application manifest (UTF-8 process code page) is linked into
# each command as a resource object; elsewhere there is nothing to add.
# (Only variables here: a rule before "all" would become the default goal.
# The Windows rules themselves follow the commands target below.)
ifneq (,$(filter MINGW% MSYS%,$(UNAME_S)))
MANIFEST_OBJ := manifest.o
# The DLLs beside the commands (makefile.env explains); with them, bin/ on
# PATH is all a Windows user needs besides Python.
RUNTIME_DLLS := $(addprefix $(BINDIR)/,libklammertext.so $(GCC_RUNTIME_DLLS))
else
MANIFEST_OBJ :=
RUNTIME_DLLS :=
endif
# Dependency files for command sources
DEPFILES := $(addsuffix .d,$(COMMANDS))
@@ -46,7 +60,16 @@ all : | mac sks
# Separate target to build commands (called after dependencies are ready)
.PHONY: commands
commands : $(BINCOMMANDS)
commands : $(BINCOMMANDS) $(RUNTIME_DLLS)
ifneq (,$(filter MINGW% MSYS%,$(UNAME_S)))
manifest.o : klammertext.rc klammertext.manifest
windres $< $@
$(BINDIR)/libklammertext.so : $(LIBRARY) | $(BINDIR)
cp $< $@
$(BINDIR)/%.dll : $(GCC_BIN)%.dll | $(BINDIR)
cp $< $@
endif
# Ensure the output directory exists before linking into it.
$(BINDIR) :
@@ -63,14 +86,14 @@ sks : | mac
$(MAKE) -C $(KS)/document
# Explicit rules for each command - link against shared library, output to bin/
$(BINDIR)/kdiag : kdiag.cpp $(LIBRARY) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
$(BINDIR)/kdiag : kdiag.cpp $(LIBRARY) $(MANIFEST_OBJ) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< $(MANIFEST_OBJ) -o $@ $(KLAMMERTEXT_LIB) $(LDLIBS)
$(BINDIR)/kdesc : kdesc.cpp $(LIBRARY) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
$(BINDIR)/kdesc : kdesc.cpp $(LIBRARY) $(MANIFEST_OBJ) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< $(MANIFEST_OBJ) -o $@ $(KLAMMERTEXT_LIB) $(LDLIBS)
$(BINDIR)/ktext : ktext.cpp $(LIBRARY) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
$(BINDIR)/ktext : ktext.cpp $(LIBRARY) $(MANIFEST_OBJ) | $(BINDIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< $(MANIFEST_OBJ) -o $@ $(KLAMMERTEXT_LIB) $(LDLIBS)
# Out-of-tree system install (copies; the build tree stays intact). The
# installed commands still need KLAMMERTEXT_HOME pointing at a Klammertext tree
+1 -1
View File
@@ -309,7 +309,7 @@ int main(int argc, char* argv[])
M.m_state.set(
"K_input_dir", absolute_pathname(file_directory(input_filenames[0])));
} else {
M.m_state.set("K_input_dir", fs::current_path().string());
M.m_state.set("K_input_dir", fs::current_path().generic_string());
}
// --klammersets both lists and loads: with no words it enumerates the
+2 -2
View File
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
}
if (p("rewrite")) {
show_rewrite_rules = true;
set_show_rewrite_rules(true);
}
// kdiag deliberately has no --klammersets: a klammerset is reached here
@@ -94,7 +94,7 @@ int main(int argc, char* argv[])
machine.m_state.set("K_target", Target_registry::general_name);
machine.m_state.set("K_input_dir", fs::current_path().string());
std::string input = args.as_string("input");
std::string command = construct_command_pathname(argv[0]);
std::string command = construct_command_pathname(argv[0]).generic_string();
// ONE authoritative katom list. process() returns the katoms but
// registers nothing -- read() is what appends to m_katoms and extracts
// the definitions -- so kdiag does that itself, in the order read()
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Embedded into ktext, kdesc and kdiag on Windows (com/klammertext.rc,
via windres). The one setting: the process code page is UTF-8, so the
command line arrives as UTF-8 (not the ANSI code page, which loses
every character outside it) and narrow file names are UTF-8 too.
Honoured since Windows 10 1903. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Klammertext.Command" version="1.0.0.0"/>
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
+4
View File
@@ -0,0 +1,4 @@
// Resource script for the Windows builds of the commands: embeds
// klammertext.manifest as the application manifest (resource type 24 is
// RT_MANIFEST, id 1 the process manifest). Compiled by windres; see com/Makefile.
1 24 "klammertext.manifest"