Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
142 changes: 142 additions & 0 deletions .github/workflows/build-steam-targets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Build Steam Components

on:
pull_request:
branches: [ main, master, proton_10.0 ]
merge_group:
branches: [ main, master, proton_10.0 ]
workflow_dispatch:
inputs:
sdk:
description: Android SDK level
required: true
default: "35"
type: choice
options:
- "35"
- "28"

jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
arch: [x86_64, aarch64]
fail-fast: false

steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up build environment
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y \
build-essential \
git \
wget \
curl \
unzip \
flex \
bison \
gettext \
autoconf \
automake \
libtool \
pkg-config \
mingw-w64 \
gcc-multilib \
g++-multilib \
libfreetype6-dev \
libfreetype6-dev:i386 \
libpng-dev \
libpng-dev:i386 \
zlib1g-dev \
zlib1g-dev:i386

- name: Download and extract termuxfs for ${{ matrix.arch }}
run: |
mkdir -p $HOME/termuxfs/${{ matrix.arch }}
cd $HOME/termuxfs/${{ matrix.arch }}
wget https://github.com/GameNative/termux-on-gha/releases/download/build-20260218/termuxfs-${{ matrix.arch }}.tar
tar -xf termuxfs-${{ matrix.arch }}.tar
ls -la $HOME/termuxfs/${{ matrix.arch }}/

- name: Cache Android NDK
id: cache-ndk
uses: actions/cache@v4
with:
path: ~/Android/Sdk/ndk/27.3.13750724
key: android-ndk-r27d

- name: Set up Android NDK
if: steps.cache-ndk.outputs.cache-hit != 'true'
run: |
mkdir -p $HOME/Android/Sdk/ndk
cd $HOME/Android/Sdk/ndk
wget https://dl.google.com/android/repository/android-ndk-r27d-linux.zip
unzip -q android-ndk-r27d-linux.zip
mv android-ndk-r27d 27.3.13750724

- name: Cache LLVM MinGW toolchain
id: cache-llvm-mingw
uses: actions/cache@v4
with:
path: ~/toolchains/llvm-mingw-20250920-ucrt-ubuntu-22.04-x86_64
key: bylaws-llvm-mingw-20250920

- name: Set up LLVM MinGW toolchain
if: steps.cache-llvm-mingw.outputs.cache-hit != 'true'
run: |
mkdir -p $HOME/toolchains
cd $HOME/toolchains
wget https://github.com/bylaws/llvm-mingw/releases/download/20250920/llvm-mingw-20250920-ucrt-ubuntu-22.04-x86_64.tar.xz
tar -xf llvm-mingw-20250920-ucrt-ubuntu-22.04-x86_64.tar.xz

- name: Cache wine-tools
id: cache-wine-tools
uses: actions/cache@v4
with:
path: wine-tools
key: wine-tools-${{ hashFiles('configure.ac', 'configure') }}

- name: Build lsteamclient and steam_helper for ${{ matrix.arch }}
run: |
SDK_LEVEL="${{ github.event.inputs.sdk }}"
if [ -z "$SDK_LEVEL" ]; then
SDK_LEVEL="35"
fi

EXTRA_ARGS=""
if [ "$SDK_LEVEL" = "35" ]; then
EXTRA_ARGS="--enable-16kb-pages"
fi

SKIP_TOOLS_ARG=""
if [ "${{ steps.cache-wine-tools.outputs.cache-hit }}" = "true" ]; then
SKIP_TOOLS_ARG="--skip-tools-build"
fi

bash build-scripts/build-steam-targets.sh \
--arch "${{ matrix.arch }}" \
--output-root "$GITHUB_WORKSPACE/steam-build-artifacts" \
$EXTRA_ARGS \
$SKIP_TOOLS_ARG

- name: Upload Steam component artifacts for ${{ matrix.arch }}
uses: actions/upload-artifact@v4
with:
name: steam-components-${{ matrix.arch }}
path: steam-build-artifacts/**/
retention-days: 30
202 changes: 202 additions & 0 deletions build-scripts/build-steam-targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
#!/usr/bin/env bash

set -euo pipefail

usage() {
cat <<'EOF'
Build only lsteamclient and steam_helper artifacts for CI.

Usage:
bash build-scripts/build-steam-targets.sh [options]

Options:
--arch <x86_64|aarch64|arm64ec> Target architecture (default: x86_64)
--enable-16kb-pages Enable 16KB page size build mode
--skip-autogen Do not run autogen.sh
--skip-tools-build Do not build wine-tools (step0)
--skip-sysvshm Skip android_sysvshm build for aarch64
--jobs <n> Parallel make jobs (default: nproc)
--output-root <path> Artifact root directory
--help Show this help

Examples:
bash build-scripts/build-steam-targets.sh --arch x86_64 --enable-16kb-pages
bash build-scripts/build-steam-targets.sh --arch aarch64 --output-root "$GITHUB_WORKSPACE/artifacts"
EOF
}

ARCH="x86_64"
ENABLE_16KB_PAGES=0
RUN_AUTOGEN=1
RUN_TOOLS_BUILD=1
RUN_SYSVSHM=1
JOBS="$(nproc)"
OUTPUT_ROOT="${GITHUB_WORKSPACE:-$(pwd)}/steam-build-artifacts"

while [ "$#" -gt 0 ]; do
case "$1" in
--arch)
ARCH="${2:-}"
shift 2
;;
--enable-16kb-pages)
ENABLE_16KB_PAGES=1
shift
;;
--skip-autogen)
RUN_AUTOGEN=0
shift
;;
--skip-tools-build)
RUN_TOOLS_BUILD=0
shift
;;
--skip-sysvshm)
RUN_SYSVSHM=0
shift
;;
--jobs)
JOBS="${2:-}"
shift 2
;;
--output-root)
OUTPUT_ROOT="${2:-}"
shift 2
;;
--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage
exit 1
;;
esac
done

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"

case "$ARCH" in
x86_64)
STEP_SCRIPT="build-scripts/build-step-x86_64.sh"
ARTIFACT_ARCH="x86_64"
;;
aarch64|arm64ec|arm64)
STEP_SCRIPT="build-scripts/build-step-arm64ec.sh"
ARTIFACT_ARCH="arm64ec"
;;
*)
echo "Unsupported arch: $ARCH" >&2
usage
exit 1
;;
esac

# Re-export PATH/DLLTOOL in this shell so `make` (run after the step script
# returns) sees the llvm-mingw toolchain. Without this, winebuild falls back
# to the system clang's llvm-dlltool, which on Ubuntu is LLVM 18 and lacks
# the -N flag needed for ARM64EC import libraries.
LLVM_MINGW_TOOLCHAIN="${LLVM_MINGW_TOOLCHAIN:-$HOME/toolchains/llvm-mingw-20250920-ucrt-ubuntu-22.04-x86_64/bin}"
if [ -d "$LLVM_MINGW_TOOLCHAIN" ]; then
export PATH="$LLVM_MINGW_TOOLCHAIN:$PATH"
export DLLTOOL="$LLVM_MINGW_TOOLCHAIN/llvm-dlltool"
echo "Using llvm-mingw at: $LLVM_MINGW_TOOLCHAIN"
else
echo "Warning: llvm-mingw toolchain not found at $LLVM_MINGW_TOOLCHAIN" >&2
fi

EXTRA_STEP_ARGS=()
if [ "$ENABLE_16KB_PAGES" -eq 1 ]; then
EXTRA_STEP_ARGS+=("--enable-16kb-pages")
fi

echo "=== Steam targets build config ==="
echo "ARCH: $ARCH"
echo "STEP_SCRIPT: $STEP_SCRIPT"
echo "JOBS: $JOBS"
echo "OUTPUT_ROOT: $OUTPUT_ROOT"
echo "ENABLE_16KB_PAGES: $ENABLE_16KB_PAGES"
echo "RUN_AUTOGEN: $RUN_AUTOGEN"
echo "RUN_TOOLS_BUILD: $RUN_TOOLS_BUILD"
echo "RUN_SYSVSHM: $RUN_SYSVSHM"
echo "=================================="

if [ "$RUN_AUTOGEN" -eq 1 ]; then
echo "Running autogen.sh..."
bash autogen.sh
fi

if [ "$RUN_TOOLS_BUILD" -eq 1 ]; then
echo "Building wine-tools..."
bash build-scripts/build-step0.sh
fi

if [ "$ARCH" != "x86_64" ] && [ "$RUN_SYSVSHM" -eq 1 ]; then
echo "Building android_sysvshm for $ARCH..."
bash "$STEP_SCRIPT" "${EXTRA_STEP_ARGS[@]}" --build-sysvshm
fi

echo "Configuring build..."
bash "$STEP_SCRIPT" "${EXTRA_STEP_ARGS[@]}" --configure

echo "Building lsteamclient and steam_helper only..."
make -j"$JOBS" lsteamclient/all steam_helper/all

ARTIFACT_DIR="$OUTPUT_ROOT/$ARTIFACT_ARCH"
mkdir -p "$ARTIFACT_DIR"

collect_dir() {
local src_dir="$1"
local dest_subdir="$2"
local found=0

if [ ! -d "$src_dir" ]; then
return 1
fi

mkdir -p "$ARTIFACT_DIR/$dest_subdir"
while IFS= read -r -d '' f; do
# Preserve the per-arch subdirectory layout (e.g. arm64ec-windows/, i386-windows/)
# so multiple-arch builds don't overwrite each other at the artifact destination.
local rel
rel="${f#$src_dir/}"
local dest_path="$ARTIFACT_DIR/$dest_subdir/$rel"
mkdir -p "$(dirname "$dest_path")"
cp "$f" "$dest_path"
echo "Collected artifact: $f -> $dest_path"
found=1
done < <(find "$src_dir" \
\( -name "*.dll" -o -name "*.so" -o -name "*.exe" -o -name "*.dll.so" -o -name "*.exe.so" \) \
-type f -print0)

if [ "$found" -ne 1 ]; then
return 1
fi
return 0
}

LSTEAMCLIENT_OK=0
STEAM_HELPER_OK=0

collect_dir "lsteamclient" "lsteamclient" && LSTEAMCLIENT_OK=1 || true
collect_dir "steam_helper" "steam_helper" && STEAM_HELPER_OK=1 || true

if [ "$LSTEAMCLIENT_OK" -ne 1 ]; then
echo "Error: no lsteamclient artifact was produced." >&2
echo "Tree under lsteamclient/:" >&2
find lsteamclient -maxdepth 3 -type f >&2 || true
exit 1
fi

if [ "$STEAM_HELPER_OK" -ne 1 ]; then
echo "Error: no steam_helper artifact was produced." >&2
echo "Tree under steam_helper/:" >&2
find steam_helper -maxdepth 3 -type f >&2 || true
exit 1
fi

echo "Artifacts saved in: $ARTIFACT_DIR"
find "$ARTIFACT_DIR" -type f
2 changes: 1 addition & 1 deletion build-scripts/build-step-arm64ec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export DLLTOOL=$LLVM_MINGW_TOOLCHAIN/llvm-dlltool

export PKG_CONFIG_LIBDIR=$deps/lib/pkgconfig:$deps/share/pkgconfig
export ACLOCAL_PATH=$deps/lib/aclocal:$deps/share/aclocal
export CPPFLAGS="-I$deps/include --sysroot=$TOOLCHAIN/../sysroot"
export CPPFLAGS="--sysroot=$TOOLCHAIN/../sysroot -idirafter $deps/include"

export C_OPTS="-Wno-declaration-after-statement -Wno-implicit-function-declaration -Wno-int-conversion"
export CFLAGS=$C_OPTS
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/build-step-x86_64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export DLLTOOL=$LLVM_MINGW_TOOLCHAIN/llvm-dlltool

export PKG_CONFIG_LIBDIR=$deps/lib/pkgconfig:$deps/share/pkgconfig
export ACLOCAL_PATH=$deps/lib/aclocal:$deps/share/aclocal
export CPPFLAGS="-I$deps/include --sysroot=$TOOLCHAIN/../sysroot"
export CPPFLAGS="--sysroot=$TOOLCHAIN/../sysroot -idirafter $deps/include"

export C_OPTS="-march=x86-64 -mtune=generic -Wno-declaration-after-statement -Wno-implicit-function-declaration -Wno-int-conversion"
export CFLAGS=$C_OPTS
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3470,6 +3470,7 @@ WINE_CONFIG_MAKEFILE(dlls/xpssvcs)
WINE_CONFIG_MAKEFILE(dlls/xtajit64)
WINE_CONFIG_MAKEFILE(fonts)
WINE_CONFIG_MAKEFILE(include)
WINE_CONFIG_MAKEFILE(lsteamclient)
WINE_CONFIG_MAKEFILE(libs/adsiid)
WINE_CONFIG_MAKEFILE(libs/capstone)
WINE_CONFIG_MAKEFILE(libs/dmoguids)
Expand Down Expand Up @@ -3633,6 +3634,7 @@ WINE_CONFIG_MAKEFILE(programs/wusa)
WINE_CONFIG_MAKEFILE(programs/xcopy)
WINE_CONFIG_MAKEFILE(programs/xcopy/tests)
WINE_CONFIG_MAKEFILE(server)
WINE_CONFIG_MAKEFILE(steam_helper)
WINE_CONFIG_MAKEFILE(tools,,[test "x$enable_tools" = xno])
WINE_CONFIG_MAKEFILE(tools/sfnt2fon,,[test "x$enable_tools" = xno])
WINE_CONFIG_MAKEFILE(tools/widl,,[test "x$enable_tools" = xno])
Expand Down
Loading
Loading