Skip to content

Commit e6104d6

Browse files
committed
Fix build-winxp.yml
1 parent 8b7899d commit e6104d6

1 file changed

Lines changed: 37 additions & 21 deletions

File tree

.github/workflows/build-winxp.yml

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
uses: actions/cache@v4
5959
with:
6060
path: mxe
61-
key: ${{ runner.os }}-mxe-v7e39b555dee5e906b24a44940055dc28d4056d23-gcc11-jsoncpp-sdl_net-v7
61+
key: ${{ runner.os }}-mxe-v7e39b555dee5e906b24a44940055dc28d4056d23-gcc11-jsoncpp-sdl_net-v6
6262

6363
- name: Configure + build (WinXP)
6464
run: |
@@ -67,62 +67,78 @@ jobs:
6767
export PATH="$GITHUB_WORKSPACE/mxe/usr/bin:$PATH"
6868
export MXE_PREFIX="$GITHUB_WORKSPACE/mxe/usr/i686-w64-mingw32.static"
6969
70-
# Make sure CMake finds MXE
70+
# Make sure CMake/pkg-config find MXE (not host)
7171
export CMAKE_PREFIX_PATH="$MXE_PREFIX"
7272
export PKG_CONFIG_PATH="$MXE_PREFIX/lib/pkgconfig"
7373
74-
# Your repo ships jsoncpp headers (1.9.7) under deps/include/json.
75-
# MXE provides libjsoncpp.a, but its headers are NOT under include/jsoncpp/json/version.h in your build.
76-
# So we keep repo headers and only ensure include paths are correct.
77-
export CPPFLAGS="-I$MXE_PREFIX/include -I$MXE_PREFIX/include/SDL -I$GITHUB_WORKSPACE/deps/include/SDL_net -I$GITHUB_WORKSPACE/deps/include"
78-
export CFLAGS="$CPPFLAGS"
79-
export CXXFLAGS="$CPPFLAGS"
74+
echo "=== DEBUG: jsoncpp headers we will use (MXE) ==="
75+
ls -la "$MXE_PREFIX/include/json/version.h" || true
76+
ls -la "$MXE_PREFIX/include/json/json.h" || true
8077
81-
echo "=== DEBUG: jsoncpp headers present ==="
82-
ls -la "$GITHUB_WORKSPACE/deps/include/json/version.h" || true
78+
echo "=== DEBUG: SDL_net header in MXE ==="
79+
ls -la "$MXE_PREFIX/include/SDL/SDL_net.h" || true
8380
84-
echo "=== DEBUG: key libs present in MXE_PREFIX/lib ==="
81+
echo "=== DEBUG: key libs in MXE ==="
8582
ls -la "$MXE_PREFIX/lib" | grep -Ei "json|sdl|jpeg|png|webp|smpeg|modplug|vorbis|ogg|ws2|iphlp|winmm|dxguid" || true
8683
8784
mkdir -p build
8885
cd build
8986
87+
# IMPORTANT:
88+
# - Put MXE include dirs FIRST so we don't accidentally use deps/include jsoncpp headers.
89+
# - Add SDL include dir so <SDL_net.h> works (header is in include/SDL/SDL_net.h).
90+
#
91+
# Linker:
92+
# - Use --start-group/--end-group to avoid static link order issues (vorbisfile/vorbis/ogg, SDL_net/ws2_32, etc.)
9093
i686-w64-mingw32.static-cmake \
9194
-DCMAKE_BUILD_TYPE=Release \
9295
-DDEV_BUILD=OFF \
9396
-DBUILD_PACKAGE=OFF \
9497
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
98+
-DCMAKE_CXX_FLAGS="-I$MXE_PREFIX/include -I$MXE_PREFIX/include/SDL" \
99+
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--start-group -Wl,--end-group" \
95100
"$GITHUB_WORKSPACE"
96101
97102
make -j"$(nproc)" VERBOSE=1
98103
99-
# Always dump + upload link command + linklibs so you can see missing libs/order
100-
- name: Dump link files (debug)
104+
# Collect link files even if the build fails
105+
- name: Collect link files
101106
if: always()
102107
run: |
108+
set -euxo pipefail
109+
mkdir -p artifacts-link
110+
111+
# Try common locations
112+
if [ -f "build/src/CMakeFiles/openxcom.dir/link.txt" ]; then
113+
cp -v "build/src/CMakeFiles/openxcom.dir/link.txt" artifacts-link/link.txt
114+
fi
115+
if [ -f "build/src/CMakeFiles/openxcom.dir/linklibs.rsp" ]; then
116+
cp -v "build/src/CMakeFiles/openxcom.dir/linklibs.rsp" artifacts-link/linklibs.rsp
117+
fi
118+
119+
# Also dump to job log for quick viewing
103120
echo "=== link.txt ==="
104-
cat build/src/CMakeFiles/openxcom.dir/link.txt || true
105-
echo
121+
(cat artifacts-link/link.txt || true)
106122
echo "=== linklibs.rsp ==="
107-
cat build/src/CMakeFiles/openxcom.dir/linklibs.rsp || true
123+
(cat artifacts-link/linklibs.rsp || true)
108124
109-
- name: Upload link files (debug)
125+
- name: Upload link debug artifacts
110126
if: always()
111127
uses: actions/upload-artifact@v4
112128
with:
113129
name: link-debug-${{ env.SAFE_REF }}
114-
path: |
115-
build/src/CMakeFiles/openxcom.dir/link.txt
116-
build/src/CMakeFiles/openxcom.dir/linklibs.rsp
130+
path: artifacts-link/
117131

118132
- name: Package zip
133+
# Only package if build succeeded and bin exists
119134
if: success()
120135
run: |
136+
set -euxo pipefail
121137
cd build/bin
122138
rm -f libopenxcom.dll.a || true
123139
zip -r "../../openxcom-winxp-${{ env.SAFE_REF }}.zip" .
124140
125-
- name: Upload artifact
141+
- name: Upload build artifact
126142
if: success()
127143
uses: actions/upload-artifact@v4
128144
with:

0 commit comments

Comments
 (0)