diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml deleted file mode 100644 index 809c00a..0000000 --- a/.github/workflows/win32.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Testbuild for Win32 -run-name: testbuild_win32 -on: - push: - branches: - - 'master' - pull_request: - types: - - edited - - opened - - synchronize -concurrency: - # Cancel concurrent workflows for the same PR or commit hash. - group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} - cancel-in-progress: true -jobs: - build_mingw_x86_32: - runs-on: windows-latest - permissions: - actions: read - contents: read - strategy: - fail-fast: false - matrix: - include: - - { sys: mingw32, env: i686 } - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - update: true - install: >- - git - make - mingw-w64-${{matrix.env}}-gcc - mingw-w64-${{matrix.env}}-make - - name: Check out repository code - uses: actions/checkout@v7 - - name: Build - shell: msys2 {0} - run: | - # Public runners come with 4 CPUs. - make -j4 - - name: Create testbuild package - shell: msys2 {0} - run: | - # Create release directory tree - mkdir -p publish/quake2-ctf-win32-${{github.sha}}/misc/docs - # Copy release assets - cp -r release/* publish/quake2-ctf-win32-${{github.sha}}/ - # Copy misc assets - cp LICENSE publish/quake2-ctf-win32-${{github.sha}}/misc/docs/LICENSE.txt - cp README.md publish/quake2-ctf-win32-${{github.sha}}/misc/docs/README.txt - - name: Upload testbuild package - uses: actions/upload-artifact@v7 - with: - name: quake2-ctf-win32-${{github.sha}} - path: publish/ - if-no-files-found: error diff --git a/.github/workflows/win64.yml b/.github/workflows/win64.yml deleted file mode 100644 index 7821e08..0000000 --- a/.github/workflows/win64.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Testbuild for Win64 -run-name: testbuild_win64 -on: - push: - branches: - - 'master' - pull_request: - types: - - edited - - opened - - synchronize -concurrency: - # Cancel concurrent workflows for the same PR or commit hash. - group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} - cancel-in-progress: true -jobs: - build_mingw_x86_64: - runs-on: windows-latest - permissions: - actions: read - contents: read - strategy: - fail-fast: false - matrix: - include: - - { sys: mingw64, env: x86_64 } - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - update: true - install: >- - git - make - mingw-w64-${{matrix.env}}-gcc - mingw-w64-${{matrix.env}}-make - - name: Check out repository code - uses: actions/checkout@v7 - - name: Build - shell: msys2 {0} - run: | - # Public runners come with 4 CPUs. - make -j4 - - name: Create testbuild package - shell: msys2 {0} - run: | - # Create release directory tree - mkdir -p publish/quake2-ctf-win64-${{github.sha}}/misc/docs - # Copy release assets - cp -r release/* publish/quake2-ctf-win64-${{github.sha}}/ - # Copy misc assets - cp LICENSE publish/quake2-ctf-win64-${{github.sha}}/misc/docs/LICENSE.txt - cp README.md publish/quake2-ctf-win64-${{github.sha}}/misc/docs/README.txt - - name: Upload testbuild package - uses: actions/upload-artifact@v7 - with: - name: quake2-ctf-win64-${{github.sha}} - path: publish/ - if-no-files-found: error diff --git a/.github/workflows/win_mingw.yml b/.github/workflows/win_mingw.yml new file mode 100644 index 0000000..1727a23 --- /dev/null +++ b/.github/workflows/win_mingw.yml @@ -0,0 +1,65 @@ +name: Testbuild for x86 and x86_64 Windows with MinGW +on: + push: + branches: + - 'master' + pull_request: + types: + - edited + - opened + - synchronize +concurrency: + # Cancel concurrent workflows for the same PR or commit hash. + group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} + cancel-in-progress: true +jobs: + build: + runs-on: windows-latest + permissions: + actions: read + contents: read + strategy: + fail-fast: false + # Abuse the build matrix to hack around inconsistent naming. + matrix: + include: + - arch: x86 + family: i686 + winapi: win32 + - arch: x64 + family: x86_64 + winapi: win64 + name: win_buildenv_${{matrix.winapi}} + steps: + - name: Check out repository code + uses: actions/checkout@v7 + - name: Setup build environment + shell: bash + run: | + curl -o makebuildenv.sh https://raw.githubusercontent.com/yquake2/yquake2/refs/heads/master/stuff/winbuild/makebuildenv.sh + chmod +x makebuildenv.sh + ./makebuildenv.sh buildenv + echo "${GITHUB_WORKSPACE}/buildenv/w64devkit-${{matrix.arch}}/bin/" >> ${GITHUB_PATH} + - name: Build + shell: sh -l {0} + run: | + cd ${GITHUB_WORKSPACE} + # Public runners come with 4 CPUs. + make -j4 + - name: Create testbuild package + shell: bash + run: | + # Create release directory tree + mkdir -p publish/quake2-ctf-${{matrix.winapi}}-${{github.sha}}/misc/docs + # Copy release assets + cp -r release/* publish/quake2-ctf-${{matrix.winapi}}-${{github.sha}}/ + # Copy misc assets + cp CHANGELOG publish/quake2-ctf-${{matrix.winapi}}-${{github.sha}}/misc/docs/CHANGELOG.txt + cp LICENSE publish/quake2-ctf-${{matrix.winapi}}-${{github.sha}}/misc/docs/LICENSE.txt + cp README.md publish/quake2-ctf-${{matrix.winapi}}-${{github.sha}}/misc/docs/README.txt + - name: Upload testbuild package + uses: actions/upload-artifact@v7 + with: + name: quake2-ctf-${{matrix.winapi}}-${{github.sha}} + path: publish/ + if-no-files-found: error diff --git a/Makefile b/Makefile index b3b1426..84c2211 100755 --- a/Makefile +++ b/Makefile @@ -58,6 +58,8 @@ ifeq ($(wildcard $(CONFIG_FILE)), $(CONFIG_FILE)) include $(CONFIG_FILE) endif +# ---------- + # Normalize QUIET value to either "x" or "" ifdef QUIET override QUIET := "x" @@ -65,17 +67,10 @@ else override QUIET := "" endif -# Detect the OS -ifdef SystemRoot -YQ2_OSTYPE ?= Windows -else -YQ2_OSTYPE ?= $(shell uname -s) -endif +# ---------- -# Special case for MinGW -ifneq (,$(findstring MINGW,$(YQ2_OSTYPE))) -YQ2_OSTYPE := Windows -endif +# Detect the OS, normalize some abiguous YQ2_OSTYPE strings. +YQ2_OSTYPE ?= $(shell uname -s | sed -e 's/MINGW.*/Windows/' -e 's/Windows.*/Windows/') # Detect the architecture ifeq ($(YQ2_OSTYPE), Windows) @@ -86,28 +81,17 @@ else # i686-w64-mingw32 YQ2_ARCH ?= i386 endif else # windows, but MINGW_CHOST not defined -ifdef PROCESSOR_ARCHITEW6432 -# 64 bit Windows -YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432) -else -# 32 bit Windows -YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE) -endif +YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/') endif # windows but MINGW_CHOST not defined else ifneq ($(YQ2_OSTYPE), Darwin) # Normalize some abiguous YQ2_ARCH strings -YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/') +YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/arm64/aarch64/' -e 's/^arm.*/arm/') else YQ2_ARCH ?= $(shell uname -m) endif endif -# On Windows / MinGW $(CC) is undefined by default. -ifeq ($(YQ2_OSTYPE),Windows) -CC ?= gcc -endif - # Detect the compiler ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) COMPILER := clang