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
42 changes: 35 additions & 7 deletions .github/workflows/build-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ jobs:
path: ${{ env.CCACHE_DIR }}
key: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-
# Source tarballs come from their upstream hosts, one of which returning
# 503 is enough to fail a leg; keyed by OS so every host of a kind shares.
- uses: actions/cache@v6
with:
path: ${{ github.workspace }}/build/downloads
key: downloads-${{ runner.os }}-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: downloads-${{ runner.os }}-
- name: Build stage 1 host ${{ matrix.name }}
shell: bash
run: |
Expand All @@ -111,9 +118,10 @@ jobs:
stage2:
name: stage2 (${{ matrix.name }})
needs: [gate, stage1]
# A failed host is not this shell's call to make; only a cancellation is.
if: |
always() && needs.gate.result == 'success' &&
needs.stage1.result != 'failure' && needs.stage1.result != 'cancelled' &&
needs.stage1.result != 'cancelled' &&
needs.gate.outputs.stage2_hosts != '[]'
strategy:
fail-fast: false
Expand Down Expand Up @@ -145,6 +153,13 @@ jobs:
path: ${{ env.CCACHE_DIR }}
key: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-
# Source tarballs come from their upstream hosts, one of which returning
# 503 is enough to fail a leg; keyed by OS so every host of a kind shares.
- uses: actions/cache@v6
with:
path: ${{ github.workspace }}/build/downloads
key: downloads-${{ runner.os }}-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: downloads-${{ runner.os }}-
- name: Build stage 2 host ${{ matrix.name }}
shell: bash
run: |
Expand All @@ -167,9 +182,10 @@ jobs:
stage3:
name: stage3 (${{ matrix.name }})
needs: [gate, stage2]
# A failed host is not this shell's call to make; only a cancellation is.
if: |
always() && needs.gate.result == 'success' &&
needs.stage2.result != 'failure' && needs.stage2.result != 'cancelled' &&
needs.stage2.result != 'cancelled' &&
needs.gate.outputs.stage3_hosts != '[]'
strategy:
fail-fast: false
Expand Down Expand Up @@ -201,6 +217,13 @@ jobs:
path: ${{ env.CCACHE_DIR }}
key: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: stage${{ matrix.stage }}-${{ matrix.name }}-ccache-
# Source tarballs come from their upstream hosts, one of which returning
# 503 is enough to fail a leg; keyed by OS so every host of a kind shares.
- uses: actions/cache@v6
with:
path: ${{ github.workspace }}/build/downloads
key: downloads-${{ runner.os }}-${{ needs.gate.outputs.buildscripts_revision }}
restore-keys: downloads-${{ runner.os }}-
- name: Build stage 3 host ${{ matrix.name }}
shell: bash
run: |
Expand All @@ -226,9 +249,10 @@ jobs:
smoke-windows-bootstrap:
name: Smoke test the Windows bootstrap
needs: [gate, stage3]
# A failed host is not this shell's call to make; only a cancellation is.
if: |
always() && needs.gate.result == 'success' &&
needs.stage3.result != 'failure' && needs.stage3.result != 'cancelled'
needs.stage3.result != 'cancelled'
runs-on: windows-2025
steps:
- uses: actions/checkout@v7
Expand All @@ -251,12 +275,16 @@ jobs:
group:
name: Group the release tree
needs: [gate, stage1, stage2, stage3, smoke-windows-bootstrap]
# Required-host policy is the caller's, not this shell's, so a host that
# failed to build only removes itself. A failed smoke test is different:
# it says a host built something broken, and that must not reach a tree.
if: |
always() && needs.gate.result == 'success' &&
needs.stage1.result != 'failure' && needs.stage1.result != 'cancelled' &&
needs.stage2.result != 'failure' && needs.stage2.result != 'cancelled' &&
needs.stage3.result != 'failure' && needs.stage3.result != 'cancelled' &&
needs['smoke-windows-bootstrap'].result != 'failure' && needs['smoke-windows-bootstrap'].result != 'cancelled'
needs.stage1.result != 'cancelled' &&
needs.stage2.result != 'cancelled' &&
needs.stage3.result != 'cancelled' &&
needs['smoke-windows-bootstrap'].result != 'cancelled' &&
needs['smoke-windows-bootstrap'].result != 'failure'
runs-on: ubuntu-24.04
outputs:
build_id: ${{ needs.gate.outputs.build_id }}
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ endif()
get_host_triplet(host_native)
get_build_triplet(build_native)

# What this host is called where it is published -- in artifact names, in the
# package architecture, in the vdpm bundle it embeds. It is the toolchain
# triplet on every host but FreeBSD, whose cross compiler carries a release
# number (x86_64-unknown-freebsd14-gcc) that its published name does not.
string(REGEX REPLACE "^(.*-unknown-freebsd)[0-9]+$" "\\1"
host_published_default "${host_native}")
set(VITASDK_HOST_NAME "${host_published_default}" CACHE STRING
"Name this host publishes under, if not its toolchain triplet")
set(host_published "${VITASDK_HOST_NAME}")

message(STATUS "Host: ${host_native}")
message(STATUS "Build: ${build_native}")
message(STATUS "Target: ${target_arch}")
Expand Down
22 changes: 11 additions & 11 deletions cmake/hosts.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"hosts": [
{ "name": "x86_64-linux-gnu", "stage": 1, "runner": "ubuntu-24.04", "container": "ubuntu:20.04", "packaged": false },
{ "name": "x86_64-linux-gnu", "stage": 2, "runner": "ubuntu-24.04", "container": "ubuntu:20.04", "packaged": true },
{ "name": "aarch64-linux-gnu", "stage": 2, "runner": "ubuntu-24.04-arm", "container": "ubuntu:20.04", "packaged": true },
{ "name": "arm64-apple-darwin", "stage": 2, "runner": "macos-14", "container": null, "packaged": true },
{ "name": "x86_64-linux-musl", "stage": 2, "runner": "ubuntu-24.04", "container": null, "packaged": false },
{ "name": "aarch64-linux-musl", "stage": 2, "runner": "ubuntu-24.04-arm", "container": null, "packaged": false },
{ "name": "x86_64-w64-mingw32", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": true, "build_host": "x86_64-linux-gnu" },
{ "name": "i686-w64-mingw32", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": false, "build_host": "x86_64-linux-gnu" },
{ "name": "x86_64-unknown-freebsd", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": false, "build_host": "x86_64-linux-gnu" },
{ "name": "aarch64-unknown-freebsd", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": false, "build_host": "x86_64-linux-gnu" },
{ "name": "x86_64-apple-darwin", "stage": 3, "runner": "macos-14", "container": null, "packaged": false, "build_host": "arm64-apple-darwin" }
{"name": "x86_64-linux-gnu", "stage": 1, "runner": "ubuntu-24.04", "container": "ubuntu:20.04", "packaged": false},
{"name": "x86_64-linux-gnu", "stage": 2, "runner": "ubuntu-24.04", "container": "ubuntu:20.04", "packaged": true},
{"name": "aarch64-linux-gnu", "stage": 2, "runner": "ubuntu-24.04-arm", "container": "ubuntu:20.04", "packaged": true},
{"name": "arm64-apple-darwin", "stage": 2, "runner": "macos-14", "container": null, "packaged": true},
{"name": "x86_64-apple-darwin", "stage": 2, "runner": "macos-15-intel", "container": null, "packaged": true},
{"name": "x86_64-linux-musl", "stage": 2, "runner": "ubuntu-24.04", "container": null, "packaged": true},
{"name": "aarch64-linux-musl", "stage": 2, "runner": "ubuntu-24.04-arm", "container": null, "packaged": true},
{"name": "x86_64-w64-mingw32", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": true, "build_host": "x86_64-linux-gnu"},
{"name": "i686-w64-mingw32", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": false, "build_host": "x86_64-linux-gnu"},
{"name": "x86_64-unknown-freebsd", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": true, "build_host": "x86_64-linux-gnu"},
{"name": "aarch64-unknown-freebsd", "stage": 3, "runner": "ubuntu-24.04", "container": null, "packaged": true, "build_host": "x86_64-linux-gnu"}
]
}
8 changes: 8 additions & 0 deletions cmake/recipes/BuildHostDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
--enable-cxx
--disable-shared
--enable-static
# gmp's x86_64 assembly reaches its lookup tables from the text
# segment, which Apple's linker refuses inside a position-independent
# executable; every host that links this statically wants it anyway.
--with-pic
BUILD_COMMAND ${compiler_flags} ${wrapper_command} $(MAKE)
)

Expand Down Expand Up @@ -354,6 +358,10 @@ function(toolchain_deps toolchain_deps_dir toolchain_install_dir toolchain_suffi
--without-lzma
--without-babeltrace
--without-xxhash
# Every other component here disables it. Left on, gdb links the
# host's libintl -- on Intel macOS that is Homebrew's, which the
# dependency audit refuses and a user's machine would not have.
--disable-nls
--without-debuginfod
--with-gmp=${toolchain_deps_dir}
--with-mpfr=${toolchain_deps_dir}
Expand Down
2 changes: 1 addition & 1 deletion cmake/recipes/BuildHostTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if(vdpm_use_release_bundle)
${VDPM_BUNDLE}
${VDPM_BUNDLE_SHA256}
${CMAKE_INSTALL_PREFIX}
${host_native}
${host_published}
VERBATIM)
else()
ExternalProject_Add(vdpm
Expand Down
20 changes: 10 additions & 10 deletions cmake/recipes/FinalizeSdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if(BUILD_PACMAN_CLIENT)
add_custom_target(package-client-configuration
COMMAND ${CMAKE_COMMAND}
-DOUTPUT=${CMAKE_INSTALL_PREFIX}/etc/pacman.conf
-DHOST_ARCHITECTURE=${host_native}
-DHOST_ARCHITECTURE=${host_published}
-P ${PROJECT_SOURCE_DIR}/cmake/WritePacmanConfig.cmake
DEPENDS vdpm
VERBATIM)
Expand Down Expand Up @@ -159,20 +159,20 @@ add_custom_target(check-static-policy
VERBATIM
)

add_custom_command(OUTPUT "vitasdk-${host_native}-${build_date}.tar.bz2"
COMMAND ${CMAKE_COMMAND} -E tar "cfvj" "vitasdk-${host_native}-${build_date}.tar.bz2" "${CMAKE_INSTALL_PREFIX}"
add_custom_command(OUTPUT "vitasdk-${host_published}-${build_date}.tar.bz2"
COMMAND ${CMAKE_COMMAND} -E tar "cfvj" "vitasdk-${host_published}-${build_date}.tar.bz2" "${CMAKE_INSTALL_PREFIX}"
DEPENDS finalize-sdk
COMMENT "Creating vitasdk-${host_native}-${build_date}.tar.bz2"
COMMENT "Creating vitasdk-${host_published}-${build_date}.tar.bz2"
)

# Create a sdk tarball
add_custom_target(tarball DEPENDS "vitasdk-${host_native}-${build_date}.tar.bz2")
add_custom_target(tarball DEPENDS "vitasdk-${host_published}-${build_date}.tar.bz2")

if(BUILD_PACMAN_CLIENT)
set(VITASDK_BOOTSTRAP_OUTPUT_DIR "${CMAKE_BINARY_DIR}/bootstraps" CACHE PATH
"Output directory for verified VitaSDK bootstrap archives")
set(bootstrap_archive
"${VITASDK_BOOTSTRAP_OUTPUT_DIR}/vitasdk-bootstrap-${host_native}.tar.bz2")
"${VITASDK_BOOTSTRAP_OUTPUT_DIR}/vitasdk-bootstrap-${host_published}.tar.bz2")
add_custom_command(OUTPUT ${bootstrap_archive}
BYPRODUCTS ${bootstrap_archive}.sha256
COMMAND ${CMAKE_COMMAND} -E make_directory ${VITASDK_BOOTSTRAP_OUTPUT_DIR}
Expand All @@ -181,7 +181,7 @@ if(BUILD_PACMAN_CLIENT)
COMMAND ${PROJECT_SOURCE_DIR}/scripts/create-bootstrap-archive.sh
${CMAKE_INSTALL_PREFIX}
${VITASDK_BOOTSTRAP_OUTPUT_DIR}
${host_native}
${host_published}
${VITASDK_SOURCE_DATE_EPOCH}
DEPENDS finalize-sdk
${PROJECT_SOURCE_DIR}/scripts/create-bootstrap-archive.sh
Expand All @@ -193,12 +193,12 @@ if(BUILD_PACMAN_CLIENT)
set(VITASDK_PACKAGE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/packages" CACHE PATH
"Output directory for the vitasdk-core package")
set(core_package
"${VITASDK_PACKAGE_OUTPUT_DIR}/vitasdk-core-${VITASDK_PACKAGE_VERSION}-1-${host_native}.pkg.tar.xz")
"${VITASDK_PACKAGE_OUTPUT_DIR}/vitasdk-core-${VITASDK_PACKAGE_VERSION}-1-${host_published}.pkg.tar.xz")

# A core release is two packages: the toolchain, and the client that
# installs it. Both are outputs, and both have to be gone before a rerun.
file(GLOB stale_client_packages
"${VITASDK_PACKAGE_OUTPUT_DIR}/vdpm-*-1-${host_native}.pkg.tar.xz")
"${VITASDK_PACKAGE_OUTPUT_DIR}/vdpm-*-1-${host_published}.pkg.tar.xz")

add_custom_command(OUTPUT ${core_package}
COMMAND ${CMAKE_COMMAND} -E make_directory ${VITASDK_PACKAGE_OUTPUT_DIR}
Expand All @@ -208,7 +208,7 @@ if(BUILD_PACMAN_CLIENT)
${CMAKE_SOURCE_DIR}/scripts/create-core-package.sh
${CMAKE_INSTALL_PREFIX}
${VITASDK_PACKAGE_OUTPUT_DIR}
${host_native}
${host_published}
${VITASDK_PACKAGE_VERSION}
${VITASDK_SOURCE_REVISION}
DEPENDS finalize-sdk
Expand Down
11 changes: 10 additions & 1 deletion scripts/audit-host-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ set -eu
host_system=${VITASDK_HOST_SYSTEM_NAME:-$(uname -s)}
objdump_command=${VITASDK_OBJDUMP:-objdump}

# Every offender, not the first: each one costs a full build to discover, and
# a host that drags in one library from the machine usually drags in several.
unexpected_count=0

fail_dependency() {
binary=$1
dependency=$2
echo "unexpected dynamic host dependency: $binary -> $dependency" >&2
exit 1
unexpected_count=$((unexpected_count + 1))
}

# One reader for every ELF host; what differs between them is only which
Expand Down Expand Up @@ -153,4 +157,9 @@ case "$host_system" in
;;
esac

if [ "$unexpected_count" -ne 0 ]; then
echo "$unexpected_count unexpected host dependencies" >&2
exit 1
fi

echo "Host dependency audit passed"
Loading
Loading