|
| 1 | +name: windows-x64 (msys2 mingw64, mintty runtime) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: ["**"] |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: windows-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + submodules: recursive |
| 17 | + |
| 18 | + - name: Setup MSYS2 (mingw64) |
| 19 | + uses: msys2/setup-msys2@v2 |
| 20 | + with: |
| 21 | + msystem: MINGW64 |
| 22 | + update: true |
| 23 | + install: >- |
| 24 | + mingw-w64-x86_64-toolchain |
| 25 | + mingw-w64-x86_64-cmake |
| 26 | + mingw-w64-x86_64-ninja |
| 27 | + mingw-w64-x86_64-ncurses |
| 28 | + zip |
| 29 | +
|
| 30 | + - name: Configure |
| 31 | + shell: msys2 {0} |
| 32 | + run: | |
| 33 | + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release |
| 34 | +
|
| 35 | + - name: Build |
| 36 | + shell: msys2 {0} |
| 37 | + run: | |
| 38 | + cmake --build build |
| 39 | +
|
| 40 | + - name: Package (exe + dlls) |
| 41 | + shell: msys2 {0} |
| 42 | + run: | |
| 43 | + set -euxo pipefail |
| 44 | + mkdir -p dist |
| 45 | +
|
| 46 | + # 1) binary |
| 47 | + if [ -f build/StrucTTY.exe ]; then |
| 48 | + cp build/StrucTTY.exe dist/ |
| 49 | + elif [ -f build/StrucTTY ]; then |
| 50 | + cp build/StrucTTY dist/StrucTTY.exe |
| 51 | + else |
| 52 | + echo "ERROR: StrucTTY binary not found" |
| 53 | + find build -maxdepth 3 -type f -name "*.exe" -o -name "StrucTTY*" || true |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | +
|
| 57 | + find build -type f \( -name "libgemmi*.dll" -o -name "gemmi*.dll" \) -print -exec cp -n {} dist/ \; || true |
| 58 | +
|
| 59 | + ldd dist/StrucTTY.exe | awk '{print $3}' | grep -E '^/mingw64/bin/.*\.dll$' | xargs -r -I{} cp -n {} dist/ |
| 60 | +
|
| 61 | + if [ -d /mingw64/share/terminfo ]; then |
| 62 | + cp -r /mingw64/share/terminfo dist/terminfo |
| 63 | + fi |
| 64 | +
|
| 65 | + cat > dist/run_structty.sh <<'SH' |
| 66 | + #!/usr/bin/env bash |
| 67 | + set -e |
| 68 | + export PATH="$(cd "$(dirname "$0")" && pwd):$PATH" |
| 69 | + if [ -d "$(dirname "$0")/terminfo" ]; then |
| 70 | + export TERMINFO="$(cd "$(dirname "$0")" && pwd)/terminfo" |
| 71 | + fi |
| 72 | + exec "$(dirname "$0")/StrucTTY.exe" "$@" |
| 73 | + SH |
| 74 | + chmod +x dist/run_structty.sh |
| 75 | +
|
| 76 | + # licenses |
| 77 | + cp -n LICENSE dist/ || true |
| 78 | + cp -n THIRD_PARTY_NOTICES.md dist/ || true |
| 79 | + cp -r third_party_licenses dist/ || true |
| 80 | +
|
| 81 | + cd dist |
| 82 | + zip -r ../StrucTTY-windows-x64.zip . |
| 83 | +
|
| 84 | + - name: Upload artifact |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: StrucTTY-windows-x64 |
| 88 | + path: StrucTTY-windows-x64.zip |
0 commit comments