CI and various compile fixes (#270)

* Fix emscripten build.

* speexdsp need to disable neon support.
* all deps need --host=none.

* Fix mingw 32 bit build.

* Only try to static link ezhud if building client.

* Make STRIPFLAGS overrideable.

* pkgconf typo, should be --atleast-version.

* Fix -host -> --host typo.

* Update CI.
This commit is contained in:
Daniel Svensson 2024-09-06 18:31:36 +02:00 committed by GitHub
parent 12985c8b31
commit e62a712ee9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 30 deletions

View file

@ -13,7 +13,7 @@ jobs:
steps: steps:
- name: Get number of CPU cores - name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1 uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores id: cpu-cores
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -49,50 +49,108 @@ jobs:
run: | run: |
cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }} cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }}
wasm: make:
strategy: strategy:
# Concurrent builds currently broken:
# https://github.com/mymindstorm/setup-emsdk/issues/20
matrix: matrix:
emsdk: [ "2.0.12" ] #, "3.1.8", "3.1.51" ] include:
profile: [ "rel" ] #, "dbg" ] - name: web
fte_target: web
make_targets: "gl-rel"
os: ubuntu-latest
- name: linux64
fte_target: linux64
make_targets: "m-rel sv-rel qtv-rel qcc-rel"
os: ubuntu-latest
packages: "libasound2-dev libgl-dev libegl1-mesa-dev libwayland-dev libxcursor-dev libxi-dev libxkbcommon-dev libxrandr-dev libxss-dev"
- name: win32
fte_target: win32
make_targets: "m-rel sv-rel qcc-rel"
os: ubuntu-latest
packages: "binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686"
- name: win64
fte_target: win64
make_targets: "m-rel sv-rel qcc-rel"
os: ubuntu-latest
packages: "binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64"
- name: macos-arm64
fte_target: SDL2
make_targets: "gl-rel sv-rel qcc-rel"
args: "ARCH=arm STRIPFLAGS="
packages: "sdl2"
os: macos-latest
runs-on: ubuntu-latest name: make-${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps: steps:
- name: Get number of CPU cores - name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1 uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores id: cpu-cores
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v13 - name: Extract versions
run: grep 'VER=' engine/Makefile | tee makelibs_versions
- uses: actions/cache@v4
id: cache
with: with:
version: ${{ matrix.emsdk }} path: engine/libs-*
actions-cache-folder: "emsdk-cache-${{ matrix.emsdk }}" key: ${{ runner.os }}-${{ matrix.fte_target }}-${{ hashFiles('makelibs_versions') }}
- uses: mymindstorm/setup-emsdk@v14
with:
version: "2.0.12"
actions-cache-folder: "emsdk-cache-2.0.12"
cache-key: "emsdk-2.0.12"
if: matrix.fte_target == 'web'
- name: Verify emscripten - name: Verify emscripten
run: emcc -v run: emcc -v
if: matrix.fte_target == 'web'
- name: Install dependencies (linux)
run: sudo apt-get -qq update && sudo apt-get -qq install --no-install-recommends ${{ matrix.packages }}
if: matrix.packages != '' && matrix.os == 'ubuntu-latest'
- name: Install dependencies (macos)
run: brew install ${{ matrix.packages }}
if: matrix.packages != '' && matrix.os == 'macos-latest'
- name: Build dependencies - name: Build dependencies
working-directory: engine working-directory: engine
run: | run: make FTE_TARGET=${{ matrix.fte_target }} makelibs ${{ matrix.args }}
make -j ${{ steps.cpu-cores.outputs.count }} makelibs FTE_TARGET=web if: steps.cache.outputs.cache-hit != 'true'
- name: Build wasm - uses: ammaraskar/gcc-problem-matcher@0.3.0
- name: Build ${{ matrix.name }}
working-directory: engine working-directory: engine
run: | run: |
# Currently fails to build make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=${{ matrix.fte_target }} ${{ matrix.make_targets }} ${{ matrix.args }} LINK_EZHUD=1 LINK_OPENSSL=1
sed -r -i '/define Q3(CLIENT|SERVER)/d' common/config_fteqw.h
make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=web web-${{ matrix.profile }} - name: Attach macOS docs
run: |
cat <<EOF > engine/release/fte_macos.txt
To allow executables to run issue for example:
chmod +x fteqw-glsdl2
xattr -d com.apple.quarantine fteqw-glsdl2
If you don't have SDL2 installed, run:
brew install sdl2
EOF
if: matrix.os == 'macos-latest'
- name: Get version
id: version
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: fteqw-web-${{ matrix.profile }}-em${{ matrix.emsdk }} name: fteqw-${{ matrix.name }}-${{ steps.version.outputs.short_sha }}
path: | path: |
engine/*/ftewebgl.js engine/release/fte*
engine/*/ftewebgl.html !engine/release/*.db
engine/*/ftewebgl.wasm
compression-level: 9 compression-level: 9

View file

@ -27,7 +27,7 @@ CC?=gcc
WINDRES?=windres WINDRES?=windres
STRIP?=strip STRIP?=strip
STRIPFLAGS=--strip-unneeded --remove-section=.comment STRIPFLAGS?=--strip-unneeded --remove-section=.comment
VISIBILITY_FLAGS=-fvisibility=hidden #just assume this for sanities sake. disable only for compilers that error. VISIBILITY_FLAGS=-fvisibility=hidden #just assume this for sanities sake. disable only for compilers that error.
CPUOPTIMIZATIONS=-Os CPUOPTIMIZATIONS=-Os
@ -1084,7 +1084,7 @@ ifeq (1,$(LINK_EZHUD))
hud_editor.o hud_editor.o
endif endif
ifeq (1,$(LINK_OPENSSL)) ifeq (1,$(LINK_OPENSSL))
ifeq (1,$(shell $(PKGCONFIG) --version-atleast 3 openssl && echo 1)) #must exist... and if its not openssl3 then its not gpl3-compatible so refuse to use it. ifeq (1,$(shell $(PKGCONFIG) --atleast-version 3 openssl && echo 1)) #must exist... and if its not openssl3 then its not gpl3-compatible so refuse to use it.
VPATH := $(VPATH) : $(BASE_DIR)/../plugins VPATH := $(VPATH) : $(BASE_DIR)/../plugins
ALL_CFLAGS+=-DSTATIC_OPENSSL #let the plugins code know it needs to add the appropriate entry. ALL_CFLAGS+=-DSTATIC_OPENSSL #let the plugins code know it needs to add the appropriate entry.
COMMON_OBJS += \ COMMON_OBJS += \
@ -2347,10 +2347,11 @@ $(BASE_DIR)/libs-$(ARCH)/SDL2-$(SDL2VER)/x86_64-w64-mingw32/bin/sdl2-config: $(B
AR?=$(ARCH)-ar AR?=$(ARCH)-ar
CONFIGARGS+= -host=$(ARCH) --enable-shared=no CC="$(CC)" CONFIGARGS+= --host=$(ARCH) --enable-shared=no CC="$(CC)"
CONFIGARGS:= $(CONFIGARGS) CONFIGARGS:= $(CONFIGARGS)
#--disable-silent-rules #--disable-silent-rules
OPUSCONFIGARGS=$(CONFIGARGS) OPUSCONFIGARGS=$(CONFIGARGS)
SPEEXDSPCONFIGARGS=$(CONFIGARGS)
TOOLOVERRIDES+=CFLAGS="$$CFLAGS -Os" TOOLOVERRIDES+=CFLAGS="$$CFLAGS -Os"
TOOLCONGIGUREOVERRIDES=$(TOOLOVERRIDES) TOOLCONGIGUREOVERRIDES=$(TOOLOVERRIDES)
@ -2358,8 +2359,9 @@ TOOLMAKEOVERRIDES=$(TOOLOVERRIDES)
ifeq (web,$(FTE_TARGET)) ifeq (web,$(FTE_TARGET))
TOOLCONFIGUREOVERRIDES=emconfigure TOOLCONFIGUREOVERRIDES=emconfigure
TOOLMAKEOVERRIDES=emmake TOOLMAKEOVERRIDES=emmake
OPUSCONFIGARGS=--disable-rtcd --disable-hardening --enable-stack-protector=no --enable-shared=no OPUSCONFIGARGS=--disable-rtcd --disable-hardening --enable-stack-protector=no --enable-shared=no --host=none
CONFIGARGS=--enable-shared=no SPEEXDSPCONFIGARGS=--disable-neon --host=none
CONFIGARGS=--enable-shared=no --host=none
endif endif
@ -2400,7 +2402,7 @@ libs-$(ARCH)/libspeex.a:
libs-$(ARCH)/libspeexdsp.a: libs-$(ARCH)/libspeexdsp.a:
test -f speexdsp-$(SPEEXDSPVER).tar.gz || wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSPVER).tar.gz test -f speexdsp-$(SPEEXDSPVER).tar.gz || wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSPVER).tar.gz
test -f libs-$(ARCH)/libspeexdsp.a || (mkdir -p libs-$(ARCH)/speex && cd libs-$(ARCH) && tar -xvzf ../speexdsp-$(SPEEXDSPVER).tar.gz && cd speexdsp-$(SPEEXDSPVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLCONFIGUREOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLMAKEOVERRIDES) $(MAKE) && cp libspeexdsp/.libs/libspeexdsp.a ../ && cp -r include/speex/*.h ../speex/) test -f libs-$(ARCH)/libspeexdsp.a || (mkdir -p libs-$(ARCH)/speex && cd libs-$(ARCH) && tar -xvzf ../speexdsp-$(SPEEXDSPVER).tar.gz && cd speexdsp-$(SPEEXDSPVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLCONFIGUREOVERRIDES) ./configure $(SPEEXDSPCONFIGARGS) && $(TOOLMAKEOVERRIDES) $(MAKE) && cp libspeexdsp/.libs/libspeexdsp.a ../ && cp -r include/speex/*.h ../speex/)
libs-$(ARCH)/libfreetype.a libs-$(ARCH)/ft2build.h: libs-$(ARCH)/libpng.a libs-$(ARCH)/libpng.pc libs-$(ARCH)/libfreetype.a libs-$(ARCH)/ft2build.h: libs-$(ARCH)/libpng.a libs-$(ARCH)/libpng.pc
test -f freetype-$(FREETYPEVER).tar.gz || wget https://download-mirror.savannah.gnu.org/releases/freetype/freetype-$(FREETYPEVER).tar.gz test -f freetype-$(FREETYPEVER).tar.gz || wget https://download-mirror.savannah.gnu.org/releases/freetype/freetype-$(FREETYPEVER).tar.gz

View file

@ -27,7 +27,7 @@ static struct plugin_s *q3plug;
#include "../engine/common/com_phys_ode.c" #include "../engine/common/com_phys_ode.c"
#endif #endif
#ifdef STATIC_EZHUD //if its statically linked and loading by default then block it by default and let configs reenable it. The defaults must be maintained for deltaing configs to work, yet they're defective and should never be used in that default configuration #if defined(HAVE_CLIENT) && defined(STATIC_EZHUD) //if its statically linked and loading by default then block it by default and let configs reenable it. The defaults must be maintained for deltaing configs to work, yet they're defective and should never be used in that default configuration
cvar_t plug_sbar = CVARD("plug_sbar", "0", "Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it.\n=0: never use hud plugins.\n&1: Use hud plugins in deathmatch.\n&2: Use hud plugins in singleplayer/coop.\n=3: Always use hud plugins (when loaded)."); cvar_t plug_sbar = CVARD("plug_sbar", "0", "Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it.\n=0: never use hud plugins.\n&1: Use hud plugins in deathmatch.\n&2: Use hud plugins in singleplayer/coop.\n=3: Always use hud plugins (when loaded).");
#else #else
cvar_t plug_sbar = CVARD("plug_sbar", "3", "Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it.\n=0: never use hud plugins.\n&1: Use hud plugins in deathmatch.\n&2: Use hud plugins in singleplayer/coop.\n=3: Always use hud plugins (when loaded)."); cvar_t plug_sbar = CVARD("plug_sbar", "3", "Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it.\n=0: never use hud plugins.\n&1: Use hud plugins in deathmatch.\n&2: Use hud plugins in singleplayer/coop.\n=3: Always use hud plugins (when loaded).");
@ -37,7 +37,9 @@ cvar_t plug_loaddefault = CVARD("plug_loaddefault", "1", "0: Load plugins only v
extern qboolean Plug_Q3_Init(void); extern qboolean Plug_Q3_Init(void);
extern qboolean Plug_Bullet_Init(void); extern qboolean Plug_Bullet_Init(void);
extern qboolean Plug_ODE_Init(void); extern qboolean Plug_ODE_Init(void);
#if defined(HAVE_CLIENT) && defined(STATIC_EZHUD)
extern qboolean Plug_EZHud_Init(void); extern qboolean Plug_EZHud_Init(void);
#endif
extern qboolean Plug_OpenSSL_Init(void); extern qboolean Plug_OpenSSL_Init(void);
static struct static struct
{ {
@ -58,7 +60,7 @@ static struct
#ifdef STATIC_OPENSSL #ifdef STATIC_OPENSSL
{"openssl_internal", Plug_OpenSSL_Init}, {"openssl_internal", Plug_OpenSSL_Init},
#endif #endif
#ifdef STATIC_EZHUD #if defined(HAVE_CLIENT) && defined(STATIC_EZHUD)
{"EZHud_internal", Plug_EZHud_Init}, {"EZHud_internal", Plug_EZHud_Init},
#endif #endif
#ifdef STATIC_Q3 #ifdef STATIC_Q3

View file

@ -3,7 +3,7 @@
ifeq ($(FTE_TARGET),win32) ifeq ($(FTE_TARGET),win32)
PLUG_NATIVE_EXT=_x86.dll PLUG_NATIVE_EXT=_x86.dll
PLUG_LDFLAGS= -static-libgcc PLUG_LDFLAGS= -static-libgcc
PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw-libs -lzlib PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw-libs -lz
BITS=32 BITS=32
PLUG_LDFLAGS_DL= PLUG_LDFLAGS_DL=
CMAKERULES=$(OUT_DIR)/toolchain_$(FTE_TARGET).cmake CMAKERULES=$(OUT_DIR)/toolchain_$(FTE_TARGET).cmake