This is a RFC for the Zig language support in FreeBSD Ports. This Diff
consists of
- USES=zig implementation
- OPT_ZIG_BOOL addition to bsd.options.mk
- ports-mgmt/zig2tuple port for a utility that gathers Zig dependencies
- x11/ghostty port which is a first complex consumer of the proposed machinery
Both ports build in Poudriere, but there are a lot of deficiencies that I need
help dealing with:
- @mat expressed a desire to have ZIG_TUPLE named differently. I'm totally open to bikeshedding on this and I'm sure Kenneth (zig2tuple author) will also agree to rename the tool.
- URLs from ZIG_TUPLE are added to MASTER_SITES. Some dependencies may be hosted on GitHub, which raises the following warning from within the framework:
MASTER_SITES contains https://github.com/natecraddock/zf/archive/:zf
, please use USE_GITHUB instead.
This can be worked around by making zig.mk append a group with a special name,
and Framework to exclude this group from warning. Otherwise, zig2tuple can be
modified to emit GH_TUPLE for such dependencies.
- Zig allows us to choose where to place dependencies listed in ZIG_TUPLE, but it requires directories to be named as it expects. At the same time, we don't know the directory name that is contained inside the dependency archive, so I extract it into an empty temporary directory and then do mv ${TMPDIR}/* ${TARGETDIR}. Not sure if there is a better way to solve this.
- Zig does not have separate build and install stages. At least, I haven't figured a way to separate them, so I made do-build a noop and do-install to perform both building and installing. This allows make restage to work.
- Due to p.3, we do not want Framework to extract Zig dependencies - we're extracting them manually in zig-pre-extract. But Framework lacks the opposite of EXTRACT_ONLY, so for now dependencies get extracted twice. Depending on how p.3 is going to be handled we might or might not want to introduce EXTRACT_NOT.