From 1f56e857a3cd455abda0ebb5678fda2755ef535e Mon Sep 17 00:00:00 2001 From: Aleksandr Bushuev Date: Fri, 9 Jan 2026 14:28:19 +0500 Subject: [PATCH 1/5] Scripts moved to tool folder --- cpp_check.sh | 3 --- astyle.conf => tools/astyle.conf | 0 tools/cpp_check.sh | 3 +++ cppcheck_suppress.txt => tools/cppcheck_suppress.txt | 0 format.sh => tools/format.sh | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) delete mode 100755 cpp_check.sh rename astyle.conf => tools/astyle.conf (100%) create mode 100755 tools/cpp_check.sh rename cppcheck_suppress.txt => tools/cppcheck_suppress.txt (100%) rename format.sh => tools/format.sh (93%) diff --git a/cpp_check.sh b/cpp_check.sh deleted file mode 100755 index 4c78620b..00000000 --- a/cpp_check.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -RET="$(cppcheck -D__GNUC__ -q -j32 --enable=warning,performance,portability --std=c89 --suppressions-list=./cppcheck_suppress.txt --error-exitcode=1 ./code)" -exit $RET diff --git a/astyle.conf b/tools/astyle.conf similarity index 100% rename from astyle.conf rename to tools/astyle.conf diff --git a/tools/cpp_check.sh b/tools/cpp_check.sh new file mode 100755 index 00000000..7e7a84c2 --- /dev/null +++ b/tools/cpp_check.sh @@ -0,0 +1,3 @@ +#!/bin/bash +RET="$(cppcheck -D__GNUC__ -q -j32 --enable=warning,performance,portability --std=c89 --suppressions-list=./tools/cppcheck_suppress.txt --error-exitcode=1 ./code)" +exit $RET diff --git a/cppcheck_suppress.txt b/tools/cppcheck_suppress.txt similarity index 100% rename from cppcheck_suppress.txt rename to tools/cppcheck_suppress.txt diff --git a/format.sh b/tools/format.sh similarity index 93% rename from format.sh rename to tools/format.sh index 2897ec55..517cfcf7 100755 --- a/format.sh +++ b/tools/format.sh @@ -12,7 +12,7 @@ declare -a FORMAT_PATHS=( \ ) DRY_RUN=0 -ASTYLE="astyle --formatted --errors-to-stdout --options=./astyle.conf" +ASTYLE="astyle --formatted --errors-to-stdout --options=./tools/astyle.conf" if [[ $1 = "--dry" ]]; then ASTYLE=$ASTYLE" --dry-run" From f4b8ae2179301b9f31cf4b31e6ff7792d3b3082c Mon Sep 17 00:00:00 2001 From: Aleksandr Bushuev Date: Fri, 9 Jan 2026 17:00:43 +0500 Subject: [PATCH 2/5] Main makefile --- .gitignore | 3 + Makefile | 100 ++++++++++++++++++ docs/{commands.md => osp2-q3-ClientReadme.md} | 0 docs/{superhud.md => osp2-q3-SuperHUD.md} | 0 4 files changed, 103 insertions(+) create mode 100644 Makefile rename docs/{commands.md => osp2-q3-ClientReadme.md} (100%) rename docs/{superhud.md => osp2-q3-SuperHUD.md} (100%) diff --git a/.gitignore b/.gitignore index 9b5e983d..671911b7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ build/qvm/vm/ build/qvm/zz-osp-pak8.pk3 build/library/build/ build/tests/build/ +osp/ +osp2_linux.tar.gz +osp2_windows.zip diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..19b75597 --- /dev/null +++ b/Makefile @@ -0,0 +1,100 @@ +FORMAT_COMMAND=./tools/format.sh +CPPCHECK_COMMAND=./tools/cpp_check.sh + +LIB_ROOT_DIR=./build/library +PK3_ROOT_DIR=./build/qvm +TESTS_ROOT_DIR=./build/tests +MOD_ROOT_DIR=./osp +DOC_ROOT_DIR=$(MOD_ROOT_DIR)/Docs + +LIB_BUILD_DIR=$(LIB_ROOT_DIR)/build +PK3_BUILD_DIR=$(PK3_ROOT_DIR)/build +TESTS_BUILD_DIR=$(TESTS_ROOT_DIR)/build +LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-linux-x86_64/osp2 + +TESTS_FILE=osp2_tests +PK3_CLIENT_FILE=zz-osp-pak8.pk3 +LIB_CLIENT_FILE=cgamex86_64.so +RELEASE_FILE=osp2_linux.tar.gz + +MAKE_RELEASE_ARCHIVE=tar czf $(RELEASE_FILE) $(MOD_ROOT_DIR) + + +# check platform +COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g') + +ifndef PLATFORM +PLATFORM=$(COMPILE_PLATFORM) +endif + +ifeq ($(PLATFORM),mingw32) + WINDOWS=1 +endif +ifeq ($(PLATFORM),mingw64) + WINDOWS=1 +endif +ifeq ($(PLATFORM),windows) + WINDOWS=1 +endif + +# change varibles for windows +ifdef WINDOWS + LIB_CLIENT_FILE=cgamex86_64.dll + RELEASE_FILE=osp2_windows.zip + LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-windows-x86_64/osp2 + MAKE_RELEASE_ARCHIVE=$(PK3_ROOT_DIR)/tools/7za.exe u $(RELEASE_FILE) $(MOD_ROOT_DIR) +endif + +.PHONY: all clean client server osp2 format cppcheck pk3 lib dirs docs + +all: $(RELEASE_FILE) + +clean: + @rm -rf $(LIB_BUILD_DIR) + @rm -rf $(PK3_ROOT_DIR)/vm + @rm -rf $(PK3_ROOT_DIR)/$(PK3_CLIENT_FILE) + @rm -rf $(MOD_ROOT_DIR) + @rm -f $(RELEASE_FILE) + @rm -rf $(TESTS_BUILD_DIR) + +dirs: + @mkdir -p $(MOD_ROOT_DIR) + @mkdir -p $(DOC_ROOT_DIR) + @mkdir -p $(DOC_ROOT_DIR)/RUS + +format: + $(FORMAT_COMMAND) + +cppcheck: + $(CPPCHECK_COMMAND) + +pk3: + @make -C $(PK3_ROOT_DIR) + +lib: + @make -C $(LIB_ROOT_DIR) + +docs: dirs + @rm -f $(DOC_ROOT_DIR)/RUS/osp2-q3-ClientReadme.txt + @install -v docs/osp2-q3-ClientReadme.md $(DOC_ROOT_DIR)/RUS/osp2-q3-ClientReadme.txt + @rm -f $(DOC_ROOT_DIR)/RUS/osp2-q3-SuperHUD.txt + @install -v docs/osp2-q3-SuperHUD.md $(DOC_ROOT_DIR)/RUS/osp2-q3-SuperHUD.txt + +osp2: pk3 lib dirs docs + @rm -f $(MOD_ROOT_DIR)/$(LIB_CLIENT_FILE) + @install -v $(LIB_BUILD_CLIENT_DIR)/$(LIB_CLIENT_FILE) $(MOD_ROOT_DIR) + @rm -f $(MOD_ROOT_DIR)/$(PK3_CLIENT_FILE) + @install -v $(PK3_ROOT_DIR)/$(PK3_CLIENT_FILE) $(MOD_ROOT_DIR) + +$(RELEASE_FILE): osp2 + $(MAKE_RELEASE_ARCHIVE) + +$(TESTS_BUILD_DIR): + @cmake -S $(TESTS_ROOT_DIR) -B $(TESTS_BUILD_DIR) + +$(TESTS_FILE): $(TESTS_BUILD_DIR) + @cmake --build $(TESTS_BUILD_DIR) + +tests: $(TESTS_FILE) + $(TESTS_BUILD_DIR)/$(TESTS_FILE) + diff --git a/docs/commands.md b/docs/osp2-q3-ClientReadme.md similarity index 100% rename from docs/commands.md rename to docs/osp2-q3-ClientReadme.md diff --git a/docs/superhud.md b/docs/osp2-q3-SuperHUD.md similarity index 100% rename from docs/superhud.md rename to docs/osp2-q3-SuperHUD.md From b88f97cfd1f153b41accbfbe8855114a5b07e8c4 Mon Sep 17 00:00:00 2001 From: Aleksandr Bushuev Date: Fri, 9 Jan 2026 17:50:01 +0500 Subject: [PATCH 3/5] CI --- .github/workflows/makefile.yml | 52 ++++++++++------------------------ Makefile | 2 +- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index c2a9046c..9e5db690 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -34,40 +34,24 @@ jobs: - name: format_check working-directory: ./ - run: ./format.sh --dry + run: ./tools/format.sh --dry - name: cpp_check working-directory: ./ - run: ./cpp_check.sh + run: make cppcheck - name: unit_tests - working-directory: build/tests - run: | - cmake -S . -B build - cmake --build build - ./build/osp2_tests - - - name: build-qvm - working-directory: build/qvm - run: | - make - - - name: build-so - working-directory: build/library - run: | - make + working-directory: ./ + run: make tests - - uses: actions/upload-artifact@v4 - with: - name: qvm - path: build/qvm/zz-osp-pak8.pk3 - if-no-files-found: error - retention-days: 5 + - name: release + working-directory: ./ + run: make - uses: actions/upload-artifact@v4 with: - name: so - path: build/library/build/release-linux-x86_64/osp2/cgamex86_64.so + name: osp2_linux + path: osp2_linux.tar.gz if-no-files-found: error retention-days: 5 @@ -87,20 +71,15 @@ jobs: with: submodules: recursive - - name: build-qvm - working-directory: build/qvm - run: | - make - - - name: build-dll - working-directory: build/library + - name: release + working-directory: ./ run: | make - uses: actions/upload-artifact@v4 with: - name: dll - path: build/library/build/release-mingw64-x86_64/osp2/cgamex86_64.dll + name: osp2_windows + path: osp2_windows.zip if-no-files-found: error retention-days: 5 @@ -121,9 +100,8 @@ jobs: prerelease: false title: Latest Build files: | - qvm - so - dll + osp2_windows + osp2_linux diff --git a/Makefile b/Makefile index 19b75597..67b3b5ca 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ endif ifdef WINDOWS LIB_CLIENT_FILE=cgamex86_64.dll RELEASE_FILE=osp2_windows.zip - LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-windows-x86_64/osp2 + LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-$(PLATFORM)-x86_64/osp2 MAKE_RELEASE_ARCHIVE=$(PK3_ROOT_DIR)/tools/7za.exe u $(RELEASE_FILE) $(MOD_ROOT_DIR) endif From 37a8c724d307da17217ead9c0b8166e17cf1ed3e Mon Sep 17 00:00:00 2001 From: Aleksandr Bushuev Date: Fri, 9 Jan 2026 18:34:11 +0500 Subject: [PATCH 4/5] docs --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e5419021..62a63c74 100644 --- a/README.md +++ b/README.md @@ -38,30 +38,20 @@ Telegram [chat](https://t.me/q3_osp2). ## New commands -See [docs/commands.md](docs/commands.md) +See [docs/osp2-q3-ClientReadme.md](docs/osp2-q3-ClientReadme.md) Example config: OSP2.cfg inside mod. ## How to install -- Install Quake3 and OSP mod v1.03 -- copy pk3 file (and so/dll library if you want) into `osp` folder +Unpack zip or tar.gz into your quake3 directory. ## How to build +Run 'make' from root directory. + ### Windows Install [mingw](https://github.com/skeeto/w64devkit/releases) (just unzip and add bin folder to system PATH). -### pk3 - - `cd build/qvm` - - `make` - -### dll/so - - `cd build/library` - - `make` From 7c03512c3a60fa5aaeae8e3745605c7026365128 Mon Sep 17 00:00:00 2001 From: Aleksandr Bushuev Date: Fri, 9 Jan 2026 18:39:19 +0500 Subject: [PATCH 5/5] readme fixed --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 62a63c74..aa5917a3 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,16 @@ Example config: OSP2.cfg inside mod. ## How to install -Unpack zip or tar.gz into your quake3 directory. +- Install Quake3 and OSP mod v1.03 +- Unpack zip or tar.gz into your Quake3 directory. ## How to build -Run 'make' from root directory. +### Linux -### Windows +Run 'make' from OSP2 directory. -Install [mingw](https://github.com/skeeto/w64devkit/releases) (just unzip and add bin folder to system PATH). +### Windows +Install [mingw](https://github.com/skeeto/w64devkit/releases) (just unzip and add bin folder to system PATH) and run 'make' from OSP2 directory.