Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/scripts/contrib_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ TESTS=(
# pkg-config column: neither path needs one, and the veneer step above
# SKIPs the entry when neither is available.
"sqlite/roundtrip|$SQL/test_sqlite.ae||run|"
# xmp: the tracker-module player, built like sqlite: through the module's
# @link and the archives `make contrib` builds -- libxmp from the pinned
# source when it can be fetched, the system libxmp otherwise; the veneer
# step above SKIPs the entry when neither is there. Its modules are written
# by the test, and its std.audio half runs on the headless engine, so it
# needs no sound card. Leak-clean.
"xmp/player|contrib/xmp/test_xmp.ae||leak|"
# templating/native: co-located spec (replaces the four
# tests/integration/native_templating_* dirs). Pure Aether — no system
# library, so no pkg-config column and nothing to skip on.
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/trim_contrib_sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# as contrib.d3d12 and contrib.metal do with theirs (#2208);
# - contrib/sqlite/aether_sqlite.c and the fetched SQLite amalgamation,
# which `ae build --target` compiles for the target (#1372);
# - contrib/xmp/aether_xmp.c and the fetched libxmp source, likewise;
# - the fetched QuickJS amalgamation, which contrib/quickjs/aether_quickjs.c
# (kept by its @source) #includes rather than naming with @source;
# - with --keep-host-bridges, contrib/host/<lang>/aether_host_<lang>.c,
Expand Down Expand Up @@ -71,6 +72,8 @@ find "$dir" -type f \( -name '*.c' -o -name '*.m' \) | while IFS= read -r f; do
# foreign target, so they ship as source.
case "$f" in
*/contrib/sqlite/aether_sqlite.c|*/contrib/sqlite/amalgamation/*.c) continue ;;
# The same for contrib.xmp: its veneer and the fetched libxmp source.
*/contrib/xmp/aether_xmp.c|*/contrib/xmp/libxmp/*) continue ;;
# aether_quickjs.c #includes the QuickJS amalgamation, so no @source
# names it; without this it was deleted and an installed
# contrib.quickjs could not build.
Expand Down
60 changes: 55 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ jobs:
# simply never used. Split restore/save as for the miniaudio object.
# ============================================================
ci-sqlite-cross:
name: contrib.sqlite / self-contained cross builds
name: contrib.sqlite + contrib.xmp / self-contained cross builds
runs-on: ubuntu-26.04
timeout-minutes: 30

Expand All @@ -605,15 +605,16 @@ jobs:
path: |
.zig
.ci-cache/ae-cross
key: sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock') }}-${{ hashFiles('tools/ae_cross.c') }}
key: sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock', 'contrib/xmp/libxmp.lock') }}-${{ hashFiles('tools/ae_cross.c') }}
restore-keys: |
sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock') }}-
sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock', 'contrib/xmp/libxmp.lock') }}-

- name: Provision zig and the SQLite amalgamation
- name: Provision zig, the SQLite amalgamation and the libxmp source
run: |
ZIG="$(./scripts/get-zig.sh "$GITHUB_WORKSPACE/.zig")"
echo "$(dirname "$ZIG")" >> "$GITHUB_PATH"
sh scripts/fetch-sqlite-amalgamation.sh
sh scripts/fetch-libxmp.sh

- name: Build the toolchain
run: make -j"$(nproc)" compiler ae stdlib
Expand All @@ -628,6 +629,17 @@ jobs:
# aarch64 must actually have run, not been skipped for want of qemu.
echo "$out" | grep -q 'aarch64-linux-musl: built, ran the spec'

# contrib.xmp the same way: libxmp's sources compiled per target, cached
# in the same directory, and the module's spec run on both targets.
- name: Cross-build and run contrib.xmp
env:
AETHER_CACHE_DIR: ${{ github.workspace }}/.ci-cache/ae-cross
run: |
out="$(sh tests/integration/xmp_vendored_cross/test_xmp_vendored_cross.sh)"
echo "$out"
echo "$out" | grep -q '\[PASS\]'
echo "$out" | grep -q 'aarch64-linux-musl: built, ran the spec'

# A macOS dylib cross-linked on Linux: its install name and minimum are
# read from the Mach-O load commands. A Mac host rewrites the id after the
# link, so only a non-Mac host catches a cross link that left it unset.
Expand All @@ -648,7 +660,7 @@ jobs:
path: |
.zig
.ci-cache/ae-cross
key: sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock') }}-${{ hashFiles('tools/ae_cross.c') }}
key: sqlite-xobj-${{ hashFiles('scripts/get-zig.sh', 'tools/ae_zig_pin.h', 'contrib/sqlite/amalgamation.lock', 'contrib/xmp/libxmp.lock') }}-${{ hashFiles('tools/ae_cross.c') }}

ci-freebsd-native:
name: FreeBSD / native build + unit tests
Expand Down Expand Up @@ -784,6 +796,18 @@ jobs:
- name: Fetch the pinned SQLite amalgamation
run: sh scripts/fetch-sqlite-amalgamation.sh

# contrib.xmp compiles the pinned libxmp source into build/contrib/
# libxmp.a the same way, fetched explicitly for the same reason.
- name: Fetch the pinned libxmp source
run: sh scripts/fetch-libxmp.sh

- name: Restore libxmp archive cache
id: libxmp_obj_cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ci-cache/libxmp
key: libxmp-obj-ubuntu-22.04-${{ hashFiles('contrib/xmp/libxmp.lock', 'tests/scripts/contrib_build.sh') }}

# The amalgamation's object costs most of a minute to compile; cache it the
# way the miniaudio object is cached. contrib_build.sh names each object by
# a hash of its source, compiler and flags, so a restored directory can
Expand Down Expand Up @@ -817,6 +841,15 @@ jobs:
path: .ci-cache/sqlite
key: sqlite-obj-ubuntu-22.04-${{ hashFiles('contrib/sqlite/amalgamation.lock', 'tests/scripts/contrib_build.sh') }}

- name: Save libxmp archive cache (merge to main, on miss only)
if: >-
github.event_name == 'push' && github.ref == 'refs/heads/main'
&& steps.libxmp_obj_cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ci-cache/libxmp
key: libxmp-obj-ubuntu-22.04-${{ hashFiles('contrib/xmp/libxmp.lock', 'tests/scripts/contrib_build.sh') }}

# A driver is installed above, so contrib/vulkan skipping here would mean
# the GPU path silently stopped being covered. Fail instead.
- name: Assert the Vulkan test actually ran
Expand Down Expand Up @@ -1320,6 +1353,14 @@ jobs:
path: .ci-cache/sqlite
key: sqlite-obj-windows-${{ hashFiles('contrib/sqlite/amalgamation.lock', 'tests/scripts/contrib_build.sh') }}

# And contrib.xmp's libxmp archive, built from its pinned source.
- name: Restore libxmp archive cache
id: libxmp_obj_cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ci-cache/libxmp
key: libxmp-obj-windows-${{ hashFiles('contrib/xmp/libxmp.lock', 'tests/scripts/contrib_build.sh') }}

- name: Build and run the contrib series
# contrib_check.sh probes for each entry's libraries with pkg-config and
# skips the entries whose dependency is absent, so this reports what this
Expand Down Expand Up @@ -1369,6 +1410,15 @@ jobs:
path: .ci-cache/sqlite
key: sqlite-obj-windows-${{ hashFiles('contrib/sqlite/amalgamation.lock', 'tests/scripts/contrib_build.sh') }}

- name: Save libxmp archive cache (merge to main, on miss only)
if: >-
github.event_name == 'push' && github.ref == 'refs/heads/main'
&& steps.libxmp_obj_cache.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ci-cache/libxmp
key: libxmp-obj-windows-${{ hashFiles('contrib/xmp/libxmp.lock', 'tests/scripts/contrib_build.sh') }}

# lavapipe is installed above, so a Vulkan entry that skipped would be
# coverage silently lost. The same assertion as the Linux leg's.
- name: Assert the Vulkan tests actually ran
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,16 @@ jobs:
TARGET=freebsd-x86_64
# The cross-built aetherc cannot run here, so no module artifacts:
# the FreeBSD archive's imports parse the sources. contrib.sqlite's
# archives (lib/contrib/libaether_sqlite.a, libsqlite3.a) are built
# archives (lib/contrib/libaether_sqlite.a, libsqlite3.a) and
# contrib.xmp's (libaether_xmp.a, libxmp.a) are built
# for FreeBSD with the same zig and sysroot, as the Linux and macOS
# legs build theirs natively: without them `-laether_sqlite` failed
# against a FreeBSD release (sae on ghostbsd, 2026-11-11).
PATH="$(dirname "${{ steps.prov.outputs.zig }}"):$PATH" \
AETHER_SYSROOT="${{ steps.prov.outputs.sysroot }}" \
sh scripts/stage-release.sh build/.alien/freebsd-x86_64 release --contrib-target x86_64-freebsd.15.0
ls -l release/lib/contrib/libaether_sqlite.a release/lib/contrib/libsqlite3.a
ls -l release/lib/contrib/libaether_sqlite.a release/lib/contrib/libsqlite3.a \
release/lib/contrib/libaether_xmp.a release/lib/contrib/libxmp.a
# Note the cross-build in the archive so downstream users know it was
# not run through the test suite on FreeBSD.
echo "Cross-built for FreeBSD with zig cc; not run through the test suite on FreeBSD." \
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,6 @@ compiler/aether_frontend_id.h
# Fetched by scripts/fetch-quickjs-amalgamation.sh; pinned in
# contrib/quickjs/amalgamation.lock, never committed.
/contrib/quickjs/amalgamation/
# Fetched by scripts/fetch-libxmp.sh; pinned in contrib/xmp/libxmp.lock,
# never committed.
/contrib/xmp/libxmp/
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,10 @@ test-release-archive: compiler ae stdlib check-archive-exports
test -f "$$verdir/share/aether/tools/ae-fetch/main.ae" || (echo " FAIL: the package fetcher's source is missing (#1362)"; exit 1) && \
test -f "$$verdir/share/aether/contrib/sqlite/amalgamation/sqlite3.c" || (echo " FAIL: the SQLite amalgamation is missing (#1372)"; exit 1) && \
test -f "$$verdir/share/aether/contrib/quickjs/amalgamation/quickjs-amalgam.c" || (echo " FAIL: the QuickJS amalgamation is missing"; exit 1) && \
test -f "$$verdir/share/aether/contrib/xmp/libxmp/sources.txt" || (echo " FAIL: the libxmp source is missing"; exit 1) && \
test -f "$$verdir/share/aether/contrib/xmp/libxmp/src/player.c" || (echo " FAIL: libxmp's sources were trimmed from the archive"; exit 1) && \
test -f "$$verdir/share/aether/contrib/xmp/libxmp/COPYING" || (echo " FAIL: libxmp's licence is missing"; exit 1) && \
test -f "$$verdir/share/aether/contrib/xmp/NOTICE" || (echo " FAIL: contrib/xmp/NOTICE is missing"; exit 1) && \
test -s "$$verdir/share/aether/MANIFEST" || (echo " FAIL: share/aether/MANIFEST missing; ae cannot build from source without it"; exit 1) && \
shipped_specs=$$(find "$$verdir/share/aether" -type f -name 'test_*.ae' | head -5) && \
{ test -z "$$shipped_specs" || (echo " FAIL: co-located specs shipped in the archive (#1584):"; echo "$$shipped_specs" | sed 's/^/ /'; exit 1); } && \
Expand Down Expand Up @@ -2985,6 +2989,7 @@ install: $(VERSION_HEADER) release-build ae stdlib
# Modules covered (v1):
# - sqlite (-lsqlite3)
# - avcodec (FFmpeg's decode libraries)
# - xmp (libxmp: the pinned source, else -lxmp)
# - host/stunt (the test double; dlopens libstunt)
# - host/aether (fork+exec sandboxed child via LD_PRELOAD;
# libc + in-tree sandbox runtime only)
Expand Down Expand Up @@ -3482,7 +3487,11 @@ check-extern-widths: compiler ae stdlib
@./$(EXTERN_WIDTHS_CHECKER) --root tests/extern_widths/fixture --expect 13 tests/extern_widths/fixture \
> $(BUILD_DIR)/extern_widths/self_test.log 2>&1 || \
{ cat $(BUILD_DIR)/extern_widths/self_test.log; exit 1; }
@./$(EXTERN_WIDTHS_CHECKER) --exclude tests/extern_widths/fixture $(EXTERN_WIDTHS_DIRS)
@# contrib/xmp/libxmp is libxmp's fetched release source, which no
@# extern binds (contrib/xmp/aether_xmp.c does). Read as text it seems to
@# define stb_vorbis_* twice, but its vorbis.h renames those to
@# libxmp_vorbis_*, and its tempfile.h its mkstemp to libxmp_mkstemp.
@./$(EXTERN_WIDTHS_CHECKER) --exclude tests/extern_widths/fixture --exclude contrib/xmp/libxmp $(EXTERN_WIDTHS_DIRS)

# -----------------------------------------------------------------
# Raw calls (#3107): a std module binds C through `*_raw` externs and
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/core/run.ae
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ record_rows(t: ptr, best: ptr, out: string) {
if string.starts_with(line, "row ") != 0 {
parts = string.split(line, " ")
if string.array_size(parts) == 4 {
v, err = string.to_double(string.array_get(parts, 2))
v, err = string.to_float(string.array_get(parts, 2))
if err == "" {
record(t, best, string.array_get(parts, 1), string.array_get(parts, 3), v)
}
Expand All @@ -144,7 +144,7 @@ record_phases(t: ptr, best: ptr, out: string, prefix: string) {
if string.starts_with(line, "phase ") != 0 {
parts = string.split(line, " ")
if string.array_size(parts) >= 3 {
v, err = string.to_double(string.array_get(parts, 2))
v, err = string.to_float(string.array_get(parts, 2))
if err == "" {
record(t, best, "${prefix}${string.array_get(parts, 1)}", "ms", v)
}
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/cross-language/lib/benchstats/module.ae
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ number_after(output: string, label: string) -> float {
rest = string.trim(string.substring(line, at + string.length(label), string.length(line)))
words = string.split(rest, " ")
if string.array_size(words) > 0 {
v, err = string.to_double(string.array_get(words, 0))
v, err = string.to_float(string.array_get(words, 0))
if err == "" {
result = v
}
Expand Down Expand Up @@ -229,11 +229,11 @@ parse_cpu_seconds(output: string, is_mac: int) -> float {
w = string.array_get(words, k)
if string.length(w) > 0 {
if w == "user" {
u, e1 = string.to_double(prev)
u, e1 = string.to_float(prev)
if e1 == "" { user = u }
}
if w == "sys" {
s, e2 = string.to_double(prev)
s, e2 = string.to_float(prev)
if e2 == "" { sys = s }
}
prev = w
Expand Down Expand Up @@ -272,7 +272,7 @@ parse_peak_mb(output: string, is_mac: int) -> float {
if string.contains(line, "maximum resident set size") == 1 {
words = string.split(string.trim(line), " ")
if string.array_size(words) > 0 {
b, err = string.to_double(string.array_get(words, 0))
b, err = string.to_float(string.array_get(words, 0))
if err == "" {
result = b / 1048576.0
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/jq/eval.ae
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ _parse_number(s: string) -> (float, string) {
if ed == 0 { return 0.0, "bad exponent" }
}
if i != n { return 0.0, "trailing characters" }
d, err = string.to_double(s)
d, err = string.to_float(s)
if err != "" { return 0.0, err }
return d, ""
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/jq/lexer.ae
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ _lex_number(lx: *Lexer) {
}
}
text = string.substring_n(_src(lx), lx.len, start, lx.pos)
d, err = string.to_double(text)
d, err = string.to_float(text)
if err != "" {
// Out of double range: 1e1000 overflows to infinity (which prints as
// the largest double, as in jq), 1e-1000 underflows to zero.
Expand Down
4 changes: 2 additions & 2 deletions contrib/templating/liquid/module.ae
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ shortest_digits(mag: float) -> (string, int) {
}
}
cand = string.concat(string.concat(string.concat("0.", head), "e"), string.from_int(hd))
back, _berr = string.to_double(cand)
back, _berr = string.to_float(cand)
if back == mag {
// Drop trailing zeros; they carry no digits.
hn = string_length(head)
Expand Down Expand Up @@ -1571,7 +1571,7 @@ ruby_float_text(v: float) -> string {

// A decimal result, printed through Float as Liquid prints it.
ddecimal_out(neg: int, m: string, scale: int) -> string {
d, derr = string.to_double(dtext(neg, m, scale))
d, derr = string.to_float(dtext(neg, m, scale))
if derr != "" {
// Beyond a double's range: Ruby's to_f gives Infinity for a value
// too large and zero for one too small, each with its sign.
Expand Down
44 changes: 44 additions & 0 deletions contrib/xmp/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
contrib.xmp and libxmp
======================

contrib.xmp plays tracker modules through libxmp, the Extended Module
Player library:

https://github.com/libxmp/libxmp

The libxmp release pinned in libxmp.lock is not committed here.
scripts/fetch-libxmp.sh downloads it, checks its SHA-256, and extracts it
into libxmp/ unchanged, together with its licence (libxmp/COPYING); release
archives ship that directory as it was extracted. libxmp is distributed
under the MIT License, reproduced below.

Extended Module Player
Copyright (C) 1996-2026 Claudio Matsuoka and Hipolito Carraro Jr

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Components inside libxmp
------------------------

Some of libxmp's source files come from other projects and carry their own
copyright and licence notices in the files themselves, which ship unchanged:
among them the LHA decoder (lhasa: ISC licence), miniz's inflate and zip
reader (MIT), stb_vorbis (public domain or MIT), the xz decoder (public
domain), the bzip2 decoder (0BSD), MD5 (public domain), and BSD-licensed
fnmatch and mkstemp. Those notices, in libxmp/src/, are part of this notice.
Loading
Loading