diff --git a/.github/workflows/ingot-cast.yml b/.github/workflows/ingot-cast.yml index a550e79..5f9c91a 100644 --- a/.github/workflows/ingot-cast.yml +++ b/.github/workflows/ingot-cast.yml @@ -183,7 +183,9 @@ jobs: done # === Step 3: Generate build matrix === - # Cross each build-type mold with all Tier 1 platforms from platforms.toml. + # Cross each build-type mold with its supported platforms. + # If source.platforms.supported is specified, only those platforms are used. + # Otherwise, all Tier 1 platforms from platforms.toml are used. # The matrix is consumed by cast-build-configure/make/package jobs. if [[ "$HAS_BUILD" == "true" ]]; then @@ -213,21 +215,33 @@ jobs: mold = os.environ['MOLD_VAR'] with open(f'{mold}/mold.toml', 'rb') as f: data = tomllib.load(f) + supported = data.get('source', {}).get('platforms', {}).get('supported', []) print(json.dumps({ 'family': data['metadata']['family'], 'version': data['metadata']['version'], - 'glibc_min': data.get('source', {}).get('glibc_min', '') + 'glibc_min': data.get('source', {}).get('glibc_min', ''), + 'supported_platforms': supported })) ") FAMILY=$(echo "$MOLD_META" | jq -r '.family') VERSION=$(echo "$MOLD_META" | jq -r '.version') GLIBC_MIN=$(echo "$MOLD_META" | jq -r '.glibc_min') + SUPPORTED_PLATFORMS=$(echo "$MOLD_META" | jq -r '.supported_platforms | if length > 0 then .[] else empty end') while IFS= read -r platform_entry; do [[ -z "$platform_entry" ]] && continue PLAT=$(echo "$platform_entry" | jq -r '.platform') ARCH=$(echo "$platform_entry" | jq -r '.arch') + + # Filter by mold's supported platforms if specified + if [[ -n "$SUPPORTED_PLATFORMS" ]]; then + PLATFORM_ID="${PLAT}-${ARCH}" + if ! echo "$SUPPORTED_PLATFORMS" | grep -qx "$PLATFORM_ID"; then + echo " Skip: ${mold} ${PLATFORM_ID} (not in source.platforms.supported)" + continue + fi + fi RUNNER=$(echo "$platform_entry" | jq -r '.runner') CONTAINER=$(echo "$platform_entry" | jq -r '.container // ""') @@ -615,7 +629,7 @@ jobs: MOLD_META_FILES["$KEY"]+="${meta_file}"$'\n' done - # Read Tier 1 platform count for completeness check + # Read Tier 1 platform count (default for molds without source.platforms) TIER1_COUNT=$(python3 -c " import tomllib with open('platforms.toml', 'rb') as f: @@ -634,12 +648,31 @@ jobs: [[ -z "${META_LIST[-1]}" ]] && unset 'META_LIST[-1]' PLATFORM_COUNT=${#META_LIST[@]} + # Determine expected platform count: intersect source.platforms.supported + # with Tier 1 platforms. If source.platforms is omitted, use Tier 1 count. + MOLD_DIR="molds/${key}" + EXPECTED_COUNT=$(MOLD_VAR="$MOLD_DIR" python3 -c " + import tomllib, os + mold = os.environ['MOLD_VAR'] + with open(f'{mold}/mold.toml', 'rb') as f: + mold_data = tomllib.load(f) + with open('platforms.toml', 'rb') as f: + plat_data = tomllib.load(f) + tier1_ids = {f\"{p['platform']}-{p['arch']}\" for p in plat_data['platforms']['tier1']} + supported = mold_data.get('source', {}).get('platforms', {}).get('supported', []) + if supported: + count = len(set(supported) & tier1_ids) + else: + count = len(tier1_ids) + print(count) + ") + echo "" - echo "=== Processing: ${key} (${PLATFORM_COUNT}/${TIER1_COUNT} platforms) ===" + echo "=== Processing: ${key} (${PLATFORM_COUNT}/${EXPECTED_COUNT} platforms) ===" - # Per-mold completeness check: skip if not all Tier 1 platforms present - if [[ "$PLATFORM_COUNT" -lt "$TIER1_COUNT" ]]; then - echo "::warning::Skipping ${key}: only ${PLATFORM_COUNT}/${TIER1_COUNT} platforms available" + # Per-mold completeness check: skip if not all expected platforms present + if [[ "$PLATFORM_COUNT" -lt "$EXPECTED_COUNT" ]]; then + echo "::warning::Skipping ${key}: only ${PLATFORM_COUNT}/${EXPECTED_COUNT} platforms available" SKIP_COUNT=$((SKIP_COUNT + 1)) continue fi diff --git a/molds/gcc/15.2.0/mold.toml b/molds/gcc/15.2.0/mold.toml index c41b109..e2c319b 100644 --- a/molds/gcc/15.2.0/mold.toml +++ b/molds/gcc/15.2.0/mold.toml @@ -15,6 +15,11 @@ stdlib = "libstdc++" [source] type = "build" +# GCC 15.2.0 does not support aarch64-apple-darwin natively. +# Homebrew applies custom patches (iains/gcc-14-branch) to enable it. +[source.platforms] +supported = ["linux-x86_64", "linux-aarch64"] + [source.build] source_url = "https://ftp.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" source_sha256 = "438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e" diff --git a/schema/mold-v1.schema.json b/schema/mold-v1.schema.json index 22822e9..7e0c32f 100644 --- a/schema/mold-v1.schema.json +++ b/schema/mold-v1.schema.json @@ -109,10 +109,27 @@ "pattern": "^[0-9]+\\.[0-9]+$", "description": "Minimum glibc version required by pre-built binaries (e.g., 2.34). When specified, the build container is selected to satisfy this requirement." }, + "platforms": { "$ref": "#/$defs/platformSupport" }, "build_fallback": { "$ref": "#/$defs/buildFallback" }, "build": { "$ref": "#/$defs/buildDefinition" } } }, + "platformSupport": { + "type": "object", + "additionalProperties": false, + "properties": { + "supported": { + "type": "array", + "items": { + "type": "string", + "pattern": "^(linux|darwin)-(x86_64|aarch64)$" + }, + "minItems": 1, + "uniqueItems": true, + "description": "Platforms this mold officially supports. If omitted, all Tier 1 platforms are assumed." + } + } + }, "sourceFetchRequired": { "if": { "properties": {