From d0dca533dcc0ac146c342dbb2c553b6cd28d1a18 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 10 Nov 2024 12:05:31 +0100 Subject: [PATCH 01/24] Update ab. --- build/ab.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/ab.py b/build/ab.py index 5ad3ca8f..5ae17c24 100644 --- a/build/ab.py +++ b/build/ab.py @@ -32,7 +32,8 @@ class PathFinderImpl(PathFinder): def find_spec(self, fullname, path, target=None): - if not path: + # The second test here is needed for Python 3.9. + if not path or not path[0]: path = ["."] if len(path) != 1: return None From 87d1d7e082b015293748ca56a5e1f02d4f9c2402 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 01:01:32 +0100 Subject: [PATCH 02/24] Update for the new sandboxed ab. --- build.py | 6 ++- build/ab.mk | 11 ++++-- build/ab.py | 77 +++++++++++++++++++++++++++++++++----- build/c.py | 44 +++++++++++++--------- build/pkg.py | 2 +- build/utils.py | 4 +- extras/build.py | 9 ++--- src/c/arch/glfw/build.py | 1 + src/c/arch/win32/build.py | 8 ++-- src/c/build.py | 20 +++++----- src/lua/build.py | 2 +- tests/build.py | 4 +- third_party/clip/build.py | 6 ++- third_party/cmark/build.py | 2 + third_party/luau/build.py | 10 +++-- tools/build.py | 5 ++- tools/makeicon.py | 9 ++--- 17 files changed, 152 insertions(+), 68 deletions(-) diff --git a/build.py b/build.py index 480707d4..62df8383 100644 --- a/build.py +++ b/build.py @@ -15,7 +15,11 @@ items={ "bin/wordgrinder$(EXT)": TEST_BINARY, } - | ({"bin/xwordgrinder": "src/c+wordgrinder-glfw-x11"} if HAS_XWORDGRINDER else {}) + | ( + {"bin/xwordgrinder": "src/c+wordgrinder-glfw-x11"} + if HAS_XWORDGRINDER + else {} + ) | ( {"bin/wordgrinder-haiku": "src/c+wordgrinder-glfw-haiku"} if HAS_HAIKU diff --git a/build/ab.mk b/build/ab.mk index 089c11ad..fa622330 100644 --- a/build/ab.mk +++ b/build/ab.mk @@ -51,6 +51,8 @@ ifeq ($(OS), Windows_NT) endif EXT ?= +CWD=$(shell pwd) + ifeq ($(PROGRESSINFO),) # The first make invocation here has to have its output discarded or else it # produces spurious 'Leaving directory' messages... don't know why. @@ -61,12 +63,13 @@ PROGRESSINFO = "[$(ruleindex)/$(rulecount)]$(eval ruleindex := $(shell expr $(ru endif PKG_CONFIG_HASHES = $(OBJ)/.pkg-config-hashes/target-$(word 1, $(shell $(PKG_CONFIG) --list-all | md5sum)) +HOST_PKG_CONFIG_HASHES = $(OBJ)/.pkg-config-hashes/host-$(word 1, $(shell $(HOST_PKG_CONFIG) --list-all | md5sum)) -$(OBJ)/build.mk : $(PKG_CONFIG_HASHES) -$(PKG_CONFIG_HASHES): +$(OBJ)/build.mk : $(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) +$(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) &: + $(hide) rm -rf $(OBJ)/.pkg-config-hashes $(hide) mkdir -p $(OBJ)/.pkg-config-hashes - $(hide) rm -rf $(OBJ)/.pkg-config-hashes/target-* - $(hide) touch $(PKG_CONFIG_HASHES) + $(hide) touch $(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) include $(OBJ)/build.mk diff --git a/build/ab.py b/build/ab.py index 92fe324d..5697af04 100644 --- a/build/ab.py +++ b/build/ab.py @@ -17,6 +17,9 @@ import string import sys import hashlib +import re +import ast +from collections import namedtuple verbose = False quiet = False @@ -26,6 +29,22 @@ materialisingStack = [] defaultGlobals = {} +RE_FORMAT_SPEC = re.compile( + r"(?:(?P[\s\S])?(?P[<>=^]))?" + r"(?P[- +])?" + r"(?Pz)?" + r"(?P#)?" + r"(?P0)?" + r"(?P\d+)?" + r"(?P[_,])?" + r"(?:(?P\.)(?P\d+))?" + r"(?P[bcdeEfFgGnosxX%])?" +) + +CommandFormatSpec = namedtuple( + "CommandFormatSpec", RE_FORMAT_SPEC.groupindex.keys() +) + sys.path += ["."] old_import = builtins.__import__ @@ -80,6 +99,29 @@ def error(message): raise ABException(message) +class BracketedFormatter(string.Formatter): + def parse(self, format_string): + while format_string: + left, *right = format_string.split("$[", 1) + if not right: + yield (left, None, None, None) + break + right = right[0] + + offset = len(right) + 1 + try: + ast.parse(right) + except SyntaxError as e: + if not str(e).startswith("unmatched ']'"): + raise e + offset = e.offset + + expr = right[0 : offset - 1] + format_string = right[offset:] + + yield (left if left else None, expr, None, None) + + def Rule(func): sig = inspect.signature(func) @@ -166,7 +208,7 @@ def __repr__(self): return f"Target('{self.name}')" def templateexpand(selfi, s): - class Formatter(string.Formatter): + class Formatter(BracketedFormatter): def get_field(self, name, a1, a2): return ( eval(name, selfi.callback.__globals__, selfi.args), @@ -358,10 +400,11 @@ def convert(value, target): def _removesuffix(self, suffix): # suffix='' should not call self[:-0]. if suffix and self.endswith(suffix): - return self[:-len(suffix)] + return self[: -len(suffix)] else: return self[:] + def loadbuildfile(filename): filename = _removesuffix(filename.replace("/", "."), ".py") builtins.__import__(filename) @@ -413,8 +456,9 @@ def emit(*args, into=None): outputFp.write(s) -def emit_rule(name, ins, outs, cmds=[], label=None): - fins = filenamesof(ins) +def emit_rule(self, ins, outs, cmds=[], label=None): + name = self.name + fins = set(filenamesof(ins)) fouts = filenamesof(outs) nonobjs = [f for f in fouts if not f.startswith("$(OBJ)")] @@ -440,8 +484,23 @@ def emit_rule(name, ins, outs, cmds=[], label=None): if label: emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)", label, into=lines) + + sandbox = join(self.dir, "sandbox") + emit("\t$(hide)", f"rm -rf {sandbox}", into=lines) + emit( + "\t$(hide)", + f"$(PYTHON) build/_sandbox.py --link -s {sandbox}", + *fins, + into=lines, + ) for c in cmds: - emit("\t$(hide)", c, into=lines) + emit(f"\t$(hide) cd {sandbox} &&", c, into=lines) + emit( + "\t$(hide)", + f"$(PYTHON) build/_sandbox.py --export -s {sandbox}", + *fouts, + into=lines, + ) else: assert len(cmds) == 0, "rules with no outputs cannot have commands" emit(name, ":", *fins, into=lines) @@ -486,10 +545,10 @@ def simplerule( cs += [self.templateexpand(c)] emit_rule( - name=self.name, + self=self, ins=ins + deps, outs=outs, - label=self.templateexpand("{label} {name}") if label else None, + label=self.templateexpand("$[label] $[name]") if label else None, cmds=cs, ) @@ -514,7 +573,7 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): cwd=self.cwd, ins=[srcs[0]], outs=[destf], - commands=["$(CP) %s %s" % (srcs[0], destf)], + commands=["$(CP) --dereference %s %s" % (srcs[0], destf)], label="", ) subrule.materialise() @@ -523,7 +582,7 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): replaces=self, ins=outs + deps, outs=["=sentinel"], - commands=["touch {outs[0]}"], + commands=["touch $[outs[0]]"], label="EXPORT", ) diff --git a/build/c.py b/build/c.py index f84fea5d..658def28 100644 --- a/build/c.py +++ b/build/c.py @@ -20,6 +20,7 @@ """ ) + def _combine(list1, list2): r = list(list1) for i in list2: @@ -27,6 +28,7 @@ def _combine(list1, list2): r.append(i) return r + def _indirect(deps, name): r = [] for d in deps: @@ -61,7 +63,7 @@ def cfile( deps: Targets = None, cflags=[], suffix=".o", - commands=["$(CC) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"], + commands=["$(CC) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"], label="CC", ): cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags) @@ -75,7 +77,7 @@ def cxxfile( deps: Targets = None, cflags=[], suffix=".o", - commands=["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"], + commands=["$(CXX) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"], label="CXX", ): cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags) @@ -83,33 +85,41 @@ def cxxfile( def _removeprefix(self, prefix): if self.startswith(prefix): - return self[len(prefix):] + return self[len(prefix) :] else: return self[:] + +def _isSourceFile(f): + return ( + f.endswith(".c") + or f.endswith(".cc") + or f.endswith(".cpp") + or f.endswith(".S") + or f.endswith(".s") + or f.endswith(".m") + or f.endswith(".mm") + ) + + def findsources(name, srcs, deps, cflags, filerule, cwd): for f in filenamesof(srcs): - if f.endswith(".h") or f.endswith(".hh"): + if not _isSourceFile(f): cflags = cflags + [f"-I{dirname(f)}"] + deps = deps + [f] objs = [] for s in flatten(srcs): objs += [ filerule( - name=join(name, _removeprefix(f,"$(OBJ)/")), + name=join(name, _removeprefix(f, "$(OBJ)/")), srcs=[f], deps=deps, cflags=sorted(set(cflags)), cwd=cwd, ) for f in filenamesof([s]) - if f.endswith(".c") - or f.endswith(".cc") - or f.endswith(".cpp") - or f.endswith(".S") - or f.endswith(".s") - or f.endswith(".m") - or f.endswith(".mm") + if _isSourceFile(f) ] if any(f.endswith(".o") for f in filenamesof([s])): objs += [s] @@ -148,7 +158,7 @@ def libraryimpl( len(s) == 1 ), "the target of a header must return exactly one file" - cs += ["$(CP) {ins[" + str(i) + "]} {outs[" + str(i) + "]}"] + cs += [f"$(CP) $[ins[{i}]] $[outs[{i}]]"] outs += ["=" + dest] i = i + 1 @@ -202,7 +212,7 @@ def clibrary( caller_ldflags=[], cflags=[], ldflags=[], - commands=["rm -f {outs[0]} && $(AR) cqs {outs[0]} {ins}"], + commands=["rm -f $[outs[0]] && $(AR) cqs $[outs[0]] $[ins]"], label="LIB", cfilerule=cfile, ): @@ -233,7 +243,7 @@ def cxxlibrary( caller_ldflags=[], cflags=[], ldflags=[], - commands=["rm -f {outs[0]} && $(AR) cqs {outs[0]} {ins}"], + commands=["rm -f $[outs[0]] && $(AR) cqs $[outs[0]] $[ins]"], label="CXXLIB", cxxfilerule=cxxfile, ): @@ -298,7 +308,7 @@ def cprogram( cflags=[], ldflags=[], commands=[ - "$(CC) -o {outs[0]} $(STARTGROUP) {ins} {ldflags} $(LDFLAGS) $(ENDGROUP)" + "$(CC) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(LDFLAGS) $(ENDGROUP)" ], label="CLINK", cfilerule=cfile, @@ -325,7 +335,7 @@ def cxxprogram( cflags=[], ldflags=[], commands=[ - "$(CXX) -o {outs[0]} $(STARTGROUP) {ins} {ldflags} $(LDFLAGS) $(ENDGROUP)" + "$(CXX) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(LDFLAGS) $(ENDGROUP)" ], label="CXXLINK", cxxfilerule=cxxfile, diff --git a/build/pkg.py b/build/pkg.py index c8deb1fb..d7f0376a 100644 --- a/build/pkg.py +++ b/build/pkg.py @@ -50,7 +50,7 @@ def _package(self, name, package, fallback, pkgconfig): assert ( fallback - ), f"Required package '{package}' not installed when materialising target '{name}'" + ), f"Required package '{package}' not installed when materialising target '$[name]'" if "cheader_deps" in fallback.args: self.args["cheader_deps"] = fallback.args["cheader_deps"] diff --git a/build/utils.py b/build/utils.py index 4d519886..077fc089 100644 --- a/build/utils.py +++ b/build/utils.py @@ -58,7 +58,7 @@ def objectify(self, name, src: Target, symbol): replaces=self, ins=["build/_objectify.py", src], outs=[f"={basename(filenameof(src))}.h"], - commands=["$(PYTHON) {ins[0]} {ins[1]} " + symbol + " > {outs}"], + commands=["$(PYTHON) $[ins[0]] $[ins[1]] " + symbol + " > $[outs]"], label="OBJECTIFY", ) @@ -78,7 +78,7 @@ def test( replaces=self, ins=[command], outs=["=sentinel"], - commands=["{ins[0]}", "touch {outs}"], + commands=["$[ins[0]]", "touch {outs}"], deps=deps, label=label, ) diff --git a/extras/build.py b/extras/build.py index dfacafa6..c7797330 100644 --- a/extras/build.py +++ b/extras/build.py @@ -13,7 +13,7 @@ def manpage(self, name, date, version, src: Target): + date + "/g; s/@@@VERSION@@@/" + version - + "/g' {ins} > {outs}" + + "/g' $[ins] > $[outs]" ], label="MANPAGE", ) @@ -38,8 +38,8 @@ def manpage(self, name, date, version, src: Target): ins=["./icon.png"], outs=["=wordgrinder.iconset"], commands=[ - "mkdir -p {outs[0]}", - "sips -z 64 64 {ins[0]} --out {outs[0]}/icon_32x32@2x.png > /dev/null", + "mkdir -p $[outs[0]]", + "sips -z 64 64 $[ins[0]] --out $[outs[0]]/icon_32x32@2x.png > /dev/null", ], label="ICONSET", ) @@ -48,7 +48,6 @@ def manpage(self, name, date, version, src: Target): name="wordgrinder_icns", ins=[".+wordgrinder_iconset"], outs=["=wordgrinder.icns"], - commands=["iconutil -c icns -o {outs[0]} {ins[0]}"], + commands=["iconutil -c icns -o $[outs[0]] $[ins[0]]"], label="ICONUTIL", ) - diff --git a/src/c/arch/glfw/build.py b/src/c/arch/glfw/build.py index b4db6185..3b92f5a5 100644 --- a/src/c/arch/glfw/build.py +++ b/src/c/arch/glfw/build.py @@ -22,6 +22,7 @@ name="glfw", srcs=[ "./font.cc", + "./gui.h", "./main.cc", "./utils.cc", "tools+icon_cc", diff --git a/src/c/arch/win32/build.py b/src/c/arch/win32/build.py index 04b5cdcc..91245247 100644 --- a/src/c/arch/win32/build.py +++ b/src/c/arch/win32/build.py @@ -20,16 +20,16 @@ name="wordgrinder-stripped", ins=["src/c+wordgrinder-wincon"], outs=["=wordgrinder-stripped.exe"], - commands=["strip {ins[0]} -o {outs[0]}"], - label="STRIP" + commands=["strip $[ins[0]] -o $[outs[0]]"], + label="STRIP", ) simplerule( name="wordgrinder-windows-stripped", ins=["src/c+wordgrinder-glfw-windows"], outs=["=wordgrinder-windows-stripped.exe"], - commands=["strip {ins[0]} -o {outs[0]}"], - label="STRIP" + commands=["strip $[ins[0]] -o $[outs[0]]"], + label="STRIP", ) makensis( diff --git a/src/c/build.py b/src/c/build.py index 70192b38..d6625e66 100644 --- a/src/c/build.py +++ b/src/c/build.py @@ -122,7 +122,7 @@ def make_wordgrinder(name, deps=[], cflags=[], ldflags=[]): ins=[".+wordgrinder_app"], outs=["=wordgrinder-component.pkg"], commands=[ - "pkgbuild --quiet --install-location /Applications --component {ins[0]} {outs[0]}" + "pkgbuild --quiet --install-location /Applications --component $[ins[0]] $[outs[0]]" ], label="PKGBUILD", ) @@ -136,15 +136,15 @@ def make_wordgrinder(name, deps=[], cflags=[], ldflags=[]): ], outs=["=wordgrinder.app"], commands=[ - "rm -rf {outs[0]}", - "cp -a {ins[2]} {outs[0]}", - "touch {outs[0]}", - "cp {ins[0]} {outs[0]}/Contents/MacOS/wordgrinder", - "mkdir -p {outs[0]}/Contents/Resources", - "cp {ins[1]} {outs[0]}/Contents/Resources/wordgrinder.icns", - "dylibbundler -of -x {outs[0]}/Contents/MacOS/wordgrinder -b -d {outs[0]}/Contents/libs -cd > /dev/null", - "cp $$(brew --prefix fmt)/LICENSE* {outs[0]}/Contents/libs/fmt.rst", - "cp $$(brew --prefix glfw)/LICENSE* {outs[0]}/Contents/libs/glfw.md", + "rm -rf $[outs[0]]", + "cp -a $[ins[2]] $[outs[0]]", + "touch $[outs[0]]", + "cp $[ins[0]] $[outs[0]]/Contents/MacOS/wordgrinder", + "mkdir -p $[outs[0]]/Contents/Resources", + "cp $[ins[1]] $[outs[0]]/Contents/Resources/wordgrinder.icns", + "dylibbundler -of -x $[outs[0]]/Contents/MacOS/wordgrinder -b -d $[outs[0]]/Contents/libs -cd > /dev/null", + "cp $$(brew --prefix fmt)/LICENSE* $[outs[0]]/Contents/libs/fmt.rst", + "cp $$(brew --prefix glfw)/LICENSE* $[outs[0]]/Contents/libs/glfw.md", ], label="MKAPP", ) diff --git a/src/lua/build.py b/src/lua/build.py index 6eb02647..d9d355c5 100644 --- a/src/lua/build.py +++ b/src/lua/build.py @@ -68,5 +68,5 @@ ins=["tools+typechecker", "./_types.d.lua"] + SRCS, outs=["=stamp"], label="TYPECHECK", - commands=["{ins[0]} -t {ins[1]} " + " ".join(SRCS)], + commands=["$[ins[0]] -t $[ins[1]] " + " ".join(SRCS), "touch $[outs]"], ) diff --git a/tests/build.py b/tests/build.py index 3c16ba03..9a597d12 100644 --- a/tests/build.py +++ b/tests/build.py @@ -1,5 +1,6 @@ from build.ab import simplerule, Rule, Target, export from config import TEST_BINARY +from glob import glob TESTS = [ "apply-markup", @@ -85,8 +86,9 @@ def test(self, name, exe: Target = None): replaces=self, ins=["./" + self.localname + ".lua", exe], outs=["=log"], + deps=["./testsuite.lua"] + glob("testdocs/*"), commands=[ - "{ins[1]} --lua {ins[0]} >{outs} 2>&1 || (cat {outs} && rm -f {outs} && false)" + "$[ins[1]] --lua $[ins[0]] >$[outs] 2>&1 || (cat $[outs] && rm -f $[outs] && false)" ], label="TEST", ) diff --git a/third_party/clip/build.py b/third_party/clip/build.py index 9e709015..9e6a3a25 100644 --- a/third_party/clip/build.py +++ b/third_party/clip/build.py @@ -2,7 +2,11 @@ from build.pkg import package from config import HAS_XWORDGRINDER -cxxlibrary(name="clip_common", srcs=["./clip.cpp", "./image.cpp"]) +cxxlibrary( + name="clip_common", + srcs=["./clip.cpp", "./image.cpp"], + hdrs={"clip.h": "./clip.h", "clip_lock_impl.h": "./clip_lock_impl.h"}, +) cxxlibrary( name="clip_none", diff --git a/third_party/cmark/build.py b/third_party/cmark/build.py index eb90ff9d..8d6d3c1f 100644 --- a/third_party/cmark/build.py +++ b/third_party/cmark/build.py @@ -6,6 +6,8 @@ "./src/blocks.c", "./src/buffer.c", "./src/cmark.c", + "./src/case_fold_switch.inc", + "./src/entities.inc", "./src/cmark_ctype.c", "./src/commonmark.c", "./src/houdini_href_e.c", diff --git a/third_party/luau/build.py b/third_party/luau/build.py index 21c1ef83..8c8e07c7 100644 --- a/third_party/luau/build.py +++ b/third_party/luau/build.py @@ -11,7 +11,10 @@ def _compute_header_name(f): LUAU_SRCS = [ f.as_posix() - for f in Path("third_party/luau").glob("**/*.cpp") + for f in ( + list(Path("third_party/luau").glob("*/src/*.cpp")) + + list(Path("third_party/luau").glob("*/src/*.h")) + ) if ("/CLI" not in f.as_posix()) ] LUAU_HDRS = { @@ -23,7 +26,8 @@ def _compute_header_name(f): } cxxlibrary( - name="luau-hdrs", + name="luau", + srcs=LUAU_SRCS, hdrs=LUAU_HDRS | { "lua.h": "./VM/include/lua.h", @@ -49,8 +53,6 @@ def _compute_header_name(f): }, ) -cxxlibrary(name="luau", srcs=LUAU_SRCS, deps=[".+luau-hdrs"]) - cxxprogram( name="analyse", srcs=[ diff --git a/tools/build.py b/tools/build.py index 65f97418..db1f3e7f 100644 --- a/tools/build.py +++ b/tools/build.py @@ -8,7 +8,8 @@ def multibin(self, name, symbol, srcs: Targets = []): replaces=self, ins=srcs, outs=[f"={symbol}.h"], - commands=["sh tools/multibin2c.sh " + symbol + " {ins} > {outs}"], + deps=["tools/multibin2c.sh"], + commands=["sh tools/multibin2c.sh " + symbol + " $[ins] > $[outs]"], label="MULTIBIN", ) @@ -21,6 +22,6 @@ def multibin(self, name, symbol, srcs: Targets = []): name="icon_cc", ins=["./makeicon.py", "extras/icon.png"], outs=["=icon.cc"], - commands=["python3 {ins[0]} {ins[1]} > {outs[0]}"], + commands=["python3 $[ins[0]] $[ins[1]] > $[outs[0]]"], label="MAKEICON", ) diff --git a/tools/makeicon.py b/tools/makeicon.py index 101b8661..3c49b043 100644 --- a/tools/makeicon.py +++ b/tools/makeicon.py @@ -1,13 +1,10 @@ from PIL import Image import sys -bytes = Image.open(sys.argv[1]).resize(size=(128, 128)).convert("RGBA").tobytes() +bytes = ( + Image.open(sys.argv[1]).resize(size=(128, 128)).convert("RGBA").tobytes() +) print("extern const unsigned char icon_data[];") print("const unsigned char icon_data[] = {") print(", ".join([str(b) for b in bytes])) print("};") - - - - - From 6cbb96e4e99598da1192992663f7c00196e7d746 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 01:45:34 +0100 Subject: [PATCH 03/24] Add missing build files. --- build/_objectify.py | 19 +++++++++++++++++++ build/_sandbox.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 build/_objectify.py create mode 100644 build/_sandbox.py diff --git a/build/_objectify.py b/build/_objectify.py new file mode 100644 index 00000000..17148954 --- /dev/null +++ b/build/_objectify.py @@ -0,0 +1,19 @@ +import sys +from functools import partial + +if len(sys.argv) != 3: + sys.exit("Usage: %s " % sys.argv[0]) +filename = sys.argv[1] +symbol = sys.argv[2] + +print("const uint8_t " + symbol + "[] = {") +n = 0 +with open(filename, "rb") as in_file: + for c in iter(partial(in_file.read, 1), b""): + print("0x%02X," % ord(c), end="") + n += 1 + if n % 16 == 0: + print() +print("};") + +print("const size_t " + symbol + "_len = sizeof(" + symbol + ");") diff --git a/build/_sandbox.py b/build/_sandbox.py new file mode 100644 index 00000000..2cebe0ab --- /dev/null +++ b/build/_sandbox.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 + +from os.path import * +import argparse +import os + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-s", "--sandbox") + parser.add_argument("-v", "--verbose", action="store_true") + parser.add_argument("-l", "--link", action="store_true") + parser.add_argument("-e", "--export", action="store_true") + parser.add_argument("files", nargs="*") + args = parser.parse_args() + + assert args.sandbox, "You must specify a sandbox directory" + assert args.link ^ args.export, "You can't link and export at the same time" + + if args.link: + os.makedirs(args.sandbox, exist_ok=True) + for f in args.files: + sf = join(args.sandbox, f) + if args.verbose: + print("link", sf) + os.makedirs(dirname(sf), exist_ok=True) + os.symlink(abspath(f), sf) + + if args.export: + for f in args.files: + sf = join(args.sandbox, f) + if args.verbose: + print("export", sf) + df = dirname(f) + if df: + os.makedirs(df, exist_ok=True) + os.rename(sf, f) + + +main() From 7f1b222714d554ac16bb8c4c4078bce012710e6d Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 01:48:29 +0100 Subject: [PATCH 04/24] Use cp -H rather than cp --dereference to keep OSX happy. --- build/ab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ab.py b/build/ab.py index 5697af04..fec88e45 100644 --- a/build/ab.py +++ b/build/ab.py @@ -573,7 +573,7 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): cwd=self.cwd, ins=[srcs[0]], outs=[destf], - commands=["$(CP) --dereference %s %s" % (srcs[0], destf)], + commands=["$(CP) -H %s %s" % (srcs[0], destf)], label="", ) subrule.materialise() From 0a1c67cc1303b0eec3f1d1e08b6f60356fffaad3 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 01:51:20 +0100 Subject: [PATCH 05/24] Fix OSX build failure. --- src/c/arch/ncurses/dpy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/arch/ncurses/dpy.cc b/src/c/arch/ncurses/dpy.cc index 840c01de..355df5ea 100644 --- a/src/c/arch/ncurses/dpy.cc +++ b/src/c/arch/ncurses/dpy.cc @@ -72,7 +72,7 @@ void dpy_start(void) mouseinterval(0); #if defined A_ITALIC - use_italics = !!tigetstr("sitm"); + use_italics = !!tigetstr((char*) "sitm"); #endif } From 06f8b80fb087ee126579b08677ef7e8b542f5571 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 18:18:09 +0100 Subject: [PATCH 06/24] Rework zip so as to not use zipnote, as it doesn't work right on older (i.e. OSX's version of zip). --- build/_zip.py | 25 +++++++++++++++++++++++++ build/zip.py | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100755 build/_zip.py create mode 100644 build/zip.py diff --git a/build/_zip.py b/build/_zip.py new file mode 100755 index 00000000..f5a49d09 --- /dev/null +++ b/build/_zip.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 + +from os.path import * +import argparse +import os +from zipfile import ZipFile + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-z", "--zipfile") + parser.add_argument("-v", "--verbose", action="store_true") + parser.add_argument("-f", "--file", nargs=2, action="append") + args = parser.parse_args() + + assert args.zipfile, "You must specify a zipfile to create" + + with ZipFile(args.zipfile, mode="w") as zf: + for zipname, filename in args.file: + if args.verbose: + print(filename, "->", zipname) + zf.write(filename, arcname=zipname) + + +main() diff --git a/build/zip.py b/build/zip.py new file mode 100644 index 00000000..5500b7da --- /dev/null +++ b/build/zip.py @@ -0,0 +1,26 @@ +from build.ab import ( + Rule, + simplerule, + TargetsMap, + filenameof, +) + +@Rule +def zip( + self, name, flags="", items: TargetsMap = {}, extension="zip", label="ZIP" +): + cs = ["$(PYTHON) build/_zip.py -z $[outs]"] + + ins = [] + for k, v in items.items(): + cs += [f"-f {k} {filenameof(v)}"] + ins += [v] + + simplerule( + replaces=self, + ins=ins, + deps=["build/_zip.py"], + outs=[f"={self.localname}." + extension], + commands=[" ".join(cs)], + label=label, + ) From eaec07457e8184e3382ebebc555faae300e11b16 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:08:15 +0100 Subject: [PATCH 07/24] Use hardlinks instead of symlinks in the sandbox; symlinks cause problems with some tools. --- build/_sandbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/_sandbox.py b/build/_sandbox.py index 2cebe0ab..d8a7ebd0 100644 --- a/build/_sandbox.py +++ b/build/_sandbox.py @@ -24,7 +24,8 @@ def main(): if args.verbose: print("link", sf) os.makedirs(dirname(sf), exist_ok=True) - os.symlink(abspath(f), sf) + os.link(abspath(f), sf) + os.chmod(sf, 0o500) if args.export: for f in args.files: From 6c28810444de6caddf9000ce4133957dee987f6d Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:09:13 +0100 Subject: [PATCH 08/24] Cleanup. --- build/ab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ab.py b/build/ab.py index fec88e45..bc8fc21d 100644 --- a/build/ab.py +++ b/build/ab.py @@ -494,7 +494,7 @@ def emit_rule(self, ins, outs, cmds=[], label=None): into=lines, ) for c in cmds: - emit(f"\t$(hide) cd {sandbox} &&", c, into=lines) + emit(f"\t$(hide) cd {sandbox} && (", c, ")", into=lines) emit( "\t$(hide)", f"$(PYTHON) build/_sandbox.py --export -s {sandbox}", From 7352d829a7466baa1b87733d7065258bd7804b29 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:09:27 +0100 Subject: [PATCH 09/24] Update the OSX package builder to work with the new improved builder. --- Makefile | 4 ++++ build.py | 1 + extras/build.py | 7 +++---- src/c/build.py | 35 +++++++++++++++++++++++------------ third_party/clip/build.py | 6 +++++- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 6f2541ad..e35b3088 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ ifeq ($(BUILDTYPE),windows) MAKENSIS = makensis EXT = .exe else + ifeq ($(BUILDTYPE),osx) + export BREW := $(shell brew --prefix)/opt + endif + export CC = gcc export CXX = g++ -std=c++20 export CFLAGS diff --git a/build.py b/build.py index 62df8383..980164a9 100644 --- a/build.py +++ b/build.py @@ -29,6 +29,7 @@ { "bin/wordgrinder-osx": "src/c+wordgrinder-glfw-osx", "bin/wordgrinder-osx-ncurses": "src/c+wordgrinder-ncurses", + "bin/wordgrinder-osx.app.zip": "src/c+wordgrinder_app", f"bin/WordGrinder-{VERSION}-setup.pkg": "src/c+wordgrinder_pkg", } if HAS_OSX diff --git a/extras/build.py b/extras/build.py index c7797330..da787c5b 100644 --- a/extras/build.py +++ b/extras/build.py @@ -36,10 +36,9 @@ def manpage(self, name, date, version, src: Target): simplerule( name="wordgrinder_iconset", ins=["./icon.png"], - outs=["=wordgrinder.iconset"], + outs=["=wordgrinder.iconset/icon_32x32@2x.png"], commands=[ - "mkdir -p $[outs[0]]", - "sips -z 64 64 $[ins[0]] --out $[outs[0]]/icon_32x32@2x.png > /dev/null", + "sips -z 64 64 $[ins[0]] --out $[outs[0]] > /dev/null", ], label="ICONSET", ) @@ -48,6 +47,6 @@ def manpage(self, name, date, version, src: Target): name="wordgrinder_icns", ins=[".+wordgrinder_iconset"], outs=["=wordgrinder.icns"], - commands=["iconutil -c icns -o $[outs[0]] $[ins[0]]"], + commands=["iconutil -c icns -o $[outs[0]] $(dir $[ins[0]])"], label="ICONUTIL", ) diff --git a/src/c/build.py b/src/c/build.py index d6625e66..f9b07c42 100644 --- a/src/c/build.py +++ b/src/c/build.py @@ -1,6 +1,10 @@ from build.ab import simplerule from build.c import cxxprogram, cxxlibrary from build.pkg import package +from build.zip import zip +from build.utils import itemsof +from os.path import * +from glob import glob from config import ( FILEFORMAT, HAS_OSX, @@ -122,29 +126,36 @@ def make_wordgrinder(name, deps=[], cflags=[], ldflags=[]): ins=[".+wordgrinder_app"], outs=["=wordgrinder-component.pkg"], commands=[ - "pkgbuild --quiet --install-location /Applications --component $[ins[0]] $[outs[0]]" + "unzip -q -d $[dir] $[ins[0]]", + "pkgbuild --quiet --install-location /Applications --component $[dir]/WordGrinder.app $[outs[0]]" ], label="PKGBUILD", ) + zip( + name="wordgrinder_app_template", + items=itemsof("**", cwd="extras/WordGrinder.app.template") + ) + simplerule( name="wordgrinder_app", ins=[ ".+wordgrinder-glfw-osx", "extras+wordgrinder_icns", - "extras/WordGrinder.app.template/", + ".+wordgrinder_app_template", ], - outs=["=wordgrinder.app"], + outs=["=wordgrinder.app.zip"], commands=[ - "rm -rf $[outs[0]]", - "cp -a $[ins[2]] $[outs[0]]", - "touch $[outs[0]]", - "cp $[ins[0]] $[outs[0]]/Contents/MacOS/wordgrinder", - "mkdir -p $[outs[0]]/Contents/Resources", - "cp $[ins[1]] $[outs[0]]/Contents/Resources/wordgrinder.icns", - "dylibbundler -of -x $[outs[0]]/Contents/MacOS/wordgrinder -b -d $[outs[0]]/Contents/libs -cd > /dev/null", - "cp $$(brew --prefix fmt)/LICENSE* $[outs[0]]/Contents/libs/fmt.rst", - "cp $$(brew --prefix glfw)/LICENSE* $[outs[0]]/Contents/libs/glfw.md", + "mkdir -p $[dir]/WordGrinder.app", + "unzip -q -d $[dir]/WordGrinder.app $[ins[2]]", + "mkdir -p $[dir]/WordGrinder.app/Contents/MacOS", + "cp $[ins[0]] $[dir]/WordGrinder.app/Contents/MacOS/wordgrinder", + "mkdir -p $[dir]/WordGrinder.app/Contents/Resources", + "cp $[ins[1]] $[dir]/WordGrinder.app/Contents/Resources/wordgrinder.icns", + "dylibbundler -of -x $[dir]/WordGrinder.app/Contents/MacOS/wordgrinder -b -d $[dir]/WordGrinder.app/Contents/libs -cd > /dev/null", + "cp $$(brew --prefix fmt)/LICENSE* $[dir]/WordGrinder.app/Contents/libs/fmt.rst", + "cp $$(brew --prefix glfw)/LICENSE* $[dir]/WordGrinder.app/Contents/libs/glfw.md", + "cd $[dir] && zip -qr wordgrinder.app.zip WordGrinder.app", ], label="MKAPP", ) diff --git a/third_party/clip/build.py b/third_party/clip/build.py index 9e6a3a25..0f312af8 100644 --- a/third_party/clip/build.py +++ b/third_party/clip/build.py @@ -5,7 +5,11 @@ cxxlibrary( name="clip_common", srcs=["./clip.cpp", "./image.cpp"], - hdrs={"clip.h": "./clip.h", "clip_lock_impl.h": "./clip_lock_impl.h"}, + hdrs={ + "clip.h": "./clip.h", + "clip_lock_impl.h": "./clip_lock_impl.h", + "clip_common.h": "./clip_common.h", + }, ) cxxlibrary( From 9c83eba7c3d07c16a305cf1291ab671fa5548ddd Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:28:21 +0100 Subject: [PATCH 10/24] Copy files into the sandbox if hardlinking doesn't work. --- build/_sandbox.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/_sandbox.py b/build/_sandbox.py index d8a7ebd0..1e68d856 100644 --- a/build/_sandbox.py +++ b/build/_sandbox.py @@ -3,6 +3,7 @@ from os.path import * import argparse import os +import shutil def main(): @@ -24,7 +25,10 @@ def main(): if args.verbose: print("link", sf) os.makedirs(dirname(sf), exist_ok=True) - os.link(abspath(f), sf) + try: + os.link(abspath(f), sf) + except PermissionError: + shutil.copy(f, sf) os.chmod(sf, 0o500) if args.export: From fd8f3b8eb26a057a26e3023674635d454d8c1b3c Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:48:59 +0100 Subject: [PATCH 11/24] Upgrade WSL to Fedora 41. --- .github/workflows/ccpp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 750313f8..eb2a5d97 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -62,13 +62,13 @@ jobs: steps: - name: setup WSL run: | - curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/39.0.1/Fedora-Remix-for-WSL-SL_39.0.1.0_x64_arm64.msixbundle -o fedora.msixbundle - unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix + curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/41.0.0/Fedora-Remix-for-WSL-SL_41.0.0.0_x64_arm64.msixbundle -o fedora.msixbundle + unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_40.0.0.0_x64.msix unzip Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix install.tar.gz wsl --update wsl --import fedora fedora install.tar.gz wsl --set-default fedora - wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-38-1.noarch.rpm' + wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm' wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-nsis python3-pillow' - name: fix line endings From 8e4ae6b6019b6e1af58556e597c50f259b26a7c7 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:50:27 +0100 Subject: [PATCH 12/24] Typo fix. --- .github/workflows/ccpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index eb2a5d97..2a776568 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -63,8 +63,8 @@ jobs: - name: setup WSL run: | curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/41.0.0/Fedora-Remix-for-WSL-SL_41.0.0.0_x64_arm64.msixbundle -o fedora.msixbundle - unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_40.0.0.0_x64.msix - unzip Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix install.tar.gz + unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix + unzip Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix install.tar.gz wsl --update wsl --import fedora fedora install.tar.gz wsl --set-default fedora From 831b73678f424cb4f5481af01c21c307e0499ab5 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 19:56:02 +0100 Subject: [PATCH 13/24] Another typo fix. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 2a776568..e6f5ddc7 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -69,7 +69,7 @@ jobs: wsl --import fedora fedora install.tar.gz wsl --set-default fedora wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm' - wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-nsis python3-pillow' + wsl sh -c 'dnf -y install --setopt=install_weak_deps=False gcc gcc-c++ mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-nsis python3-pillow' - name: fix line endings run: | From beb41cb9f2b320e39e8381db306fb5e9b68270c4 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 20:11:17 +0100 Subject: [PATCH 14/24] Fix stray {} expansion. --- src/c/glfw-fallback/build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/c/glfw-fallback/build.py b/src/c/glfw-fallback/build.py index d1115818..d885b5f5 100755 --- a/src/c/glfw-fallback/build.py +++ b/src/c/glfw-fallback/build.py @@ -9,8 +9,8 @@ "=glfw-3.4.bin.WIN32/lib-mingw-w64/libglfw3.a", ], commands=[ - "curl -Ls https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN32.zip -o {dir}/glfw.zip", - "cd {dir} && unzip -DD -o -q glfw.zip", + "curl -Ls https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN32.zip -o $[dir]/glfw.zip", + "cd $[dir] && unzip -DD -o -q glfw.zip", ], label="CURLLIBRARY", traits={"clibrary", "cheaders"}, From 5a575ecd8bc49e03b62a63d777f7a9937510b986 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 20:24:33 +0100 Subject: [PATCH 15/24] Add missing include files. --- third_party/fmt/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/fmt/build.py b/third_party/fmt/build.py index e997c20d..293191ea 100644 --- a/third_party/fmt/build.py +++ b/third_party/fmt/build.py @@ -12,6 +12,8 @@ "fmt/chrono.h": "./include/fmt/chrono.h", "fmt/core.h": "./include/fmt/core.h", "fmt/format.h": "./include/fmt/format.h", + "fmt/format-inl.h": "./include/fmt/format-inl.h", + "fmt/os.h": "./include/fmt/os.h", "fmt/ostream.h": "./include/fmt/ostream.h", "fmt/ranges.h": "./include/fmt/ranges.h", }, From beb080344240c7b60b0bc6262135c08d6686c6a8 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 20:34:25 +0100 Subject: [PATCH 16/24] Fix {} expansions. --- build/windows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/windows.py b/build/windows.py index 3fc19529..67919701 100644 --- a/build/windows.py +++ b/build/windows.py @@ -14,7 +14,7 @@ def windres(self, name, srcs: Targets, deps: Targets = [], label="WINDRES"): deps=deps, outs=[f"={self.localname}.o"], label=label, - commands=["$(WINDRES) {ins[0]} {outs[0]}"], + commands=["$(WINDRES) $[ins[0]] $[outs[0]]"], ) @@ -33,6 +33,6 @@ def makensis( outs=[f"={self.localname}.exe"], label=label, commands=[ - "$(MAKENSIS) -nocd -v2 " + d + " -dOUTFILE={outs[0]} {ins[0]}" + "$(MAKENSIS) -nocd -v2 " + d + " -dOUTFILE=$[outs[0]] $[ins[0]]" ], ) From 24b05beefdd72ea4696ebbc884a140dcf05acabc Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 20:59:15 +0100 Subject: [PATCH 17/24] Add missing dependency. --- src/c/arch/win32/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/arch/win32/build.py b/src/c/arch/win32/build.py index 91245247..8dfe3cb2 100644 --- a/src/c/arch/win32/build.py +++ b/src/c/arch/win32/build.py @@ -8,7 +8,7 @@ srcs=[ "./wordgrinder.rc", ], - deps=["./manifest.xml"], + deps=["./manifest.xml", "./icon.ico"], ) clibrary( From 2e237a6688f522179947988e0bbc6c4d7434465d Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 21:12:16 +0100 Subject: [PATCH 18/24] chmodding hardlinks appears to work very badly. --- build/_sandbox.py | 1 - 1 file changed, 1 deletion(-) diff --git a/build/_sandbox.py b/build/_sandbox.py index 1e68d856..2450c537 100644 --- a/build/_sandbox.py +++ b/build/_sandbox.py @@ -29,7 +29,6 @@ def main(): os.link(abspath(f), sf) except PermissionError: shutil.copy(f, sf) - os.chmod(sf, 0o500) if args.export: for f in args.files: From b07a13717bda7fd6220122e37ce385a3d37c1815 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 21:13:22 +0100 Subject: [PATCH 19/24] Add missing dependency. --- third_party/clip/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/clip/build.py b/third_party/clip/build.py index 0f312af8..01a35399 100644 --- a/third_party/clip/build.py +++ b/third_party/clip/build.py @@ -37,7 +37,7 @@ cxxlibrary( name="clip_win", - srcs=["./clip_win.cpp"], + srcs=["./clip_win.cpp", "./clip_win_wic.h"], hdrs={"clip.h": "./clip.h"}, deps=[".+clip_common"], ) From 07ff25f5c8b92e0ce718e7e1e9ab5bd956a67130 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 21:21:00 +0100 Subject: [PATCH 20/24] Even more dependencies. --- src/c/arch/win32/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/c/arch/win32/build.py b/src/c/arch/win32/build.py index 8dfe3cb2..81167ca2 100644 --- a/src/c/arch/win32/build.py +++ b/src/c/arch/win32/build.py @@ -35,6 +35,12 @@ makensis( name="installer", srcs=["extras/windows-installer.nsi"], - deps=[".+wordgrinder-stripped", ".+wordgrinder-windows-stripped"], + deps=[ + ".+wordgrinder-stripped", + ".+wordgrinder-windows-stripped", + "README.wg", + "extras/british.dictionary", + "extras/american-canadian.dictionary", + ], defs={"VERSION": VERSION}, ) From 759f172cd61932fa38e3702a7f953de308653158 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 21:29:52 +0100 Subject: [PATCH 21/24] More missing dependencies. --- src/c/arch/win32/build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/c/arch/win32/build.py b/src/c/arch/win32/build.py index 81167ca2..8d8be554 100644 --- a/src/c/arch/win32/build.py +++ b/src/c/arch/win32/build.py @@ -2,6 +2,7 @@ from build.c import clibrary from build.windows import windres, makensis from config import VERSION +from glob import glob windres( name="rc", @@ -41,6 +42,6 @@ "README.wg", "extras/british.dictionary", "extras/american-canadian.dictionary", - ], + ] + glob("licenses/COPYING.*"), defs={"VERSION": VERSION}, ) From dd2ae104e0a67c7d1244440fd0007dd065efa6af Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 21:53:53 +0100 Subject: [PATCH 22/24] Reformat. --- build/zip.py | 1 + src/c/arch/win32/build.py | 3 ++- src/c/build.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/zip.py b/build/zip.py index 5500b7da..2b631c69 100644 --- a/build/zip.py +++ b/build/zip.py @@ -5,6 +5,7 @@ filenameof, ) + @Rule def zip( self, name, flags="", items: TargetsMap = {}, extension="zip", label="ZIP" diff --git a/src/c/arch/win32/build.py b/src/c/arch/win32/build.py index 8d8be554..3c4c60d3 100644 --- a/src/c/arch/win32/build.py +++ b/src/c/arch/win32/build.py @@ -42,6 +42,7 @@ "README.wg", "extras/british.dictionary", "extras/american-canadian.dictionary", - ] + glob("licenses/COPYING.*"), + ] + + glob("licenses/COPYING.*"), defs={"VERSION": VERSION}, ) diff --git a/src/c/build.py b/src/c/build.py index f9b07c42..befaed18 100644 --- a/src/c/build.py +++ b/src/c/build.py @@ -127,14 +127,14 @@ def make_wordgrinder(name, deps=[], cflags=[], ldflags=[]): outs=["=wordgrinder-component.pkg"], commands=[ "unzip -q -d $[dir] $[ins[0]]", - "pkgbuild --quiet --install-location /Applications --component $[dir]/WordGrinder.app $[outs[0]]" + "pkgbuild --quiet --install-location /Applications --component $[dir]/WordGrinder.app $[outs[0]]", ], label="PKGBUILD", ) zip( name="wordgrinder_app_template", - items=itemsof("**", cwd="extras/WordGrinder.app.template") + items=itemsof("**", cwd="extras/WordGrinder.app.template"), ) simplerule( From f67d5dbbed54b52e31be66bd96a0cb3cfa5815a0 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 22:19:42 +0100 Subject: [PATCH 23/24] Disable the haiku build --- it never worked right. --- .github/workflows/ccpp.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index e6f5ddc7..f2c27b81 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -38,23 +38,23 @@ jobs: name: ${{ github.event.repository.name }}.osx.${{ github.sha }} path: bin/WordGrinder-0.9-setup.pkg - build-haiku: - runs-on: ubuntu-latest - container: 'docker.io/hectorm/qemu-haiku:latest' - steps: - - name: vmstart - run: 'container-init & timeout 600 vmshell exit 0' + #build-haiku: + # runs-on: ubuntu-latest + # container: 'docker.io/hectorm/qemu-haiku:latest' + # steps: + # - name: vmstart + # run: 'container-init & timeout 600 vmshell exit 0' - - name: pkgman - run: 'vmshell pkgman install -y make glfw_devel pkgconfig zlib_devel ncurses6_devel vim gcc pillow_python310' + # - name: pkgman + # run: 'vmshell pkgman install -y make glfw_devel pkgconfig zlib_devel ncurses6_devel vim gcc pillow_python310' - - uses: 'actions/checkout@main' + # - uses: 'actions/checkout@main' - - name: "copy to VM" - run: 'vmshell mkdir ./src/; tar -cf - ./ | vmshell tar -xf - -C ./src/' + # - name: "copy to VM" + # run: 'vmshell mkdir ./src/; tar -cf - ./ | vmshell tar -xf - -C ./src/' - - name: build - run: 'vmshell make -C ./src/ -j1' + # - name: build + # run: 'vmshell make -C ./src/ -j1' build-windows: runs-on: windows-latest From beecebb9ab1acd459d79cea4c0f3e7056be07a1a Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 16 Mar 2025 22:19:58 +0100 Subject: [PATCH 24/24] Update the WSL version in the release script. --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 946d67af..7653a7af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,14 +17,14 @@ jobs: steps: - name: setup WSL run: | - curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/39.0.1/Fedora-Remix-for-WSL-SL_39.0.1.0_x64_arm64.msixbundle -o fedora.msixbundle - unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix - unzip Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix install.tar.gz + curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/41.0.0/Fedora-Remix-for-WSL-SL_41.0.0.0_x64_arm64.msixbundle -o fedora.msixbundle + unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix + unzip Fedora-Remix-for-WSL-SL_41.0.0.0_x64.msix install.tar.gz wsl --update wsl --import fedora fedora install.tar.gz wsl --set-default fedora - wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-38-1.noarch.rpm' - wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-nsis python3-pillow' + wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm' + wsl sh -c 'dnf -y install --setopt=install_weak_deps=False gcc gcc-c++ mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-nsis python3-pillow' - name: fix line endings run: |