Skip to content

Makefile: Add support for command line variable overrides #25

Makefile: Add support for command line variable overrides

Makefile: Add support for command line variable overrides #25

Workflow file for this run

name: Cross Compile phira-mp-server
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ created ]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: linux-amd64
os: ubuntu-latest
target: phira-mp-server-linux-amd64
cxx: g++
packages: build-essential libssl-dev uuid-dev
ldflags: -pthread -luuid -lssl -lcrypto -static
- name: linux-arm64
os: ubuntu-latest
target: phira-mp-server-linux-arm64
cxx: aarch64-linux-gnu-g++
packages: >-
g++-aarch64-linux-gnu
libssl-dev:arm64
uuid-dev:arm64
ldflags: -pthread -luuid -lssl -lcrypto -static
multiarch: arm64
- name: linux-armhf
os: ubuntu-latest
target: phira-mp-server-linux-armhf
cxx: arm-linux-gnueabihf-g++
packages: >-
g++-arm-linux-gnueabihf
libssl-dev:armhf
uuid-dev:armhf
ldflags: -pthread -luuid -lssl -lcrypto -static
multiarch: armhf
- name: windows-amd64
os: windows-latest
target: phira-mp-server-windows-amd64.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Enable multiarch
if: runner.os == 'Linux' && matrix.multiarch != ''
run: |
sudo dpkg --add-architecture ${{ matrix.multiarch }}
sudo apt-get update
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Build (Linux)
if: runner.os == 'Linux'
run: |
make \
CXX=${{ matrix.cxx }} \
TARGET=${{ matrix.target }} \
LDFLAGS="${{ matrix.ldflags }}"
- name: Setup MSYS2 (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-openssl
make
- name: Build (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
make \
CXX=x86_64-w64-mingw32-g++ \
TARGET=phira-mp-server-windows-amd64.exe \
LDFLAGS="-pthread -lssl -lcrypto -lrpcrt4 -lws2_32 -lcrypt32 -static"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: phira-mp-server-${{ matrix.name }}
path: |
phira-mp-server-*
*.exe