From a6361ecddd5ea0d2c99884c77100b1ec83fda994 Mon Sep 17 00:00:00 2001 From: Will Faust Date: Wed, 16 Sep 2026 10:29:09 +0800 Subject: [PATCH] Licensing: publication boundary, corrected notice, complete build scripts - The converter exception now takes effect when the copyright holder completes an adoption line in LICENSE-EXCEPTION.md, which must happen before any public push, since distribution begins with the push and not with a release tag. .githooks/pre-push refuses a push to a non-local remote while the file is a draft (enable with core.hooksPath). The fork copies and the contribution terms follow that adoption. The file also notes that whether the repository's co-location of the converter, or the built app, forms a combined work is for the legal review. - The bundled third-party notice no longer claims that recipients can rebuild and relink; it states where the source and the documented procedure are and that the clean-checkout rebuild has not been demonstrated. - docs/BUILDING.md no longer refers to prose or private notes for steps: build/wine-pe/build-ntdll.sh (configure, build, strip, pad to SizeOfImage + 0x50000, copy), build/fex-arm64ec/build.sh and build/fex-ios/build.sh (first-run configure with the recorded options, then build and copy). Verification status per step is recorded. - Submodule pointers advance to the forks' wording commits. Co-Authored-By: Claude Fable 5.1 --- .githooks/pre-push | 10 +++++++ CONTRIBUTING.md | 2 +- FEX | 2 +- LICENSE-EXCEPTION.md | 23 ++++++++++++---- app/Madeira/licenses/THIRD-PARTY-NOTICES.txt | 12 ++++---- build/fex-arm64ec/build.sh | 16 +++++++++++ build/fex-ios/build.sh | 15 ++++++++++ build/wine-pe/build-ntdll.sh | 29 ++++++++++++++++++++ docs/BUILDING.md | 6 ++-- research/dxmt | 2 +- research/madeira-d3d12/LICENSE | 4 +-- 11 files changed, 102 insertions(+), 19 deletions(-) create mode 100755 .githooks/pre-push create mode 100755 build/fex-arm64ec/build.sh create mode 100755 build/fex-ios/build.sh create mode 100755 build/wine-pe/build-ntdll.sh diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..db246e2 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,10 @@ +#!/bin/sh +# Refuse to push to a non-local remote while the converter exception is still a +# draft. Distribution starts with the push, not with a tag. Enable with: +# git config core.hooksPath .githooks +url="$2" +case "$url" in /*|file:*) exit 0 ;; esac +if grep -q "^Adopted on: *$" LICENSE-EXCEPTION.md 2>/dev/null || grep -q "DRAFT" LICENSE-EXCEPTION.md 2>/dev/null; then + echo "pre-push: LICENSE-EXCEPTION.md is still a draft (adoption line not completed); refusing to publish to $url" >&2 + exit 1 +fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c717b09..584d919 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,6 +21,6 @@ Madeira links with Apple's proprietary Metal Shader Converter library and Apple system frameworks. Contributions to this repository are accepted under GPL-3.0-or-later **with the Madeira Converter Exception, version 1** (the additional permission in `LICENSE-EXCEPTION.md`, a draft of 2026-09-16 that -takes effect only when adopted in a tagged release), so that the combination +takes effect when its adoption line is completed, before any public push), so that the combination can be conveyed. By submitting a contribution you agree that your contribution carries that additional permission too. diff --git a/FEX b/FEX index c75a94e..c2af557 160000 --- a/FEX +++ b/FEX @@ -1 +1 @@ -Subproject commit c75a94e0ef7df35d1a9a5458051a0bc9a889b6be +Subproject commit c2af5574dda3e23b04b9f35fb4d6055ab6219016 diff --git a/LICENSE-EXCEPTION.md b/LICENSE-EXCEPTION.md index 26d1274..0032ce1 100644 --- a/LICENSE-EXCEPTION.md +++ b/LICENSE-EXCEPTION.md @@ -1,16 +1,25 @@ # Additional permission for the Apple Metal Shader Converter (GPL-3.0 section 7) -DRAFT prepared 2026-09-16 for review. NOT IN EFFECT until adopted in a -tagged release; every copy of this text in the forks and the runtime is -provisional in the same way. See "Scope and authority" for what it can and -cannot cover. +DRAFT prepared 2026-09-16 for review. NOT IN EFFECT until the copyright +holder completes the adoption line below. Distribution begins with the first +push to a public remote, not with a release tag, so the line must be +completed BEFORE any public push (the repository's `.githooks/pre-push` +refuses a remote push while this file is a draft; enable it with +`git config core.hooksPath .githooks`). Every copy of this text in the +forks and the runtime follows this adoption. See "Scope and authority" for +what it can and cannot cover. + +Adopted on: +By: + +(Both blank = draft. Once completed, remove the word DRAFT from this file.) Madeira is licensed under the GNU General Public License, version 3 or (at your option) any later version (see `COPYING`). The following additional permission applies to the parts of Madeira whose copyright is held by the Madeira authors (see "Scope and authority"): -### Madeira Converter Exception, version 1 (DRAFT of 2026-09-16; not in effect until adopted) +### Madeira Converter Exception, version 1 (DRAFT of 2026-09-16; in effect from the adoption date above) Additional permission under GNU GPL version 3 section 7. @@ -53,7 +62,9 @@ It does NOT cover, and nothing here changes: Madeira-authored patches reapplied under LGPL-2.1-or-later, documented in `docs/wine-lgpl-provenance.md`; - the Apple libraries themselves. The converter library is tracked in this - repository and distributed only under Apple's agreement + repository (whether that co-location, or the built app, forms a combined + work with the GPL code is a question for the legal review, not settled by + this file) and it is distributed only under Apple's agreement (`app/Madeira/d3d12/METAL-SHADER-CONVERTER-AGREEMENT.txt`, section 2.B: distribution "for the sole purpose of shader conversion"). diff --git a/app/Madeira/licenses/THIRD-PARTY-NOTICES.txt b/app/Madeira/licenses/THIRD-PARTY-NOTICES.txt index d47a8b3..eca1fc5 100644 --- a/app/Madeira/licenses/THIRD-PARTY-NOTICES.txt +++ b/app/Madeira/licenses/THIRD-PARTY-NOTICES.txt @@ -29,9 +29,11 @@ Dynamically loaded at runtime: (d3d12/LICENSE-metal-shader-converter-headers.txt). LGPL notice: this application uses the LGPL-licensed libraries above. Their -complete corresponding source is in the Madeira repository, and the -application's own source there allows a recipient to rebuild and relink it -with modified versions of those libraries (the recipient rebuild procedure -is documented in docs/LICENSING.md, where its verification status is also -recorded). Reverse engineering the combined work for debugging such +complete corresponding source, and the application's own source and build +scripts, are in the Madeira repository. The procedure for rebuilding the +application against modified versions of those libraries is documented in +docs/BUILDING.md in that repository, together with the inputs it needs that +the repository does not contain and the verification status of each step; +as of 2026-09-16 that end-to-end rebuild has not been demonstrated from a +clean checkout. Reverse engineering the combined work for debugging such modifications is permitted. diff --git a/build/fex-arm64ec/build.sh b/build/fex-arm64ec/build.sh new file mode 100755 index 0000000..675cd33 --- /dev/null +++ b/build/fex-arm64ec/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Configure (first time) and build the ARM64EC FEX module (libarm64ecfex.dll, +# shipped as xtajit64.dll). Options mirror the development build's CMakeCache. +set -eu +R="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +export PATH="$R/toolchains/llvm-mingw-20260421-ucrt-macos-universal/bin:$PATH" +B="$R/FEX/build-arm64ec" +if [ ! -f "$B/CMakeCache.txt" ]; then + cmake -S "$R/FEX" -B "$B" -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE="$R/FEX/Data/CMake/toolchain_mingw.cmake" \ + -DENABLE_FEX_ALLOCATOR=ON -DENABLE_JEMALLOC_GLIBC_ALLOC=ON -DENABLE_OFFLINE_RUNTIME=ON \ + -DBUILD_FEXCONFIG=ON -DENABLE_CLANG_THUNKS=ON -DENABLE_CCACHE=ON \ + -DBUILD_TESTING=OFF -DBUILD_THUNKS=OFF -DENABLE_ASSERTIONS=OFF +fi +cmake --build "$B" --target arm64ecfex +cp "$B/Bin/libarm64ecfex.dll" "$R/app/Madeira/arm64ec-windows/xtajit64.dll" && ls -l "$R/app/Madeira/arm64ec-windows/xtajit64.dll" diff --git a/build/fex-ios/build.sh b/build/fex-ios/build.sh new file mode 100755 index 0000000..ce3cc60 --- /dev/null +++ b/build/fex-ios/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Configure (first time) and build the FEXCore static libraries the app links +# (FEX/build-ios/FEXCore/Source/*.a and External/*). Options mirror the +# development build's CMakeCache. +set -eu +R="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +B="$R/FEX/build-ios" +if [ ! -f "$B/CMakeCache.txt" ]; then + cmake -S "$R/FEX" -B "$B" -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 \ + -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=17.0 -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=OFF -DBUILD_THUNKS=OFF -DBUILD_FEXCONFIG=OFF -DBUILD_FEX_LINUX_TESTS=OFF \ + -DENABLE_FEX_ALLOCATOR=OFF -DENABLE_ASSERTIONS=OFF -DENABLE_CLANG_THUNKS=ON -DENABLE_CCACHE=ON +fi +cmake --build "$B" --target FEXCore FEXCore_Base +ls "$B/FEXCore/Source/"*.a diff --git a/build/wine-pe/build-ntdll.sh b/build/wine-pe/build-ntdll.sh new file mode 100755 index 0000000..1722a6c --- /dev/null +++ b/build/wine-pe/build-ntdll.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Build the ARM64EC PE ntdll from the wine submodule and post-process it the way +# the app needs: strip, then pad with zeros to SizeOfImage + 0x50000 (the loader +# maps the file image; the padding is the slack the iOS mapping path relies on). +# Other PE modules: `make -C dlls/` in the same build tree, then copy the +# .dll from dlls//arm64ec-windows/ to app/Madeira/arm64ec-windows/ (no +# strip/pad for those). Requires the llvm-mingw toolchain (docs/BUILDING.md). +set -eu +R="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +TC="$R/toolchains/llvm-mingw-20260421-ucrt-macos-universal/bin" +export PATH="$TC:$PATH" +B="$R/wine/build-arm64ec" +if [ ! -f "$B/config.status" ]; then + mkdir -p "$B" && cd "$B" && ../configure --enable-archs=arm64ec --without-x --disable-tests +fi +cd "$B" && make -C dlls/ntdll +SRC="$B/dlls/ntdll/arm64ec-windows/ntdll.dll"; OUT="$R/app/Madeira/arm64ec-windows/ntdll.dll" +cp "$SRC" "$OUT.tmp" +"$TC/arm64ec-w64-mingw32-strip" "$OUT.tmp" +python3 - "$OUT.tmp" <<'PY' +import struct, sys +p = sys.argv[1]; d = open(p, 'rb').read() +pe = struct.unpack_from(' `FEX/build-ios/FEXCore/Source/lib{FEXCore,FEXCore_Base,JemallocLibs}.a` and `External/{cephes,fmt,SoftFloat-3e,xxhash}` archives (values read back from CMakeCache). UNVERIFIED from clean. - - `FEX/build-arm64ec`: with the llvm-mingw `bin` on PATH, `make arm64ecfex` -> `Bin/libarm64ecfex.dll`, copied to `app/Madeira/arm64ec-windows/xtajit64.dll`. Verified this session (rebuilt ml905). + - `FEX/build-ios`: `build/fex-ios/build.sh` (same options as the development CMakeCache) -> `FEX/build-ios/FEXCore/Source/lib{FEXCore,FEXCore_Base,JemallocLibs}.a` and the `External/{cephes,fmt,SoftFloat-3e,xxhash}` archives. UNVERIFIED from clean. + - `FEX/build-arm64ec`: `build/fex-arm64ec/build.sh` (configures with `FEX/Data/CMake/toolchain_mingw.cmake` and the recorded options on first run, builds target `arm64ecfex`, copies `Bin/libarm64ecfex.dll` to `app/Madeira/arm64ec-windows/xtajit64.dll`). The build step was verified this session; the first-run configure in the script is reconstructed from CMakeCache and UNVERIFIED. 3. Wine (submodule, branch madeira-lgpl): - unix side: `build/ntdll-unix/build.sh`, `build/wineserver/build.sh`, `build/win32u-unix/build.sh` -> `app/Madeira/lib{ntdll_unix,wineserver,win32u_unix}.a`. Verified on the development machine. - - PE side: `wine/build-arm64ec` configured with `--enable-archs=arm64ec --without-x --disable-tests` (from config.status), llvm-mingw on PATH, `make -C dlls/ntdll` etc.; ntdll.dll is then stripped and padded (memory: reference_build_and_deploy_chains) and the PE modules copied to `app/Madeira/arm64ec-windows/` (tracked). UNVERIFIED from clean. + - PE side: `build/wine-pe/build-ntdll.sh` (configures `wine/build-arm64ec` with `--enable-archs=arm64ec --without-x --disable-tests` on first run, builds `dlls/ntdll`, strips, pads to SizeOfImage + 0x50000, copies to the app). Other PE modules: `make -C dlls/` in that tree and copy the DLL, as the script's header says. The strip/pad step was verified this session; the configure step is UNVERIFIED from clean. 4. DXMT (submodule, branch ios-port): - unix side: `build/dxmt-ios/build.sh` (needs `toolchains/llvm-ios-build`) -> `app/Madeira/libdxmt_combined.a` (ignored; the app links it). Verified this session. - PE side: `meson setup research/dxmt/build-arm64ec research/dxmt -Dbuildtype=release -Dwine_build_path=../../wine/build-arm64ec --cross-file=research/dxmt/build-arm64ec-win.txt` then `ninja -C research/dxmt/build-arm64ec src/winemetal/winemetal.dll` (and d3d11.dll) -> copied to `app/Madeira/arm64ec-windows/`. Verified this session (winemetal.dll). diff --git a/research/dxmt b/research/dxmt index b3075b2..7365002 160000 --- a/research/dxmt +++ b/research/dxmt @@ -1 +1 @@ -Subproject commit b3075b2284304c1e069ef1490580892fa9c44067 +Subproject commit 736500213907bb7a6ad0919ec163709d872440e4 diff --git a/research/madeira-d3d12/LICENSE b/research/madeira-d3d12/LICENSE index 12edfa5..6875131 100644 --- a/research/madeira-d3d12/LICENSE +++ b/research/madeira-d3d12/LICENSE @@ -11,8 +11,8 @@ The Madeira Converter Exception, version 1 (../../LICENSE-EXCEPTION.md in this repository: an additional permission under GPL-3.0 section 7 for combining with the Apple Metal Shader Converter dynamic library and Apple system frameworks) is offered -for this runtime as a DRAFT of 2026-09-16 and is not in effect until it is -adopted in a tagged release. +for this runtime as a DRAFT of 2026-09-16 and is not in effect until the +adoption line in that file is completed. The Apple Metal Shader Converter headers it compiles against are Apache-2.0 (see app/Madeira/d3d12/LICENSE-metal-shader-converter-headers.txt); the