Skip to content

Commit 10daa74

Browse files
committed
Fix build-winxp.yml
1 parent 94733de commit 10daa74

1 file changed

Lines changed: 42 additions & 46 deletions

File tree

.github/workflows/build-winxp.yml

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,34 @@ jobs:
6060
path: mxe
6161
key: ${{ runner.os }}-mxe-v7e39b555dee5e906b24a44940055dc28d4056d23-gcc11-jsoncpp-sdl_net-v7
6262

63-
- name: Configure (WinXP)
63+
- name: Configure + build (WinXP)
6464
run: |
65+
set -euo pipefail
66+
6567
export PATH="$GITHUB_WORKSPACE/mxe/usr/bin:$PATH"
6668
export MXE_PREFIX="$GITHUB_WORKSPACE/mxe/usr/i686-w64-mingw32.static"
6769
6870
# Make sure CMake/pkg-config find MXE (not host)
6971
export CMAKE_PREFIX_PATH="$MXE_PREFIX"
7072
export PKG_CONFIG_PATH="$MXE_PREFIX/lib/pkgconfig"
7173
72-
echo "=== DEBUG: json headers location check ==="
73-
ls -la "$MXE_PREFIX/include/json" || true
74-
ls -la "$MXE_PREFIX/include/json/json.h" || true
75-
ls -la "$GITHUB_WORKSPACE/deps/include/json/json.h" || true
74+
echo "=== DEBUG: where SDL_net headers are ==="
75+
ls -la "$MXE_PREFIX/include/SDL/SDL_net.h" || true
76+
ls -la "$MXE_PREFIX/include/SDL_net.h" || true
77+
78+
# ---- FIX #1: Provide SDL_net.h shim so source '#include <SDL_net.h>' works
79+
mkdir -p "$GITHUB_WORKSPACE/_shim_includes"
80+
cat > "$GITHUB_WORKSPACE/_shim_includes/SDL_net.h" <<'EOF'
81+
#pragma once
82+
#include <SDL/SDL_net.h>
83+
EOF
7684
77-
echo "=== DEBUG: key libs present in MXE_PREFIX/lib ==="
78-
ls -la "$MXE_PREFIX/lib" | grep -Ei "json|sdl|jpeg|png|webp|smpeg|modplug|vorbis|ogg|ws2|iphlp|winmm|dxguid" || true
85+
# Put shim FIRST, then MXE includes.
86+
export CPPFLAGS="-I$GITHUB_WORKSPACE/_shim_includes -I$MXE_PREFIX/include -I$MXE_PREFIX/include/SDL"
87+
export CFLAGS="$CPPFLAGS"
88+
export CXXFLAGS="$CPPFLAGS"
7989
90+
# Clean build dir to avoid stale CMake cache confusing includes
8091
rm -rf build
8192
mkdir -p build
8293
cd build
@@ -86,58 +97,43 @@ jobs:
8697
-DDEV_BUILD=OFF \
8798
-DBUILD_PACKAGE=OFF \
8899
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
100+
-DCMAKE_C_FLAGS="$CFLAGS" \
101+
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
89102
"$GITHUB_WORKSPACE"
90103
91-
- name: Patch link order (start-group/end-group) for static link
92-
run: |
93-
RSP="build/src/CMakeFiles/openxcom.dir/linklibs.rsp"
94-
if [ -f "$RSP" ]; then
95-
echo "=== BEFORE patch: $RSP ==="
96-
cat "$RSP" || true
97-
98-
# Flatten to one line and wrap with start/end-group to fix static link ordering
99-
ONE_LINE="$(tr '\n' ' ' < "$RSP")"
100-
echo " -Wl,--start-group $ONE_LINE -Wl,--end-group " > "$RSP"
101-
102-
echo "=== AFTER patch: $RSP ==="
103-
cat "$RSP" || true
104-
else
105-
echo "WARN: linklibs.rsp not found yet at $RSP (CMake layout changed?)"
106-
find build -maxdepth 5 -name "linklibs.rsp" -print || true
107-
fi
108-
109-
- name: Build (WinXP)
110-
run: |
111-
export PATH="$GITHUB_WORKSPACE/mxe/usr/bin:$PATH"
112-
cd build
104+
# Build verbose so link.txt/linklibs.rsp are produced and visible
113105
make -j"$(nproc)" VERBOSE=1
114106
115-
- name: Collect link files (always)
107+
- name: Collect link scripts (even on failure)
116108
if: always()
117109
run: |
118-
mkdir -p artifacts/link
119-
echo "=== FIND link.txt / linklibs.rsp ==="
120-
find build -name "link.txt" -o -name "linklibs.rsp" -print || true
121-
122-
# Copy if present
123-
cp -v build/src/CMakeFiles/openxcom.dir/link.txt artifacts/link/ 2>/dev/null || true
124-
cp -v build/src/CMakeFiles/openxcom.dir/linklibs.rsp artifacts/link/ 2>/dev/null || true
110+
set -euo pipefail
111+
mkdir -p artifacts
125112
126-
echo "=== artifacts/link contents ==="
127-
ls -la artifacts/link || true
113+
# These are created by CMake during link step (if it reaches that far)
114+
if [ -f build/src/CMakeFiles/openxcom.dir/link.txt ]; then
115+
cp -v build/src/CMakeFiles/openxcom.dir/link.txt artifacts/link.txt
116+
fi
117+
if [ -f build/src/CMakeFiles/openxcom.dir/linklibs.rsp ]; then
118+
cp -v build/src/CMakeFiles/openxcom.dir/linklibs.rsp artifacts/linklibs.rsp
119+
fi
128120
129-
echo "=== link.txt (if exists) ==="
130-
sed -n '1,200p' artifacts/link/link.txt 2>/dev/null || true
121+
# Also keep CMake logs when diagnosing
122+
if [ -f build/CMakeFiles/CMakeOutput.log ]; then
123+
cp -v build/CMakeFiles/CMakeOutput.log artifacts/CMakeOutput.log
124+
fi
125+
if [ -f build/CMakeFiles/CMakeError.log ]; then
126+
cp -v build/CMakeFiles/CMakeError.log artifacts/CMakeError.log
127+
fi
131128
132-
echo "=== linklibs.rsp (if exists) ==="
133-
sed -n '1,200p' artifacts/link/linklibs.rsp 2>/dev/null || true
129+
ls -la artifacts || true
134130
135-
- name: Upload link logs artifact (always)
131+
- name: Upload link scripts artifact
136132
if: always()
137133
uses: actions/upload-artifact@v4
138134
with:
139-
name: link-logs-${{ env.SAFE_REF }}
140-
path: artifacts/link
135+
name: winxp-link-scripts-${{ env.SAFE_REF }}
136+
path: artifacts/
141137

142138
- name: Package zip
143139
if: success()

0 commit comments

Comments
 (0)