Compare commits
3 commits
master
...
gui2_float
Author | SHA1 | Date | |
---|---|---|---|
![]() |
185fca8444 | ||
![]() |
6d8e44a4f0 | ||
![]() |
916f8f63ca |
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
Checks: '-*,modernize-use-nullptr,performance-unnecessary-value-param'
|
||||
WarningsAsErrors: true
|
||||
...
|
|
@ -1,19 +0,0 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.cfg]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{cpp,hpp}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.lua]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
7
.gitattributes
vendored
|
@ -2,8 +2,5 @@
|
|||
/attic export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
/.github export-ignore
|
||||
/changelog_entries export-ignore
|
||||
|
||||
# help github's language detection and syntax highlighting
|
||||
*.cfg linguist-language=INI
|
||||
.travis.yml export-ignore
|
||||
RELEASE_NOTES export-ignore
|
||||
|
|
12
.github/FUNDING.yml
vendored
|
@ -1,12 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: Wesnoth
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
46
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,46 +0,0 @@
|
|||
name: Bug Report
|
||||
description: Create a bug report to help us improve the game.
|
||||
labels: ['Bug']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: info
|
||||
attributes:
|
||||
label: Game and System Information
|
||||
description: |
|
||||
- What version of the game are you running? (If you built wesnoth yourself, mention the exact commit)
|
||||
- What OS are you running?
|
||||
value: |
|
||||
- **Version:**
|
||||
- **OS:**
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description of the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: to_reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce the behavior
|
||||
placeholder: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
- type: textarea
|
||||
id: expectation
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
A clear and concise description of what you expected to happen. If applicable, add screenshots or savefiles to help explain your problem.
|
||||
To find savefiles, start Wesnoth, click on the `i` button at the bottom left corner of the title screen, and open the `Saved games` directory.
|
||||
|
||||
- type: textarea
|
||||
id: more_info
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context (compiler logs, console output, etc) about the problem here.
|
14
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Feature Request
|
||||
description: Request a new feature to enhance the game.
|
||||
labels: ['Enhancement']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the desired feature
|
||||
description: |
|
||||
Try to explain the desired end result, rather than speculating about how the feature could be implemented.
|
||||
If applicable, add screenshots or mockups to help explain your request.
|
||||
validations:
|
||||
required: true
|
|
@ -1,42 +0,0 @@
|
|||
name: Text Typos or Improvements
|
||||
description: Any typo fixes or improvement suggestions for campaign dialog, unit descriptions, or other game text.
|
||||
labels: ['Prose']
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
**Note:** The house style of Wesnoth uses a good many words and constructions that are archaic, poetic,
|
||||
or dialectal. If you speak modern English as a second language you may incorrectly read these as errors.
|
||||
Please see [NotSpellingMistakes](https://wiki.wesnoth.org/NotSpellingMistakes) for a list of things you
|
||||
will encounter that may look like spelling or usage errors but are not.
|
||||
|
||||
Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em
|
||||
dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.
|
||||
|
||||
- type: input
|
||||
id: language
|
||||
attributes:
|
||||
label: Language
|
||||
description: What language does the typo appear in?
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: Source
|
||||
description: Where does the typo appear? If part of a campaign, specify the scenario.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: original_text
|
||||
attributes:
|
||||
label: Original Text
|
||||
description: Quote the text verbatim. You can use `**bold**` to highlight the issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: new_text
|
||||
attributes:
|
||||
label: Proposed Change
|
284
.github/labeler.yml
vendored
|
@ -1,284 +0,0 @@
|
|||
Achievements:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/achievements.hpp
|
||||
- src/achievements.cpp
|
||||
- src/gui/dialogs/achievements_dialog.hpp
|
||||
- src/gui/dialogs/achievements_dialog.cpp
|
||||
- data/achievements.cfg
|
||||
- data/campaigns/*/achievements.cfg
|
||||
|
||||
Add-ons:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/server/campaignd/**
|
||||
- src/server/common/**
|
||||
- src/addon/**
|
||||
- src/gui/dialogs/addon/**
|
||||
|
||||
AI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/ai/**/*
|
||||
- data/campaigns/*/ai/**
|
||||
- src/ai/**/*
|
||||
|
||||
Audio:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/*/sounds/**
|
||||
- data/core/music/*
|
||||
- data/core/sounds/**/*
|
||||
- sounds/*
|
||||
|
||||
Building:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- projectfiles/**/*
|
||||
- source_lists/*
|
||||
- CMakeLists.txt
|
||||
- cmake/*
|
||||
- src/CMakeLists.txt
|
||||
- SConstruct
|
||||
- scons/*
|
||||
- src/SConscript
|
||||
- src/SConstruct
|
||||
|
||||
Campaign AToTB:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Two_Brothers/**
|
||||
|
||||
Campaign DW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Dead_Water/**
|
||||
|
||||
Campaign DM:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Delfadors_Memoirs/**
|
||||
|
||||
Campaign DiD:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Descent_Into_Darkness/**
|
||||
|
||||
Campaign EI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Eastern_Invasion/**
|
||||
|
||||
Campaign HttT:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Heir_To_The_Throne/**
|
||||
|
||||
Campaign LoW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Legend_of_Wesmere/**
|
||||
|
||||
Campaign L:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Liberty/**
|
||||
|
||||
Campaign NR:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Northern_Rebirth/**
|
||||
|
||||
Campaign SoF:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Sceptre_of_Fire/**
|
||||
|
||||
Campaign SotA:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Secrets_of_the_Ancients/**
|
||||
|
||||
Campaign SotBE:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Son_Of_The_Black_Eye/**
|
||||
|
||||
Campaign THoT:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_Hammer_of_Thursagan/**
|
||||
|
||||
Campaign TRoW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_Rise_Of_Wesnoth/**
|
||||
|
||||
Campaign TSG:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_South_Guard/**
|
||||
|
||||
Campaign Tutorial:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/tutorial/**
|
||||
|
||||
Campaign UtBS:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Under_the_Burning_Suns/**
|
||||
|
||||
Campaign WoF:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Winds_of_Fate/**
|
||||
|
||||
Campaign WC:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/World_Conquest/**
|
||||
|
||||
CMake:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- CMakeLists.txt
|
||||
- cmake/*
|
||||
- src/CMakeLists.txt
|
||||
|
||||
Docker:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .dockerignore
|
||||
- utils/dockerbuilds/travis/*
|
||||
- utils/travis/docker_run.sh
|
||||
|
||||
Docs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/**/*
|
||||
|
||||
Editor:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/core/editor/*
|
||||
- src/editor/**/*
|
||||
|
||||
Graphics:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- images/**/*
|
||||
- data/campaigns/*/images/**
|
||||
- data/core/images/**/*
|
||||
|
||||
Help:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/tips.cfg
|
||||
- data/core/help.cfg
|
||||
- src/help/*
|
||||
- src/gui/dialogs/help_browser.*
|
||||
|
||||
Input:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/core/hotkeys.cfg
|
||||
|
||||
Lua API:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/scripting/**/*
|
||||
- data/lua/**/*
|
||||
|
||||
macOS:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- projectfiles/Xcode/**/*
|
||||
- src/macosx/*
|
||||
|
||||
MP:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/multiplayer/**/*
|
||||
- src/server/wesnothd/**
|
||||
- src/server/common/**
|
||||
|
||||
Packaging:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- packaging/**/*
|
||||
|
||||
Schema:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/travis/schema_validation.sh
|
||||
- data/schema/**/*
|
||||
- src/serialization/schema/*
|
||||
|
||||
SCons:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- SConstruct
|
||||
- scons/*
|
||||
- src/SConscript
|
||||
- src/SConstruct
|
||||
|
||||
Services:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/mp-server/**
|
||||
|
||||
Terrain:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/terrain/**/*
|
||||
- data/campaigns/*/images/terrain/**
|
||||
- data/campaigns/**/terrain.cfg
|
||||
- data/campaigns/**/terrain_graphics.cfg
|
||||
- data/core/images/terrain/**
|
||||
- data/core/terrain.cfg
|
||||
- data/core/terrain-graphics.cfg
|
||||
- data/core/terrain-graphics/**
|
||||
|
||||
Translations:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- po/**/*
|
||||
- data/languages/*
|
||||
|
||||
Travis:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/travis/**/*
|
||||
|
||||
UI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/gui/**/*
|
||||
- data/gui/**/*
|
||||
- data/schema/gui.cfg
|
||||
- data/themes/*
|
||||
|
||||
Unit Tests:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/test/**/*
|
||||
|
||||
Units:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/units/**/*
|
||||
- data/campaigns/*/units/**
|
||||
- data/core/units/**/*
|
||||
- data/core/images/units/**/*
|
||||
|
||||
WML Tools:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/tools/**/*
|
||||
|
||||
WFL:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/formula/**
|
||||
- src/ai/formula/**
|
391
.github/workflows/ci-main.yml
vendored
|
@ -1,391 +0,0 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
checks: # checks that don't need a wesnoth binary
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
options: --tty # docker create options
|
||||
env:
|
||||
CLICOLOR_FORCE: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set git safe directory
|
||||
if: success() || failure()
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
- name: Check for invalid characters
|
||||
if: success() || failure()
|
||||
run: |
|
||||
./utils/CI/check_utf8.sh
|
||||
./utils/CI/utf8_bom_dog.sh
|
||||
- name: Whitespace and WML indentation check
|
||||
if: success() || failure()
|
||||
run: ./utils/CI/fix_whitespace.sh; git status; git diff --exit-code
|
||||
- name: WML missing images check
|
||||
if: success() || failure()
|
||||
run: utils/CI/check_wml_images.sh
|
||||
- name: Run luacheck
|
||||
if: success() || failure()
|
||||
run: luacheck .
|
||||
- name: Doxygen check
|
||||
if: success() || failure()
|
||||
run: doxygen doc/doxygen/Doxyfile
|
||||
|
||||
copyright: # check takes a bit longer and does not need to run in docker (sound/music only)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { fetch-depth: 50 } }
|
||||
|
||||
- name: Sound/Music copyright check
|
||||
run: ./update_copyrights
|
||||
|
||||
ubuntu:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# the check for WML tests below may need to be adjusted if configurations are changed
|
||||
- { cfg: debug, tool: scons, cc: gcc, cxx: g++, std: 17, lto: false, sys_lua: false }
|
||||
- { cfg: release, tool: cmake, cc: gcc, cxx: g++, std: 20, lto: true, sys_lua: false }
|
||||
- { cfg: release, tool: cmake, cc: clang, cxx: clang++, std: 17, lto: true, sys_lua: true }
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
options: --tty # docker create options
|
||||
env:
|
||||
TOOL: ${{ matrix.tool }}
|
||||
CFG: ${{ matrix.cfg }}
|
||||
CC: ${{ matrix.cc }}
|
||||
CXX: ${{ matrix.cxx }}
|
||||
CXX_STD: ${{ matrix.std }}
|
||||
LTO: ${{ matrix.lto }}
|
||||
SYS_LUA: ${{ matrix.sys_lua }}
|
||||
CLICOLOR_FORCE: 1
|
||||
SDL_VIDEODRIVER: dummy
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
# 1) wesnothd and campaignd should be buildable without SDL2 being present
|
||||
# 2) boost is installed via apt as well as built and installed into /usr/local (for _GLIBCXX_DEBUG support in boost program options)
|
||||
# 3) mariadbpp currently has a deprecation warning that causes strict builds to fail
|
||||
# scons doesn't build it for the wesnoth client and the boost tests, but cmake apparently does
|
||||
- name: Build wesnoth, wesnothd, campaignd and unit tests
|
||||
id: build # needed to check step outcome
|
||||
run: |
|
||||
case $TOOL in
|
||||
scons)
|
||||
build() {
|
||||
ldconfig
|
||||
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
|
||||
extra_flags_config="-pipe" forum_user_handler=true \
|
||||
nls=false enable_lto="$LTO" system_lua="$SYS_LUA" force_color=true \
|
||||
jobs=2 --debug=time glibcxx_debug=true glibcxx_assertions=true compile_db=true
|
||||
}
|
||||
build strict=true wesnoth boost_unit_tests
|
||||
|
||||
build cdb
|
||||
# disable all warnings since we have coverage on them in a standard build, and clang-tidy
|
||||
# triggers false positive compiler warnings that clang itself won't
|
||||
run-clang-tidy -quiet -use-color -j 2 -extra-arg="-w" -warnings-as-errors='*' '^(?!.*src/modules/|.*build/)'
|
||||
|
||||
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
|
||||
|
||||
build strict=false wesnothd campaignd
|
||||
;;
|
||||
cmake)
|
||||
build() {
|
||||
ldconfig
|
||||
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
|
||||
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_MYSQL=true \
|
||||
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 \
|
||||
-DENABLE_SYSTEM_LUA="$SYS_LUA -DCLANG_TIDY=true" .
|
||||
}
|
||||
rm -R /usr/local/lib/cmake
|
||||
rm /usr/local/lib/libboost*
|
||||
rm -R /usr/local/include/boost
|
||||
build -DENABLE_GAME=true -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=true -DENABLE_STRICT_COMPILATION=false
|
||||
make conftests
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
|
||||
|
||||
build -DENABLE_GAME=false -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=false -DENABLE_STRICT_COMPILATION=false
|
||||
make VERBOSE=1 -j2
|
||||
;;
|
||||
esac
|
||||
- name: Check path options
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: |
|
||||
./wesnoth --version
|
||||
for opt in data userdata usercache
|
||||
do
|
||||
output=$(./wesnoth --nobanner --"$opt"-path)
|
||||
if [ "$output" = "" ]; then printf 'option --%s-path prints nothing to stdout!\n' "$opt" >&2; exit 1; fi
|
||||
printf '%s-path: %s\n' "$opt" "$output"
|
||||
done
|
||||
- name: WML validation
|
||||
# only run on release builds (takes ~10 times as long on debug); since there are multiple release builds
|
||||
# but running the following tests multiple times doesn't make much sense use cc==clang as the check
|
||||
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
|
||||
run: ./utils/CI/schema_validation.sh
|
||||
- name: Run WML tests
|
||||
# only run on release builds (takes ~6 times as long on debug)
|
||||
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
|
||||
run: ./run_wml_tests -v -v -g -c -t 20 -bt 1000 -a=--userdata-dir=ud
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cc == 'clang' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-Linux
|
||||
path: ud
|
||||
- name: Run play tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./utils/CI/play_test_executor.sh
|
||||
- name: Run MP tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./utils/CI/mp_test_executor.sh
|
||||
- name: Run unit tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./run_boost_tests
|
||||
|
||||
steam-runtime:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: Steam Runtime
|
||||
run: |
|
||||
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h)
|
||||
cd utils/dockerbuilds && ./make_steam_build
|
||||
tar -cf "steambuild-$version.tar" steambuild
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Steam-Linux
|
||||
path: utils/dockerbuilds/steambuild-*.tar
|
||||
|
||||
mingw:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: MinGW Crosscompile
|
||||
run: |
|
||||
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h)
|
||||
git archive --format=tar HEAD > "wesnoth-$version.tar"
|
||||
tar -rf "wesnoth-$version.tar" src/modules/
|
||||
bzip2 "wesnoth-$version.tar"
|
||||
|
||||
cd utils/dockerbuilds && ./make_mingw_build
|
||||
mv mingwbuild/wesnoth*-win64.exe "wesnoth-$version-win64.exe"
|
||||
|
||||
- name: Upload Source
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Source
|
||||
path: wesnoth-*.tar.bz2
|
||||
|
||||
- name: Upload Windows-Installer
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Windows-Installer
|
||||
path: utils/dockerbuilds/wesnoth-*-win64.exe
|
||||
|
||||
flatpak:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:flatpak-master
|
||||
options: --tty --cap-add=ALL --privileged # docker create options
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive", fetch-depth: 500, fetch-tags: true } }
|
||||
|
||||
- name: Flatpak
|
||||
run: |
|
||||
# write to an ignored filename so the build is not marked as modified
|
||||
jq '.modules |= map(select(.name == "wesnoth").sources[0]={type:"dir",path:"."})' packaging/flatpak/org.wesnoth.Wesnoth.json > wesnoth-manifest.json
|
||||
git config --global --add safe.directory "$PWD"
|
||||
branch=ci-$(git describe || git log -n 1 --format=%h) # if git describe fails fall back to the commit hash
|
||||
flatpak-builder --force-clean --default-branch="$branch" --disable-rofiles-fuse --jobs=2 wesnoth-app wesnoth-manifest.json
|
||||
flatpak build-export export wesnoth-app "$branch"
|
||||
flatpak build-bundle export wesnoth.flatpak org.wesnoth.Wesnoth "$branch" --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Upload flatpak bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Flatpak-Bundle
|
||||
path: wesnoth.flatpak
|
||||
|
||||
translations:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
env:
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LANG: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
CLICOLOR_FORCE: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Translations
|
||||
run: |
|
||||
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false -DENABLE_POT_UPDATE_TARGET=TRUE .
|
||||
make update-po4a-man; echo "Ran make update-po4a-man"
|
||||
make update-po4a-manual; echo "Ran make update-po4a-manual"
|
||||
make pot-update; echo "Ran make pot-update"
|
||||
make mo-update; echo "Ran make mo-update"
|
||||
make clean
|
||||
|
||||
scons translations build=release --debug=time nls=true jobs=2; echo "Ran scons translations"
|
||||
scons pot-update; echo "Ran scons pot-update"
|
||||
scons update-po4a; echo "Ran scons update-po4a"
|
||||
scons manual
|
||||
|
||||
macos-intel:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cfg: [ Release ]
|
||||
runs-on: macos-13
|
||||
env:
|
||||
CFG: ${{ matrix.cfg }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install scons
|
||||
./projectfiles/Xcode/Fix_Xcode_Dependencies
|
||||
- name: Build translations
|
||||
run: scons translations build=release --debug=time nls=true jobs=2
|
||||
- name: Build wesnoth and unit tests
|
||||
working-directory: projectfiles/Xcode
|
||||
run: |
|
||||
xcodebuild ARCHS=x86_64 -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -target "unit_tests" -configuration "$CFG"
|
||||
# xcodebuild or maybe clang do not appear to fail properly when input files cannot be found; double check executables were produced
|
||||
[ -x "build/$CFG/The Battle for Wesnoth.app" ] || { printf 'Failed to build wesnoth executable!\n' >&2; exit 1; }
|
||||
[ -x "build/$CFG/unit_tests" ] || { printf 'Failed to build unit test executable!\n' >&2; exit 1; }
|
||||
- name: Create disk image
|
||||
working-directory: projectfiles/Xcode
|
||||
continue-on-error: true # allow failures since this is not essential and it does fail spuriously (hdiutil: create failed - Resource busy)
|
||||
run: hdiutil create -volname "Wesnoth_$CFG" -fs 'HFS+' -srcfolder "build/$CFG" -ov -format UDBZ "Wesnoth_${CFG}.dmg"
|
||||
- name: Upload disk image
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MacOS ${{ matrix.cfg }} disk image
|
||||
path: projectfiles/Xcode/Wesnoth_${{ matrix.cfg }}.dmg
|
||||
- name: Run WML tests
|
||||
if: matrix.cfg == 'Release'
|
||||
run: ./run_wml_tests -g -c -t 30 -bt 350 -p "projectfiles/Xcode/build/$CFG/The Battle for Wesnoth.app/Contents/MacOS/The Battle for Wesnoth" -a=--userdata-dir="$PWD/ud"
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cfg == 'Release' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-MacOS
|
||||
path: ud
|
||||
- name: Run unit tests
|
||||
run: ./run_boost_tests --path=projectfiles/Xcode/build/"$CFG" --executable=unit_tests
|
||||
|
||||
windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cfg: [Release]
|
||||
env:
|
||||
CFG: ${{ matrix.cfg }}
|
||||
VCPKG_FEATURE_FLAGS: dependencygraph
|
||||
permissions:
|
||||
contents: write # for dependency graph
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: Make version of the runner image (https://github.com/actions/runner-images/releases) accessible to expression
|
||||
run: echo IMAGE_VERSION=%ImageVersion%>> %GITHUB_ENV%
|
||||
|
||||
- name: Cache object files
|
||||
id: windows-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vcpkg_installed # vcpkg generates this dir next to vcpkg.json
|
||||
# the final key part needs to be changed if anything in the build process changes that is not already included here
|
||||
key: win-cache-master-${{ matrix.cfg }}-${{ env.IMAGE_VERSION }}-${{ hashFiles('vcpkg.json') }}-0001
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Run cmake
|
||||
run: cmake -DCMAKE_BUILD_TYPE=%CFG% -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true
|
||||
-DENABLE_TESTS=true -DENABLE_MYSQL=false -DENABLE_NLS=false
|
||||
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--debug
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 17 2022" .
|
||||
|
||||
- name: Build wesnoth, wesnothd, campaignd and unit tests
|
||||
run: MSBuild.exe wesnoth.sln -p:Configuration=%CFG%
|
||||
|
||||
- name: Run WML unit tests
|
||||
if: matrix.cfg == 'Release'
|
||||
run: python run_wml_tests -v -g -c -t 20 -p %CFG%/wesnoth.exe -a=--userdata-dir=ud
|
||||
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cfg == 'Release' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-Windows
|
||||
path: ud
|
||||
|
||||
# run after all other jobs have completed to check overall build status
|
||||
notification:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [checks, copyright, ubuntu, steam-runtime, mingw, flatpak, translations, macos-intel, windows]
|
||||
if: failure() && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Discord Notification
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
with:
|
||||
severity: error
|
||||
webhookUrl: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||
description: |-
|
||||
pusher: ${{ github.actor }}
|
||||
commit: ${{ github.event.head_commit.message }}
|
||||
commit url: ${{ github.event.head_commit.url }}
|
||||
- name: Prepare message
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
printf COMMIT_SUBJECT=%s "${MSG}" | head -n 1 >> "$GITHUB_ENV"
|
||||
- name: IRC Notification
|
||||
uses: rectalogic/notify-irc@v1
|
||||
with:
|
||||
channel: ${{ vars.IRC_CHANNEL }}
|
||||
server: ${{ vars.IRC_SERVER }}
|
||||
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username
|
||||
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }}
|
||||
message: "❌ ${{ github.workflow }} workflow run ${{ github.run_number }} failed on \x0306${{ github.ref_name }}\x0F: ${{ env.COMMIT_SUBJECT }} by \x0315${{ github.actor }}\x0F: \x0302${{ github.event.head_commit.url }}\x0F"
|
67
.github/workflows/codeql.yml
vendored
|
@ -1,67 +0,0 @@
|
|||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 360
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp', 'python', 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- { name: Checkout repository, uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
- name: Install dependencies
|
||||
if: matrix.language == 'cpp'
|
||||
run: |
|
||||
utils/autorevision.sh -t h > src/revision.h
|
||||
sudo apt update
|
||||
sudo apt install scons libboost-system1.83-dev libboost-filesystem1.83-dev libboost-iostreams1.83-dev \
|
||||
libboost-serialization1.83-dev libboost-locale1.83-dev libboost-regex1.83-dev libboost-random1.83-dev \
|
||||
libboost-program-options1.83-dev libboost-thread1.83-dev libboost-context1.83-dev libboost-test-dev \
|
||||
libboost-coroutine1.83-dev libboost-graph1.83-dev libasio-dev libsdl2-dev libsdl2-image-dev \
|
||||
libsdl2-mixer-dev libvorbis-dev libpango1.0-dev libssl-dev libcurl4-openssl-dev liblua5.4-dev
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
88
.github/workflows/image_metadata.yml
vendored
|
@ -1,88 +0,0 @@
|
|||
name: Image metadata check CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
|
||||
pull_request:
|
||||
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Image Metadata
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BASE_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
|
||||
HEAD_SHA: ${{ github.event_name == 'push' && github.event.after || github.event.pull_request.head.sha }}
|
||||
|
||||
steps:
|
||||
- name: exiftool installation
|
||||
run: |
|
||||
sudo apt-get install --assume-yes exiftool
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: check image EXIF metadata
|
||||
run: |
|
||||
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.(webp|je?pg)$')
|
||||
# cycle through the changed image files, make sure they have the right fields
|
||||
for file in "${image_files[@]}"; do
|
||||
# check Artist tag, fail if missing
|
||||
artist="$(exiftool -p '$Artist' "$file")"
|
||||
if [ "$artist" ]; then
|
||||
printf 'Artist tag in %s is %s\n' "$file" "$artist"
|
||||
else
|
||||
printf 'no Artist EXIF tag in %s\n' "$file"
|
||||
exit 1
|
||||
fi
|
||||
# check Copyright tag, fail if missing or wrong type
|
||||
copyright="$(exiftool -p '$Copyright' "$file")"
|
||||
case $copyright in
|
||||
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
|
||||
printf 'Copyright tag in %s is %s\n' "$file" "$copyright"
|
||||
;;
|
||||
'')
|
||||
printf 'no Copyright EXIF tag in %s\n' "$file"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
printf 'Copyright tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
- name: check png XMP metadata
|
||||
run: |
|
||||
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.png$')
|
||||
# cycle through the changed image files, make sure they have the right fields
|
||||
for file in "${image_files[@]}"; do
|
||||
# check Creator tag, fail if missing
|
||||
artist="$(exiftool -p '$XMP:Creator' "$file")"
|
||||
if [ "$artist" ]; then
|
||||
printf 'Creator tag in %s is %s\n' "$file" "$artist"
|
||||
else
|
||||
printf 'no Creator XMP tag in %s\n' "$file"
|
||||
exit 1
|
||||
fi
|
||||
# check Rights tag, fail if missing or wrong type
|
||||
copyright="$(exiftool -p '$XMP:Rights' "$file")"
|
||||
case $copyright in
|
||||
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
|
||||
printf 'Rights tag in %s is %s\n' "$file" "$copyright"
|
||||
;;
|
||||
'')
|
||||
printf 'no Rights XMP tag in %s\n' "$file"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
printf 'Rights tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
45
.github/workflows/irc-notify.yml
vendored
|
@ -1,45 +0,0 @@
|
|||
name: IRC Notification
|
||||
on:
|
||||
push:
|
||||
pull_request_target:
|
||||
types: [ opened, closed, reopened ]
|
||||
issues:
|
||||
types: [ opened, closed, reopened ]
|
||||
# create: # creation also gets mentioned when pushing
|
||||
delete:
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
if: vars.IRC_CHANNEL != '' # skip if not set up (like in a fork for example)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare message
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
printf COMMIT_SUBJECT=%s "${MSG}" | head -n 1 >> "$GITHUB_ENV"
|
||||
- uses: rectalogic/notify-irc@v1
|
||||
env: { COLOR: "\x03", BLUE: "02", PURPLE: "06", ACTOR: "\x0315${{ github.actor }}\x03" }
|
||||
with:
|
||||
channel: ${{ vars.IRC_CHANNEL }}
|
||||
server: ${{ vars.IRC_SERVER }}
|
||||
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username
|
||||
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }}
|
||||
# See https://docs.github.com/en/actions/learn-github-actions/expressions
|
||||
# github context: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
|
||||
# github.event data: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads
|
||||
message: >-
|
||||
${{ (github.event_name == 'push' &&
|
||||
format('{1} {2} {0}{3}{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR,
|
||||
(github.event.created && (github.event.tag && 'tagged' || 'created')) || (github.event.deleted && 'deleted') || (github.event.forced && 'force-pushed to') || 'pushed to',
|
||||
env.PURPLE, github.ref_name, env.COMMIT_SUBJECT, env.BLUE, github.event.compare)
|
||||
) || (github.event_name == 'pull_request_target' &&
|
||||
format('{1} {2} PR #{3} for {0}{4}{5}{0}: {6}: {0}{7}{8}{0}', env.COLOR, env.ACTOR, github.event.action, github.event.number, env.PURPLE, github.base_ref, github.event.pull_request.title, env.BLUE, github.event.pull_request.html_url)
|
||||
) || (github.event_name == 'issues' &&
|
||||
format('{1} {2} issue {0}{3}#{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR, github.event.action, env.PURPLE, github.event.issue.number, github.event.issue.title, env.BLUE, github.event.issue.html_url)
|
||||
) || ((github.event_name == 'create' || github.event_name == 'delete') &&
|
||||
format('{1} {2}d {3} {0}{4}{5}{0}', env.COLOR, env.ACTOR, github.event_name, github.event.ref_type, env.PURPLE, github.event.ref)
|
||||
)
|
||||
}}
|
||||
_debug: ${{ toJSON(github) }}
|
12
.github/workflows/labeler.yml
vendored
|
@ -1,12 +0,0 @@
|
|||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@main
|
78
.github/workflows/map-diff.yml
vendored
|
@ -1,78 +0,0 @@
|
|||
name: Map Diff
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- '**.map'
|
||||
|
||||
jobs:
|
||||
comment-map-diff:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: utils/wesnoth-map-diff
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Package install
|
||||
run: npm install
|
||||
- name: Package build
|
||||
run: npm run build:prod
|
||||
- name: Get maps diff
|
||||
id: get-maps-diff
|
||||
env:
|
||||
SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
sudo apt-get -y -q install pngquant
|
||||
comment_body=""
|
||||
log() { printf '\e[1m%s\e[m\n' "$*"; } # write log message in bold
|
||||
|
||||
## Get changed maps
|
||||
git fetch --depth=1 origin "$SHA"
|
||||
mapfile -t map_paths < <(git diff --name-only HEAD "$SHA" | grep '\.map$')
|
||||
|
||||
for map_path in "${map_paths[@]}"
|
||||
do
|
||||
## Get new map version
|
||||
log "Check out $map_path from $SHA..."
|
||||
new_map=${map_path##*/}
|
||||
git show "$SHA":"$map_path" > "$new_map"
|
||||
|
||||
log "Generate map diff image for $map_path..."
|
||||
node build/index.js "../../$map_path" "$new_map" diff_image.png
|
||||
identify diff_image.png
|
||||
|
||||
log 'Compress image...'
|
||||
pngquant --force --output diff_image.png diff_image.png
|
||||
identify diff_image.png
|
||||
|
||||
log 'Uploading diff_image.png...'
|
||||
json=$(curl -s -F image=@diff_image.png https://api.imgur.com/3/upload | tee /dev/stderr) || continue
|
||||
|
||||
log 'Generating HTML comment...'
|
||||
html=$(jq -r --arg path "$map_path" 'if .data.link != null
|
||||
then @html "<h3>\($path)</h3><img src=\"\(.data.link)\" /> <br />"
|
||||
elif has("errors") then .errors[].status | halt_error
|
||||
else "Unexpected JSON structure!\n" | halt_error end' <<< "$json") || continue
|
||||
comment_body+=$html
|
||||
done
|
||||
|
||||
printf 'COMMENT_BODY=%s\n' "$comment_body" >> "$GITHUB_OUTPUT"
|
||||
- name: Find comment
|
||||
uses: peter-evans/find-comment@v2
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
- name: Add comment
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
edit-mode: replace
|
||||
body: ${{ steps.get-maps-diff.outputs.COMMENT_BODY }}
|
81
.gitignore
vendored
|
@ -18,16 +18,6 @@ CPack*Config.cmake
|
|||
uninstall.cmake
|
||||
CMakeCache.txt
|
||||
install_manifest.txt
|
||||
out/**/*
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
Testing/*
|
||||
doc/CTestTestfile.cmake
|
||||
doc/design/CTestTestfile.cmake
|
||||
doc/man/CTestTestfile.cmake
|
||||
doc/manual/CTestTestfile.cmake
|
||||
src/CTestTestfile.cmake
|
||||
src/Testing/
|
||||
|
||||
# scons
|
||||
.scons-option-cache
|
||||
|
@ -37,16 +27,12 @@ buildlog.txt
|
|||
|
||||
# XCode
|
||||
projectfiles/Xcode/**/build
|
||||
projectfiles/Xcode/**/DerivedData
|
||||
projectfiles/Xcode/**/Headers
|
||||
projectfiles/Xcode/**/temp
|
||||
projectfiles/Xcode/**/Index
|
||||
projectfiles/Xcode/**/Wesnoth.dmgCanvas
|
||||
projectfiles/Xcode/**/*.mode1v3
|
||||
projectfiles/Xcode/**/*.pbxuser
|
||||
projectfiles/Xcode/**/xcuserdata
|
||||
projectfiles/Xcode/**/*.xcworkspace
|
||||
!projectfiles/Xcode/**/project.pbxproj
|
||||
projectfiles/Xcode/**/project.xcworkspace
|
||||
|
||||
# CodeBlocks
|
||||
projectfiles/**/.clang
|
||||
|
@ -59,30 +45,30 @@ projectfiles/**/*_build_log.html
|
|||
projectfiles/**/*objs*
|
||||
|
||||
# Visual Studio
|
||||
projectfiles/VC*
|
||||
!projectfiles/VC12
|
||||
projectfiles/VC*/.vs/
|
||||
projectfiles/VC*/*.vc.*db
|
||||
projectfiles/VC*/*.sdf
|
||||
projectfiles/VC*/*.suo
|
||||
projectfiles/VC*/*.aps
|
||||
projectfiles/VC*/*.user
|
||||
ALL_BUILD.vcproj
|
||||
INSTALL.vcproj
|
||||
PACKAGE.vcproj
|
||||
ZERO_CHECK.vcproj
|
||||
uninstall.vcproj
|
||||
*.vcproj.*.user
|
||||
src/**/*.vcproj
|
||||
/WindowsTimeout.ilk
|
||||
/WindowsTimeout.pdb
|
||||
.vscode
|
||||
/.vs
|
||||
vcpkg_installed/
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
doc/**/*.vcxproj
|
||||
doc/**/*.vcxproj.filters
|
||||
src/**/*.vcxproj
|
||||
src/**/*.vcxproj.filters
|
||||
vcpkg-manifest-install.log
|
||||
|
||||
# CLion
|
||||
/.idea
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
|
||||
# eclipse
|
||||
.settings
|
||||
!utils/umc_dev/org.wesnoth*/.settings/
|
||||
!utils/umc_dev/org.wesnoth*/.project
|
||||
|
||||
# KDevelop caches (KDevelop 4.3.1, KDE Development Platform 4.8.4).
|
||||
*.kate-swp
|
||||
|
||||
# autotools
|
||||
config.h
|
||||
config.h.in
|
||||
|
@ -97,7 +83,9 @@ stamp-h1
|
|||
# build directories
|
||||
/wesnoth*
|
||||
/wesnothd*
|
||||
wesnothd/
|
||||
/campaignd*
|
||||
campaignd/
|
||||
/cutter*
|
||||
cutter/
|
||||
/exploder*
|
||||
|
@ -105,15 +93,8 @@ cutter/
|
|||
Release
|
||||
Debug
|
||||
ReleaseDEBUG
|
||||
Test_Debug
|
||||
Test_Release
|
||||
Debug (fast)
|
||||
tags
|
||||
/schema_generator*
|
||||
/schema_validator*
|
||||
/create_images*
|
||||
/wesmage*
|
||||
pgo_data/
|
||||
|
||||
# build results etc.
|
||||
wesnoth_zip
|
||||
|
@ -126,8 +107,6 @@ wesnoth.opt
|
|||
wesnoth.plg
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
compile_commands.json
|
||||
|
||||
# library files
|
||||
.libs
|
||||
|
@ -141,19 +120,19 @@ userdata
|
|||
|
||||
# testing
|
||||
/test*
|
||||
/boost_unit_tests*
|
||||
!/test_wrapper.sh
|
||||
src/test
|
||||
error*.log
|
||||
boost_test_result.xml
|
||||
*build*.sh
|
||||
boost_tests.log
|
||||
|
||||
# translations
|
||||
locales
|
||||
make_translation
|
||||
merge_translations
|
||||
*.gmo
|
||||
po/**/[a-z][a-z]
|
||||
po/**/[a-z][a-z]_[GB]R
|
||||
po/wesnoth*/POTFILES*
|
||||
po/**/pot-update.sh
|
||||
po/**/stamp-po
|
||||
|
@ -166,8 +145,6 @@ po/**/Makefile*
|
|||
data/tools/unit_tree/**/files
|
||||
data/tools/unit_tree/**/reports
|
||||
data/tools/unit_tree/**/Locale
|
||||
data/tools/macro_reference.html
|
||||
about.wiki
|
||||
|
||||
# doc
|
||||
doc/doxygen/html
|
||||
|
@ -194,8 +171,6 @@ data/campaigns/**/images/**/.gitignore
|
|||
.DS_Store
|
||||
[Tt]humbs.db
|
||||
*Neuer Ordner*
|
||||
.directory
|
||||
fonts/.uuid
|
||||
|
||||
# extensions
|
||||
*.pyc
|
||||
|
@ -207,12 +182,6 @@ fonts/.uuid
|
|||
*~
|
||||
.deps
|
||||
.dirstamp
|
||||
*.cfg-bak
|
||||
*.orig
|
||||
|
||||
# might be good to have, but not in data
|
||||
data/**/*.xcf
|
||||
data/**/*.psd
|
||||
|
||||
# uncategorized
|
||||
revision*
|
||||
|
@ -220,9 +189,3 @@ config.h
|
|||
6not
|
||||
.kdev*
|
||||
callgrind.out.*
|
||||
data/dist
|
||||
clean.sh
|
||||
widgets_tested.log
|
||||
|
||||
# clangd cache
|
||||
.cache/clangd
|
||||
|
|
7
.gitmodules
vendored
|
@ -1,7 +0,0 @@
|
|||
[submodule "src/modules/mariadbpp"]
|
||||
path = src/modules/mariadbpp
|
||||
url = https://github.com/viaduck/mariadbpp.git
|
||||
ignore = untracked
|
||||
[submodule "src/modules/lua"]
|
||||
path = src/modules/lua
|
||||
url = https://github.com/lua/lua.git
|
15
.luacheckrc
|
@ -1,15 +0,0 @@
|
|||
-- ignore line length warnings
|
||||
max_line_length=false
|
||||
max_code_line_length=false
|
||||
max_string_line_length=false
|
||||
max_comment_line_length=false
|
||||
-- show the warning/error codes as well
|
||||
codes=true
|
||||
-- don't show files with no issues
|
||||
quiet=1
|
||||
-- don't show undefined variable usage
|
||||
-- there are thousands of warnings here because luacheck is unaware of Wesnoth's lua environment and has no way to check which have been loaded
|
||||
global=false
|
||||
-- don't show unused variables
|
||||
unused=false
|
||||
exclude_files={"src/modules/lua/testes/*.lua"}
|
88
.travis.yml
Normal file
|
@ -0,0 +1,88 @@
|
|||
language: cpp
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
env:
|
||||
- OPT=-O0 CXXSTD=11 NLS=false
|
||||
- OPT=-O2 CXXSTD=11 NLS=false
|
||||
- OPT=-O2 CXXSTD=1y NLS=false
|
||||
- NLS=true
|
||||
- CXXSTD=11 NLS=false USE_CMAKE=true
|
||||
matrix:
|
||||
exclude:
|
||||
- compiler: gcc
|
||||
env: OPT=-O2 CXXSTD=11 NLS=false
|
||||
- compiler: gcc
|
||||
env: NLS=true
|
||||
- compiler: clang
|
||||
env: OPT=-O2 CXXSTD=1y NLS=false
|
||||
- compiler: clang
|
||||
env: OPT=-O0 CXXSTD=11 NLS=false
|
||||
allow_failures:
|
||||
- env: OPT=-O2 CXXSTD=1y NLS=false
|
||||
|
||||
before_install:
|
||||
- export TARGETS="wesnoth wesnothd campaignd test"
|
||||
- export STRICT_COMPILATION=false
|
||||
- export EXTRA_FLAGS_RELEASE=""
|
||||
- export WML_TESTS=true CPP_TESTS=true PLAY_TEST=true MP_TEST=true
|
||||
- export WML_TEST_TIME=15
|
||||
|
||||
- if $NLS; then
|
||||
export TARGETS="translations" CXXSTD=11;
|
||||
export WML_TESTS=false CPP_TESTS=false PLAY_TEST=false MP_TEST=false;
|
||||
fi
|
||||
- if [ "$OPT" == "-O0" ]; then
|
||||
export STRICT_COMPILATION=true;
|
||||
export EXTRA_FLAGS_RELEASE="-O0 -Wno-deprecated-declarations";
|
||||
export PLAY_TEST=false MP_TEST=false WML_TEST_TIME=20;
|
||||
fi
|
||||
- if [[ "$OPT" == "-O0" ]] && [[ "$CXX" == "clang++" ]]; then export EXTRA_FLAGS_RELEASE="-O0 -Wno-deprecated-declarations -Wno-literal-suffix -Wno-deprecated-register"; fi
|
||||
|
||||
install:
|
||||
- if [ "$CXXSTD" == "1y" ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi
|
||||
- travis_wait sudo apt-get update -qq
|
||||
- travis_wait sudo apt-get install -qq libboost-filesystem-dev libboost-iostreams-dev libboost-random-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev libboost-test-dev libboost-locale-dev libboost-thread-dev libcairo2-dev libfribidi-dev libpango1.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev gdb moreutils scons xvfb cmake
|
||||
|
||||
- if [ "$CXXSTD" == "1y" ]; then
|
||||
sudo apt-get install -qq g++-5;
|
||||
export CXX=g++-5;
|
||||
export CC=gcc-5;
|
||||
fi
|
||||
|
||||
script:
|
||||
- ./utils/travis/check_utf8.sh
|
||||
- ./utils/travis/utf8_bom_dog.sh
|
||||
- $CXX --version
|
||||
- if [ "$USE_CMAKE" = true ]; then
|
||||
cmake . -DENABLE_STRICT_COMPILATION=$STRICT_COMPILATION -DENABLE_NLS=$NLS -DENABLE_TESTS=$CPP_TESTS && make VERBOSE=1 -j2;
|
||||
else
|
||||
scons cxxtool=$CXX ctool=$CC --debug=time build=release extra_flags_config=-pipe extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=$STRICT_COMPILATION $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2;
|
||||
fi
|
||||
- "export DISPLAY=:99.0"
|
||||
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24"
|
||||
- if [ "$CPP_TESTS" = true ]; then ./utils/travis/test_wrapper.sh; fi
|
||||
- if [ "$WML_TESTS" = true ]; then ./run_wml_tests -g -v -c -t "$WML_TEST_TIME"; fi
|
||||
- if [ "$PLAY_TEST" = true ]; then ./utils/travis/play_test_executor.sh; fi
|
||||
- if [ "$MP_TEST" = true ]; then ./utils/travis/mp_test_executor.sh; fi
|
||||
|
||||
after_failure:
|
||||
- if [ -f "errors.log" ]; then echo -e "\n*** \n*\n* Errors reported in wml unit tests, here is errors.log...\n*\n*** \n"; cat errors.log; fi
|
||||
- ./utils/travis/test_executor.sh;
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels:
|
||||
- "chat.freenode.net#wesnoth-dev"
|
||||
template:
|
||||
- "\x02%{repository}\x0f#\x0312%{build_number}\x0f (\x0307%{branch}\x0f - \x02%{commit}\x0f : \x0303%{author}\x0f): \x02%{message}\x0f"
|
||||
- "Build details : \x0302%{build_url}\x0f"
|
||||
on_success: change
|
||||
on_failure: always
|
972
CMakeLists.txt
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
The Battle for Wesnoth's Code of Conduct may be found in the following forum post:
|
||||
https://forums.wesnoth.org/viewtopic.php?t=24277
|
144
CONTRIBUTING.md
|
@ -1,144 +0,0 @@
|
|||
# Contributing to Wesnoth
|
||||
|
||||
Wesnoth was built with the hard work of volunteers all over the world! Everyone is welcome to come and contribute code, art, and music to improve the game for everyone who wants to play it.
|
||||
|
||||
## Contacting Us
|
||||
|
||||
The best place to get in touch with the development team is on our [official Discord community server](https://discord.gg/battleforwesnoth) or on the [Wesnoth forums](https://forums.wesnoth.org/).
|
||||
|
||||
The Discord server is mirrored to [Libera.Chat IRC](https://libera.chat), channels: [`#wesnoth`](https://web.libera.chat/#wesnoth) (general discussions), [`#wesnoth-umc-dev`](https://web.libera.chat/#wesnoth-umc-dev) (questions about creating add-ons), [`#wesnoth-dev`](https://web.libera.chat/#wesnoth-dev) (development of wesnoth mainline).
|
||||
|
||||
## Art and Music
|
||||
|
||||
Art and music submissions are accepted usually to fill in missing or outdated assets. If you are interested in contributing, we recommend that you contact us first to determine the best resources for you to work on based on need and interest. We also commission larger projects such as character portraits, story art, and music tracks.
|
||||
|
||||
## Engine
|
||||
|
||||
Wesnoth's engine conforms to the C++17 standard. We encourage the use of standard library APIs over third-party libraries whenever possible. However, third-party libraries are preferred over adding new, custom in-engine APIs, when appropriate.
|
||||
|
||||
### Code Formatting
|
||||
|
||||
All C++, WML and Lua files are in UTF-8, as we use Gettext-style translations, and translatable strings use some punctuation that's outside of the ASCII subset. More details are in the [Typography Style Guide](https://wiki.wesnoth.org/Typography_Style_Guide) and the guide to [using Gettext strings](https://wiki.wesnoth.org/GettextForWesnothDevelopers).
|
||||
|
||||
If your pull request touches the engine's C++ source code, we recommend (but don't require) you run `clang-format` on your changes before submission (Visual Studio Code gives you a handy context menu option to do so). This ensures that your code remains formatted according to our conventions. Make a local commit before running `clang-format`, in case more code than expected gets changed.
|
||||
|
||||
Generally, we follow these conventions in our C++ code:
|
||||
|
||||
```cpp
|
||||
// Use pragma once instead of an include guard. Those are clumsy.
|
||||
#pragma once
|
||||
|
||||
// Includes for files from the src/... directories should use double-quotes.
|
||||
#include "help/help.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
// Use angle brackets for system and external includes.
|
||||
// Includes should also be sorted alphabetically.
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Classes should have scope specifiers (public, protected, private), but structs can omit them.
|
||||
struct my_struct
|
||||
{
|
||||
// Public members do not need a trailing underscore.
|
||||
// Inline initialization is acceptable over a constructor.
|
||||
bool member = false;
|
||||
};
|
||||
|
||||
// Class names are lower-case with underscores between words.
|
||||
// Put braces on new lines after class and struct declarations.
|
||||
class my_class
|
||||
{
|
||||
public:
|
||||
// Use using directives over typedefs. They're easier to read.
|
||||
using alias_t = std::vector<my_struct>;
|
||||
|
||||
// Use leading commas in the ctor list
|
||||
// Use the T& foo or T* foo reference and pointer styles, not T &foo or T *foo.
|
||||
// Use the "explicit" keyword for single-argument constructors.
|
||||
explicit my_class(alias_t& ref)
|
||||
: the_array_of_doom_()
|
||||
, vec_ptr_(nullptr) // Use nullptr instead of NULL or 0
|
||||
{
|
||||
// Use C++ casts (static_cast and dynamic_cast) instead of C-style casts.
|
||||
// Do try and avoid reinterpret_cast and const_cast if at all possible.
|
||||
const float cast_test = static_cast<float>(how_far_to_destination_);
|
||||
|
||||
// Don't put a space after conditional keywords, and keep their opening brackets on the same line.
|
||||
if(!ref.empty()) {
|
||||
vec_ptr_ = &ref;
|
||||
|
||||
// Use lambdas for short functions like this.
|
||||
// We also encourage the use of auto in lambdas and other places where
|
||||
// type names are long and can be inferred.
|
||||
std::sort(ref.begin(), ref.end(), [](const auto& a, const auto& b) {
|
||||
return a.member && !b.member;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep class method brackets on their own line, and always utilize const for methods and
|
||||
* variables when possible.
|
||||
*
|
||||
* For documenting functions, we loosely follow Doxygen conventions. You don't need to document
|
||||
* every single function, but important ones should optimally have at least a one-line comment
|
||||
* explaining what it does.
|
||||
*
|
||||
* This returns a translatable string, using gettext's _ function.
|
||||
*
|
||||
* @param speaker_id The person speaking
|
||||
*/
|
||||
t_string exclaim(const std::string& speaker_id) const
|
||||
{
|
||||
if(how_far_to_destination_ < 100) {
|
||||
if(speaker_id == "signboard") {
|
||||
return _("Oldwood — enter at own risk");
|
||||
} else {
|
||||
// TRANSLATORS: The lake is the small underground one in S06 Temple in the Deep
|
||||
return _("Hmm, someone has written underneath “Fire-carrying trespassers will be thrown in the lake.”");
|
||||
}
|
||||
} else {
|
||||
return _("Clearwater — just keep following the river");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// End private class members with an underscore. Additionally, use C++ standard
|
||||
// like std::array as opposed to C equivalents (such as int[])
|
||||
std::array<int, 8> the_array_of_doom_;
|
||||
|
||||
alias_t* vec_ptr_;
|
||||
|
||||
// Use static or constexpr for constants. Don't use macros.
|
||||
static const int how_far_to_destination_ = 1000;
|
||||
};
|
||||
```
|
||||
|
||||
## Translations
|
||||
For specific information on how to update and submit translations, see [here](https://wiki.wesnoth.org/WesnothTranslationsHowTo).
|
||||
|
||||
## Bug Reports
|
||||
|
||||
Please report any bugs here on GitHub (preferred) or on the forums.
|
||||
|
||||
### Bugs in User-Made Content
|
||||
|
||||
If you encounter an engine bug such as a crash, scripting error, etc., report it here. Otherwise, issues with user-made content should be reported to their respective creators on the forums. You can usually find a thread for the add-on in question in the [Scenario & Campaign Development](http://www.wesnoth.org/forum/viewforum.php?f=8), [Faction & Era Development](http://www.wesnoth.org/forum/viewforum.php?f=19) or [Multiplayer Development](http://www.wesnoth.org/forum/viewforum.php?f=15) sections.
|
||||
|
||||
### Feature Requests
|
||||
|
||||
We accept suggestions for campaign improvements, WML or Lua API changes, and other game enhancements here on GitHub. We encourage you to attempt to implement your idea yourself and submit a pull request containing relevant information to your feature.
|
||||
|
||||
### Information to Include
|
||||
|
||||
We have several issue templates to choose from when opening a bug report. Please choose the one that best fits the bug. You do not need to include everything (we don't need screenshots for a compiling issue, for example), but the more information you can provide, the better. We need at least enough information to replicate the bug before we can track down the root cause.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Pull requests (PRs) can be created by forking the [wesnoth/wesnoth](https://github.com/wesnoth/wesnoth) repository on the github website, making your own changes to your forked repository, and then clicking the "Pull request" button. All pull requests must follow the above guidelines in order to be merged and whenever possible should include additional unit tests in order to both prove the proposed fix or feature works as intended as well as to allow quickly detecting other bugs in that area of code the future. WML and lua tests are run with the `run_wml_tests` python script (the tests themselves can be found [here](https://github.com/wesnoth/wesnoth/tree/master/data/test/test)) and C++ unit tests are run by the `boost_unit_tests` executable (current tests can be found [here](https://github.com/wesnoth/wesnoth/tree/master/src/tests)). Additionally, no new code can contain use of deprecated WML or lua API features.
|
||||
|
||||
It is also highly recommended to use an editor that at least support syntax highlighting (such as VSCode or Notepad++) regardless of what you're changing - just because you *can* edit files through the github website or with plain Notepad does not mean you *should*.
|
266
INSTALL
Normal file
|
@ -0,0 +1,266 @@
|
|||
Contents
|
||||
========
|
||||
|
||||
1. Prerequisites
|
||||
2. Build Environment
|
||||
3. SCons Build
|
||||
4. CMake Build
|
||||
5. Build Options
|
||||
|
||||
|
||||
1. Prerequisites
|
||||
================
|
||||
|
||||
Wesnoth requires a compiler with sufficient C++11 support such as GCC 4.8 and
|
||||
later, or Clang 3.3 and later.
|
||||
|
||||
You'll need to have these libraries and their development headers installed in
|
||||
order to build Wesnoth:
|
||||
|
||||
* Boost libraries:
|
||||
* Filesystem >= 1.44.0
|
||||
* Locale >= 1.48.0
|
||||
* Iostreams >= 1.36.0
|
||||
* Multi-index >= 1.36.0 (header only)
|
||||
* Random >= 1.48.0
|
||||
* Regex >= 1.36.0
|
||||
* Serialization >= 1.36.0 (header only)
|
||||
* Asio >= 1.36.0 (header only)
|
||||
* Program Options >= 1.36.0
|
||||
* System >= 1.36.0
|
||||
* SDL2 libraries:
|
||||
* SDL2 >= 2.0.2 (2.0.4 on Windows and OS X)
|
||||
* SDL2_image >= 2.0.0 (with PNG and JPEG support)
|
||||
* SDL2_mixer >= 2.0.0 (with Ogg Vorbis support)
|
||||
* SDL2_ttf >= 2.0.12
|
||||
* SDL2_net >= 2.0.0
|
||||
* Fontconfig >= 2.4.1
|
||||
* Pango >= 1.21.3 (with Cairo backend)
|
||||
* Vorbisfile
|
||||
* libbz2
|
||||
* libz
|
||||
|
||||
The following libraries are optional dependencies that enable additional
|
||||
features:
|
||||
|
||||
* libpng:
|
||||
PNG screenshots, otherwise only BMP is supported.
|
||||
|
||||
* D-Bus (libdbus-1):
|
||||
Desktop notifications on Linux, *BSD, etc.
|
||||
|
||||
* GNU history (libreadline):
|
||||
Command history and history expansion in the built-in Lua console.
|
||||
|
||||
* FriBiDi >= 0.10.9:
|
||||
Bidirectional text support for RTL languages (Hebrew, etc.) in some parts
|
||||
of the user interface.
|
||||
|
||||
Note that although different Boost version requirements are listed, individual
|
||||
libraries from different releases are generally incompatible with each other
|
||||
and you should not mix and match.
|
||||
|
||||
Although not recommended, you may use libintl on platforms other than Windows
|
||||
instead of Boost.Locale. For scons, set the `libintl` option to `true`.
|
||||
|
||||
|
||||
2. Build Environment
|
||||
====================
|
||||
|
||||
You can obtain the source code tarball for the latest version from
|
||||
<http://www.wesnoth.org/downloads>.
|
||||
|
||||
Before building, make sure to untar the package and change into the newly
|
||||
created directory:
|
||||
|
||||
$ tar xvjf wesnoth-<version>.tar.bz2
|
||||
$ cd wesnoth-<version>
|
||||
|
||||
Or:
|
||||
|
||||
$ tar xvzf wesnoth-<version>.tar.gz
|
||||
$ cd wesnoth-<version>
|
||||
|
||||
The following build systems are fully supported for compiling Wesnoth on Linux,
|
||||
*BSD, and other Unix-like platforms:
|
||||
|
||||
* SCons >= 0.98.3
|
||||
* CMake >= 2.6.0
|
||||
|
||||
You will also need to have a working installation of GNU gettext to build the
|
||||
translations.
|
||||
|
||||
While Wesnoth may be easily installed system-wide using SCons or CMake, it is
|
||||
also possible to run it directly from the source directory after building. This
|
||||
may be useful in situations where you don't have root access or need to
|
||||
rebuild Wesnoth frequently (i.e. for development and testing).
|
||||
|
||||
|
||||
3. SCons Build
|
||||
==============
|
||||
|
||||
Unlike CMake or the classic "autotools" build-system (configure && make),
|
||||
configuration and building are done in the same step with SCons.
|
||||
|
||||
Simply type `scons` in the top-level directory to build the game client and
|
||||
MP server:
|
||||
|
||||
$ scons
|
||||
|
||||
It is possible to select individual targets to build by naming them in the
|
||||
command line separated by spaces.
|
||||
|
||||
To build the game client only:
|
||||
|
||||
$ scons wesnoth
|
||||
|
||||
Building the MP server only:
|
||||
|
||||
$ scons wesnothd
|
||||
|
||||
The `install` target will install any binaries that were previously compiled
|
||||
(use su or sudo if necessary to write files into the installation prefix):
|
||||
|
||||
# scons install
|
||||
|
||||
SCons takes a `prefix=` argument that specifies where to install the game and
|
||||
its resource files. The prefix defaults to `/usr/local`; for production builds,
|
||||
you may wish to use `/usr` instead:
|
||||
|
||||
$ scons prefix=/usr
|
||||
|
||||
|
||||
4. CMake Build
|
||||
==============
|
||||
|
||||
Unlike SCons, CMake has separate configuration and build steps. Configuration
|
||||
is done using CMake itself, and the actual build is done using `make`.
|
||||
|
||||
There are two ways to build Wesnoth with CMake: inside the source tree or
|
||||
outside of it. Out-of-source builds have the advantage that you can have
|
||||
multiple builds with different options from one source directory.
|
||||
|
||||
To build Wesnoth out of source:
|
||||
|
||||
$ mkdir build && cd build
|
||||
$ cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
$ make
|
||||
|
||||
To build Wesnoth in the source directory:
|
||||
|
||||
$ cmake . -DCMAKE_BUILD_TYPE=Release
|
||||
$ make
|
||||
|
||||
To install Wesnoth after building (as root using su or sudo if necessary):
|
||||
|
||||
# make install
|
||||
|
||||
To change build options, you can either pass the options on the command line:
|
||||
|
||||
$ cmake .. -DOPTION_NAME=option_value
|
||||
|
||||
Or use either the `ccmake` or `cmake-gui` front-ends, which display all options
|
||||
and their cached values on a console and graphical UI, respectively.
|
||||
|
||||
$ ccmake ..
|
||||
$ cmake-gui ..
|
||||
|
||||
|
||||
5. Build Options
|
||||
================
|
||||
|
||||
A full list of options supported by SCons along with their descriptions and
|
||||
defaults is available by running `scons --help` from the Wesnoth source. For
|
||||
CMake, you may either run the `ccmake` or `cmake-gui` front-ends, or run
|
||||
`cmake` and open the generated CMakeCache.txt from the build directory in a
|
||||
text editor.
|
||||
|
||||
$ scons option_name1=option_value1 [option_name2=option_value2 [...]]
|
||||
$ cmake -DOPTION_NAME1=option_value1 [-DOPTION_NAME2=option_value2 [...]]
|
||||
|
||||
With SCons, boolean options take `yes` or `true` for a true value, and `no` or
|
||||
`false` for a false value. CMake uses `ON` for a true value, and `OFF` for a
|
||||
false value.
|
||||
|
||||
Some of the most important options follow.
|
||||
|
||||
* build=<build type> (SCons)
|
||||
CMAKE_BUILD_TYPE=<build type> (CMake)
|
||||
|
||||
Selects a specific build configuration when compiling. `release` produces
|
||||
the default, optimized (-O2) build for regular use. `debug` produces a
|
||||
slower and larger unoptimized (-O0) build with full debug symbols, which is
|
||||
often needed for obtaining detailed backtraces when reporting bugs.
|
||||
|
||||
NOTE: By default, CMake will produce `debug` builds unless a different
|
||||
configuration option is passed in the command line.
|
||||
|
||||
* ENABLE_GAME=<boolean> (CMake)
|
||||
|
||||
Whether to build the game client binary. Use command line target selection
|
||||
selection with SCons instead.
|
||||
|
||||
* ENABLE_SERVER=<boolean> (CMake)
|
||||
|
||||
Whether to build the MP server binary. Use command line target selection
|
||||
selection with SCons instead.
|
||||
|
||||
* prefix=<full path> (SCons)
|
||||
CMAKE_INSTALL_PREFIX=<full path> (CMake)
|
||||
|
||||
Installation prefix for binaries, resources, and documentation files.
|
||||
|
||||
* nls=<boolean> (SCons)
|
||||
ENABLE_NLS=<boolean> (CMake)
|
||||
|
||||
Whether to compile and install translations.
|
||||
|
||||
* strict=<boolean> (SCons)
|
||||
ENABLE_STRICT_COMPILATION=<boolean> (CMake)
|
||||
|
||||
Whether to treat compiler warnings as errors or not. Primarily intended for
|
||||
developers.
|
||||
|
||||
* prefsdir=<directory name> (SCons)
|
||||
PREFERENCES_DIR=<directory name> (CMake)
|
||||
|
||||
Hardcoded user preferences and user data directory. The default is to leave
|
||||
this unspecified so that Wesnoth will use separate XDG paths such as
|
||||
.config/wesnoth and .local/share/wesnoth/<version> for its user preferences
|
||||
and data, respectively.
|
||||
|
||||
* cxxtool=<program> (SCons)
|
||||
CMAKE_CXX_COMPILER=<program> (CMake)
|
||||
|
||||
Specifies which C++ compiler to use. By default, the system's default C++
|
||||
compiler will be automatically selected during configuration.
|
||||
|
||||
* ccache=<boolean> (SCons)
|
||||
|
||||
Whether to run the compiler through ccache first. Useful if the compiler
|
||||
executable is not a symbolic link to ccache. Requires ccache to be
|
||||
installed first.
|
||||
|
||||
If using CMake, use CMAKE_CXX_COMPILER instead.
|
||||
|
||||
* extra_flags_<buildtype>=<flags> (SCons)
|
||||
extra_flags_config=<flags> (SCons)
|
||||
CXX_FLAGS_USER=<flags> (CMake)
|
||||
|
||||
Additional compiler flags to use when compiling a specific build type
|
||||
(SCons-only). To apply the same flags to all builds, use extra_flags_config
|
||||
(SCons) or CXX_FLAGS_USER (CMake) without a build type suffix.
|
||||
|
||||
Alternatively, you may specify your flags in the CXXFLAGS environment
|
||||
variable.
|
||||
|
||||
* fifodir=<full path> (SCons)
|
||||
FIFO_DIR=<full path> (CMake)
|
||||
|
||||
server_uid=<UID> server_gid=<GID> (SCons)
|
||||
SERVER_UID=<UID> SERVER_GID=<GID> (CMake)
|
||||
|
||||
Directory and owner id for the wesnothd control FIFO file. This is relevant
|
||||
only if you wish to be able to communicate with a local wesnothd instance
|
||||
through a named pipe. You must run wesnothd with the same UID specified at
|
||||
build time for this to work.
|
182
INSTALL.md
|
@ -1,182 +0,0 @@
|
|||
# Building Wesnoth from Source
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Wesnoth requires a compiler with sufficient C++17 support such as GCC 11 and
|
||||
later, or a version of Clang with equivalent support.
|
||||
|
||||
You'll need to have these libraries and their development headers installed in
|
||||
order to build Wesnoth:
|
||||
|
||||
* Boost libraries >= 1.66.0
|
||||
Most headers plus the following binary libs:
|
||||
* Filesystem
|
||||
* Locale
|
||||
* Iostreams
|
||||
* Random
|
||||
* Regex
|
||||
* Program Options
|
||||
* System
|
||||
* Coroutine
|
||||
* Graph
|
||||
* Charconv (This requires boost 1.85 or higher and is optional but reccomended especially for clang builds)
|
||||
* SDL2 libraries:
|
||||
* SDL2 >= 2.0.18 (macOS: 2.0.22 due to needing https://github.com/libsdl-org/SDL/commit/3bebdaccb7bff8c40438856081d404a7ce3def30)
|
||||
* SDL2_image >= 2.0.2 (with PNG, JPEG, and WEBP support)
|
||||
* SDL2_mixer >= 2.0.0 (with Ogg Vorbis support)
|
||||
* Fontconfig >= 2.4.1
|
||||
* Cairo >= 1.10.0
|
||||
* Pango >= 1.44.0 (with Cairo backend)
|
||||
* Vorbisfile aka libvorbis
|
||||
* libbz2
|
||||
* libz
|
||||
* libssl
|
||||
* libcrypto (from OpenSSL)
|
||||
* libcurl4 (OpenSSL version)
|
||||
|
||||
The following libraries are optional dependencies that enable additional
|
||||
features:
|
||||
|
||||
* D-Bus (libdbus-1):
|
||||
Desktop notifications on Linux, *BSD, etc.
|
||||
|
||||
* GNU history (libreadline):
|
||||
Command history and history expansion in the built-in Lua console.
|
||||
|
||||
|
||||
## Build Environment
|
||||
|
||||
You can obtain the source code tarball for the latest version from
|
||||
<https://www.wesnoth.org/downloads>.
|
||||
|
||||
Before building, make sure to untar the package and change into the newly
|
||||
created directory:
|
||||
|
||||
$ tar xvjf wesnoth-<version>.tar.bz2
|
||||
$ cd wesnoth-<version>
|
||||
|
||||
Alternatively, you can clone this git repository. Since Wesnoth uses submodules, when cloning you must add the `--recurse-submodules` option, or if you have already cloned the repository without using that option then you must run the command `git submodule update --init --recursive`.
|
||||
|
||||
The following build systems are fully supported for compiling Wesnoth on Linux,
|
||||
*BSD, and other Unix-like platforms:
|
||||
|
||||
* SCons >= 0.98.3
|
||||
* CMake >= 3.14
|
||||
|
||||
You will also need to have a working installation of GNU gettext to build the
|
||||
translations.
|
||||
|
||||
While Wesnoth may be easily installed system-wide using SCons or CMake, it is
|
||||
also possible to run it directly from the source directory after building. This
|
||||
may be useful in situations where you don't have root access or need to
|
||||
rebuild Wesnoth frequently (i.e. for development and testing).
|
||||
|
||||
### macOS/OS X
|
||||
See [here](https://github.com/wesnoth/wesnoth/blob/master/projectfiles/Xcode/README.md) for instructions on using Xcode.
|
||||
|
||||
### Windows
|
||||
Wesnoth uses CMake for project configuration and vcpkg for installing dependencies. See [here](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio) for information on using Visual Studio with cmake. The first time it's run, vcpkg will build all the required dependencies which may take over an hour, however it will only need to be done once.
|
||||
|
||||
NOTE 1: You will need to run `vcpkg integrate install` on the command line to make Visual Studio aware of vcpkg. If Visual Studio is open when this is executed, then you will need to close and re-open Visual Studio.
|
||||
|
||||
## SCons Build
|
||||
|
||||
Unlike CMake or the classic "autotools" build-system (configure && make),
|
||||
configuration and building are done in the same step with SCons.
|
||||
|
||||
Simply type `scons` in the top-level directory to build the game client and
|
||||
MP server:
|
||||
|
||||
$ scons
|
||||
|
||||
It is possible to select individual targets to build by naming them in the
|
||||
command line separated by spaces.
|
||||
|
||||
To build the game client only:
|
||||
|
||||
$ scons wesnoth
|
||||
|
||||
Building the MP server only:
|
||||
|
||||
$ scons wesnothd
|
||||
|
||||
The `install` target will install any binaries that were previously compiled
|
||||
(use su or sudo if necessary to write files into the installation prefix):
|
||||
|
||||
$ scons install
|
||||
|
||||
SCons takes a `prefix=` argument that specifies where to install the game and
|
||||
its resource files. The prefix defaults to `/usr/local`; for production builds,
|
||||
you may wish to use `/usr` instead:
|
||||
|
||||
$ scons prefix=/usr
|
||||
|
||||
|
||||
## CMake Build
|
||||
|
||||
Unlike SCons, CMake has separate configuration and build steps. Configuration
|
||||
is done using CMake itself, and the actual build is done using `make`.
|
||||
|
||||
There are two ways to build Wesnoth with CMake: inside the source tree or
|
||||
outside of it. Out-of-source builds have the advantage that you can have
|
||||
multiple builds with different options from one source directory.
|
||||
|
||||
To build Wesnoth out of source:
|
||||
|
||||
$ mkdir build && cd build
|
||||
$ cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
$ make
|
||||
|
||||
To build Wesnoth in the source directory:
|
||||
|
||||
$ cmake . -DCMAKE_BUILD_TYPE=Release
|
||||
$ make
|
||||
|
||||
To install Wesnoth after building (as root using su or sudo if necessary):
|
||||
|
||||
# make install
|
||||
|
||||
To change build options, you can either pass the options on the command line:
|
||||
|
||||
$ cmake .. -DOPTION_NAME=option_value
|
||||
|
||||
Or use either the `ccmake` or `cmake-gui` front-ends, which display all options
|
||||
and their cached values on a console and graphical UI, respectively.
|
||||
|
||||
$ ccmake ..
|
||||
$ cmake-gui ..
|
||||
|
||||
|
||||
## Build Options
|
||||
|
||||
A full list of options supported by SCons along with their descriptions and
|
||||
defaults is available by running `scons --help` from the Wesnoth source. For
|
||||
CMake, you may either run the `ccmake` or `cmake-gui` front-ends, or run
|
||||
`cmake` and open the generated CMakeCache.txt from the build directory in a
|
||||
text editor.
|
||||
|
||||
$ scons option_name1=option_value1 [option_name2=option_value2 [...]]
|
||||
$ cmake -DOPTION_NAME1=option_value1 [-DOPTION_NAME2=option_value2 [...]]
|
||||
|
||||
With SCons, boolean options take `yes` or `true` for a true value, and `no` or
|
||||
`false` for a false value. CMake uses `ON` for a true value, and `OFF` for a
|
||||
false value.
|
||||
|
||||
### Some of the most important options follow.
|
||||
|
||||
| SCons | CMake | Description |
|
||||
|------------------------------------------------------------------------|--------------------------------------------------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `build=<build type>` | `CMAKE_BUILD_TYPE=<build type>` | Selects a specific build configuration when compiling. `release` produces the default, optimized (-O3) build for regular use. `debug` produces a slower and larger unoptimized (-O0) build with full debug symbols, which is often needed for obtaining detailed backtraces when reporting bugs. |
|
||||
| `wesnoth` | `ENABLE_GAME=<boolean>` | Whether to build the game client binary. To disable just don't mention the target for SCons. |
|
||||
| `wesnothd` | `ENABLE_SERVER=<boolean>` | Whether to build the MP server binary. To disable just don't mention the target for SCons. |
|
||||
| `prefix=<full path>` | `CMAKE_INSTALL_PREFIX=<full path>` | Installation prefix for binaries, resources, and documentation files. |
|
||||
| `nls=<boolean>` | `ENABLE_NLS=<boolean>` | Whether to compile and install translations. |
|
||||
| `strict=<boolean>` | `ENABLE_STRICT_COMPILATION=<boolean>` | Whether to treat compiler warnings as errors or not. Primarily intended for developers. |
|
||||
| `prefsdir=<directory name>` | `PREFERENCES_DIR=<directory name>` | Hardcoded user preferences and user data directory. The default is to leave this unspecified so that Wesnoth will use separate XDG paths such as .config/wesnoth and .local/share/wesnoth/<version> for its user preferences and data, respectively. |
|
||||
| `cxxtool=<program>` | `CMAKE_CXX_COMPILER=<program>` | Specifies which C++ compiler to use. By default, the system's default C++ compiler will be automatically selected during configuration. |
|
||||
| `ccache=<boolean>` | `CMAKE_CXX_COMPILER_LAUNCHER=ccache` | Whether to run the compiler through ccache first. Useful if the compiler executable is not a symbolic link to ccache. Requires ccache to be installed first. If using CMake, use CMAKE_C_COMPILER and CMAKE_CXX_COMPILER instead. |
|
||||
| `extra_flags_<buildtype>=<flags>` `extra_flags_config=<flags>` | `CXX_FLAGS_USER=<flags>` | Additional compiler flags to use when compiling a specific build type (SCons-only). To apply the same flags to all builds, use extra_flags_config (SCons) or CXX_FLAGS_USER (CMake) without a build type suffix. Alternatively, you may specify your flags in the CXXFLAGS environment variable. |
|
||||
| `fifodir=<full path>` `server_uid=<UID>` `server_gid=<GID>` | `FIFO_DIR=<full path>` `SERVER_UID=<UID>` `SERVER_GID=<GID>` | Directory and owner id for the wesnothd control FIFO file. This is relevant only if you wish to be able to communicate with a local wesnothd instance through a named pipe. You must run wesnothd with the same UID specified at build time for this to work. |
|
||||
| `enable_lto=<boolean>` | `ENABLE_LTO=<boolean>` | Controls using Link Time Optimization. Enabling will result in a smaller, faster executable at the cost of increased time to compile and link. For cmake, use LTO_JOBS=N tells how many threads to use during linking. |
|
||||
| `--debug=time` | `VERBOSE=1` (make option) | Enables some additional output while building. |
|
||||
| `jobs=N` | `-jN` (make option) | Enables compiling with multiple threads, where N is the number of threads to use. |
|
28
NaCl-LICENSE
Normal file
|
@ -0,0 +1,28 @@
|
|||
Copyright 2008, Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
118
README.md
|
@ -1,109 +1,47 @@
|
|||
[](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
||||
|
||||
|Branch|CI status|
|
||||
|------|---------|
|
||||
|Master|[](https://github.com/wesnoth/wesnoth/actions/workflows/ci-main.yml?query=branch%3Amaster)|
|
||||
|1.18|[](https://github.com/wesnoth/wesnoth/actions/workflows/ci-main.yml?query=branch%3A1.18)|
|
||||
|
||||
About
|
||||
=====
|
||||
|
||||
**The Battle for Wesnoth** is an Open Source, turn-based tactical strategy game with a high fantasy theme, featuring both singleplayer and online/hotseat multiplayer combat. Fight a desperate battle to reclaim the throne of Wesnoth, search for the key to immortality, or take part in any number of other adventures.
|
||||
|
||||
Community
|
||||
---------
|
||||
|
||||
The official Battle for Wesnoth Forums:
|
||||
<https://forums.wesnoth.org/>
|
||||
|
||||
Discord:
|
||||
<https://discord.gg/battleforwesnoth>
|
||||
|
||||
IRC:
|
||||
<https://wiki.wesnoth.org/Support#IRC>
|
||||
|
||||
Mastodon:
|
||||
<https://fosstodon.org/@wesnoth>
|
||||
|
||||
Steam forums:
|
||||
<https://steamcommunity.com/app/599390/discussions/>
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* A variety of different campaigns, each with their own tactical challenges, emotionally charged story, and multiple difficulty levels.
|
||||
* A detailed world and storytelling with hundreds of sprites, animations, and characters.
|
||||
* Many different unit skills and traits across several factions.
|
||||
* A map editor with multiple tools, hundreds types of terrain, and the ability for you to save and share maps with others. Create your own scenarios/battles for near infinite replayability.
|
||||
* Highly moddable, allowing a wide array of community created map packs, eras, and entire campaigns.
|
||||
* Online and local multiplayer gameplay to play with friends, strangers, or against the AI.
|
||||
* Changeable settings for base gameplay, with nearly limitless options for different hotkey configurations.
|
||||
* Beautifully composed playlist that captures the era and grandiosity of this lore-filled high-fantasy world.
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Wesnoth can be played on Windows, macOS, and Linux, and can be installed using:
|
||||
* [Steam](https://store.steampowered.com/app/599390/Battle_for_Wesnoth/) (all)
|
||||
* [itch.io](https://wesnoth.itch.io/battle-for-wesnoth) (Windows and macOS)
|
||||
* The [macOS App Store](https://apps.apple.com/us/app/the-battle-for-wesnoth/id1450738104)
|
||||
* standalone installers on [SourceForge](https://sourceforge.net/projects/wesnoth/files/) (Windows and macOS)
|
||||
* [Flatpak](https://flathub.org/apps/details/org.wesnoth.Wesnoth) (Linux)
|
||||
|
||||
Additionally, Wesnoth is available for [iOS](https://apps.apple.com/us/app/battle-for-wesnoth/id575852062) and [Android](https://sourceforge.net/projects/wesnoth-on-android/files/).
|
||||
|
||||
To build the game from source, see [INSTALL](/INSTALL.md) for instructions.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Wesnoth is most in need of skilled C++ developers (C++14 and later), however there are things that nearly anyone can help with:
|
||||
* Simple tasks in C++.
|
||||
* The Lua and WML used for content scripting.
|
||||
* Python used by various external tools.
|
||||
* Even play testing and giving feedback on updated campaigns!
|
||||
|
||||
Additionally, Wesnoth lacks art for a variety of unit animations - anyone who would be interested in lending a hand in updating existing unit sprites or creating animations should take a look at the [Art Contributions](https://forums.wesnoth.org/viewforum.php?f=9) forum as well as contact our current art director.
|
||||
|
||||
See also: [CONTRIBUTING](/CONTRIBUTING.md)
|
||||
|
||||
For any questions, the best place to start is to simply join Wesnoth's forums, Discord, or IRC and start asking!
|
||||
|
||||
|
||||
Donations
|
||||
---------
|
||||
|
||||
Donations can be sent via [Software in the Public Interest](https://www.spi-inc.org/projects/wesnoth/), [Liberapay](https://liberapay.com/Wesnoth), as well as when downloading through itch.io. All money donated is used to pay for project expenses such as server rent and art commissions, and is very much appreciated.
|
||||
**The Battle for Wesnoth** is a Free, turn-based tactical strategy game with a
|
||||
high fantasy theme, featuring both singleplayer and online/hotseat multiplayer
|
||||
combat. Fight a desperate battle to reclaim the throne of Wesnoth, or take
|
||||
hand in any number of other adventures.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
All source code is licensed under the GNU GPL v2+. Most art and music is also licensed under the GNU GPL v2+, however new contributions are now licensed under the Creative Commons BY-SA v4.0. For more detailed information on Wesnoth's licensing, see the wiki:
|
||||
The game's source code and artwork, sound, and music assets are provided under
|
||||
the terms of the GNU General Public License version 2, or (at your option) any
|
||||
later version. Note that for artwork, sound, and music, we interpret
|
||||
"preferred form of the work for making modifications" as the modifiable form
|
||||
that the author chooses to ship us for the source tree. For convenience, a
|
||||
reference copy of the GNU GPL version 2 is provided in the COPYING file in
|
||||
this distribution.
|
||||
|
||||
<https://wiki.wesnoth.org/Wesnoth:Copyrights>
|
||||
Some portions of the source code can be used under different license terms,
|
||||
whenever stated as such in the source.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
See INSTALL for instructions on how to build the game from source code.
|
||||
|
||||
|
||||
More Information
|
||||
----------------
|
||||
|
||||
For extensive documentation about all aspects of the game, see the official Battle for Wesnoth web site:
|
||||
For extensive documentation about all aspects of the game, see the
|
||||
official Battle for Wesnoth web site.
|
||||
|
||||
<https://www.wesnoth.org/>
|
||||
<https://wiki.wesnoth.org/>
|
||||
<http://www.wesnoth.org/>
|
||||
|
||||
A (translated) description of how to play the game can be found in doc/manual/manual.*.html, or online at:
|
||||
A (translated) description of how to play the game can be found in
|
||||
doc/manual/manual.*.html, or online at:
|
||||
|
||||
<https://wiki.wesnoth.org/WesnothManual>
|
||||
<http://manual.wesnoth.org/>
|
||||
|
||||
For information on creating your own maps, scenarios, and other content, see:
|
||||
The official Battle for Wesnoth Forums (with over 400,000 posts from more than
|
||||
20,000 registered members) can be found at:
|
||||
|
||||
<https://wiki.wesnoth.org/Create>
|
||||
|
||||
Gallery
|
||||
-------
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
<http://forums.wesnoth.org/>
|
||||
|
|
71
RELEASE_NOTES
Normal file
|
@ -0,0 +1,71 @@
|
|||
This file is here to allow devs to easily add stuff in the release notes for the next release, it allows easy syncing with the release team, since you don't have to be around when the release takes place...
|
||||
|
||||
Just dump whatever you want to have mentioned in the release notes here. Please take care that it is in a way that allows copy&paste to the release notes. That is making sure that spelling/grammar/whatever is usable and that you are using complete sentences, not just single words. Please do use forum syntax and do *NOT* split lines after 80 chars!
|
||||
|
||||
Stuff that belongs in here:
|
||||
* groundbreaking changes (new campaigns, extremely new feature, ...)
|
||||
* changed dependencies (new things, version bumps, stuff that was removed)
|
||||
* known bugs
|
||||
|
||||
The release team should empty this file after each release.
|
||||
|
||||
|
||||
=======
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
[rasection="Example section title"]
|
||||
Example contents.
|
||||
[/rasection]
|
||||
|
||||
|
||||
[rasection="Additions and changes to the AI"]
|
||||
[list]
|
||||
[*]A new candidate action (CA), called [wiki=RCA_AI#The_Candidate_Actions_.28CAs.29_of_the_main_loop_Stage_in_the_RCA_AI]high XP attack[/wiki], has been added to all general Wesnoth AIs in mainline, fixing a short-coming in the default AI's combat CA. Previously, the AI would only attack units 1 experience point (XP) from leveling under very specific and rarely occurring circumstances. It was possible to exploit this, for example, for blocking vital passages or keeping key units alive without these units ever being attacked, making scenarios much easier than they were intended.
|
||||
|
||||
The new CA fixes this hole and will generally, but not blindly, attack such units now. The attack logic is explained [url=https://github.com/wesnoth/wesnoth/blob/master/data/ai/lua/ca_high_xp_attack.lua#L5]here[/url]. Since the new behavior is accomplished not by changing the existing attack code, but by adding a new candidate action, the previous behavior can be restored by removing the high_xp_attack CA, in case this is desired in specific scenarios.
|
||||
[*]For content creators, a [wiki=Micro_AIs#Assassin_Squad_Micro_AI_.28ai_type.3Dassassin.29]new Micro AI[/wiki], controlling individual assassins or an entire assassin squad has been added. It is already being used in Heir to the Throne scenario 8, 'The Princess of Wesnoth'.
|
||||
[*]A long standing bug which caused units with zero maximum moves not to attack adjacent enemies under certain circumstances has been fixed. This also (sometimes) affected units which could not move due to other circumstances (such as terrain).
|
||||
[*]Two instances of the AI ignoring the [disable] weapon special have been fixed.
|
||||
[/list]
|
||||
[/rasection]
|
||||
|
||||
|
||||
==========
|
||||
KNOWN BUGS
|
||||
==========
|
||||
|
||||
[raissue="Newly introduced in 1.13.x"]
|
||||
[b]General bugs:[/b]
|
||||
|
||||
[list]
|
||||
[*]Crashes may occur during the loading screen. If those crashes happen to you, you can disable the loading screen animation by addding disable_loading screen_animation=yes in your preferences file.
|
||||
[*]The MP server has trouble with Local player types in campaigns (bug [bug]21965[/bug]). We have decided to postpone dealing with this. In the meantime, you might try assigning such sides to the host, or running multiple instances of Wesnoth.
|
||||
[*]Wesnoth does not exist on the panel (bug [bug]24202[/bug]).
|
||||
[*]"Name of Game" bleeds onto "Player/Type" label when leaving/entering the app (bug [bug]24437[/bug]).
|
||||
[*]Inconsistent transparency on credits screen (bug [bug]24428[/bug]).
|
||||
[*]Dialog In Replay Clearing Issue (bug [bug]24491[/bug]).
|
||||
[/list]
|
||||
[/raissue]
|
||||
|
||||
[raissue="Carried over from 1.12.x"]
|
||||
[b]General bugs:[/b]
|
||||
|
||||
[list]
|
||||
[*]The game can crash when planning recruits in Planning Mode.
|
||||
[/list]
|
||||
|
||||
[b]Bugs specific to Microsoft Windows:[/b]
|
||||
|
||||
[list]
|
||||
[*]ClearType font rendering is disabled as it causes glitches (bug [bug]21648[/bug]).
|
||||
This is likely caused by outdated libraries in the packaging process.
|
||||
[/list]
|
||||
|
||||
[b]Bugs specific to macOS:[/b]
|
||||
|
||||
[list]
|
||||
[*]Trackpad tap clicking is sometimes not recognized ([url=http://forums.wesnoth.org/viewtopic.php?f=4&t=39788]forum post[/url]).
|
||||
[*]Unofficial builds with OpenMP support enabled randomly freeze (bug [bug]18144[/bug]).
|
||||
[/list]
|
||||
[/raissue]
|
612
SConstruct
|
@ -9,18 +9,16 @@
|
|||
|
||||
EnsureSConsVersion(0,98,3)
|
||||
|
||||
lua_ver = "5.4"
|
||||
|
||||
import os, sys, shutil, re, subprocess
|
||||
import os, sys, shutil, re, commands
|
||||
from glob import glob
|
||||
from subprocess import Popen, PIPE, call, check_output
|
||||
from subprocess import Popen, PIPE, call
|
||||
from os import access, F_OK
|
||||
|
||||
# Warn user of current set of build options.
|
||||
AddOption('--option-cache', dest='option_cache', nargs=1, type = 'string', action = 'store', metavar = 'FILE', help='file with cached construction variables', default = '.scons-option-cache')
|
||||
if GetOption("option_cache") != "" and os.path.exists(GetOption("option_cache")):
|
||||
optfile = open(GetOption("option_cache"))
|
||||
print("Saved options: {}".format(optfile.read().replace("\n", ", ")[:-2]))
|
||||
if os.path.exists(GetOption("option_cache")):
|
||||
optfile = file(GetOption("option_cache"))
|
||||
print "Saved options:", optfile.read().replace("\n", ", ")[:-2]
|
||||
optfile.close()
|
||||
|
||||
#
|
||||
|
@ -28,12 +26,12 @@ if GetOption("option_cache") != "" and os.path.exists(GetOption("option_cache"))
|
|||
#
|
||||
|
||||
config_h_re = re.compile(r"^.*#define\s*(\S*)\s*\"(\S*)\".*$", re.MULTILINE)
|
||||
build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents().decode("utf-8")) )
|
||||
build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents()) )
|
||||
try:
|
||||
version = build_config["VERSION"]
|
||||
print("Building Wesnoth version %s" % version)
|
||||
print "Building Wesnoth version %s" % version
|
||||
except KeyError:
|
||||
print("Couldn't determine the Wesnoth version number, bailing out!")
|
||||
print "Couldn't determine the Wesnoth version number, bailing out!"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
|
@ -48,41 +46,35 @@ def OptionalPath(key, val, env):
|
|||
|
||||
opts.AddVariables(
|
||||
ListVariable('default_targets', 'Targets that will be built if no target is specified in command line.',
|
||||
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd boost_unit_tests")),
|
||||
EnumVariable('build', 'Build variant: release, debug, or profile', "release", ["release", "debug"]),
|
||||
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd cutter exploder test")),
|
||||
EnumVariable('build', 'Build variant: debug, release profile or base (no subdirectory)', "release", ["release", "debug", "glibcxx_debug", "profile","base"]),
|
||||
PathVariable('build_dir', 'Build all intermediate files(objects, test programs, etc) under this dir', "build", PathVariable.PathAccept),
|
||||
('extra_flags_config', "Extra compiler and linker flags to use for configuration and all builds. Whether they're compiler or linker is determined by env.ParseFlags. Unknown flags are compile flags by default. This applies to all extra_flags_* variables", ""),
|
||||
('extra_flags_base', 'Extra compiler and linker flags to use for release builds', ""),
|
||||
('extra_flags_release', 'Extra compiler and linker flags to use for release builds', ""),
|
||||
('extra_flags_debug', 'Extra compiler and linker flags to use for debug builds', ""),
|
||||
('extra_flags_profile', 'Extra compiler and linker flags to use for profile builds', ""),
|
||||
BoolVariable('enable_lto', 'Whether to enable Link Time Optimization for build=release', False),
|
||||
('arch', 'What -march option to use for build=release, will default to pentiumpro on Windows', ""),
|
||||
('opt', 'override for the build\'s optimization level', ""),
|
||||
BoolVariable('harden', 'Whether to enable options to harden the executables', True),
|
||||
BoolVariable('glibcxx_assertions', 'Whether to define _GLIBCXX_ASSERTIONS for build=debug', False),
|
||||
BoolVariable('glibcxx_debug', "Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC for build=debug. Requires a version of Boost's program_options that's compiled with __GLIBCXX_DEBUG too.", False),
|
||||
EnumVariable('profiler', 'profiler to be used', "", ["", "gprof", "gcov", "gperftools", "perf"]),
|
||||
EnumVariable('pgo_data', 'whether to generate profiling data for PGO, or use existing profiling data', "", ["", "generate", "use"]),
|
||||
BoolVariable('use_srcdir', 'Whether to place object files in src/ or not', False),
|
||||
PathVariable('bindir', 'Where to install binaries', "bin", PathVariable.PathAccept),
|
||||
('cachedir', 'Directory that contains a cache of derived files.', ''),
|
||||
PathVariable('datadir', 'read-only architecture-independent game data', "$datarootdir/$datadirname", PathVariable.PathAccept),
|
||||
PathVariable('fifodir', 'directory for the wesnothd fifo socket file', "/var/run/wesnothd", PathVariable.PathAccept),
|
||||
BoolVariable('fribidi','Clear to disable bidirectional-language support', True),
|
||||
BoolVariable('desktop_entry','Clear to disable desktop-entry', True),
|
||||
BoolVariable('appdata_file','Clear to not install appdata file', True),
|
||||
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemctl"))),
|
||||
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemd"))),
|
||||
PathVariable('datarootdir', 'sets the root of data directories to a non-default location', "share", PathVariable.PathAccept),
|
||||
PathVariable('datadirname', 'sets the name of data directory', "wesnoth$version_suffix", PathVariable.PathAccept),
|
||||
PathVariable('desktopdir', 'sets the desktop entry directory to a non-default location', "$datarootdir/applications", PathVariable.PathAccept),
|
||||
PathVariable('icondir', 'sets the icons directory to a non-default location', "$datarootdir/icons", PathVariable.PathAccept),
|
||||
PathVariable('appdatadir', 'sets the appdata directory to a non-default location', "$datarootdir/metainfo", PathVariable.PathAccept),
|
||||
BoolVariable('internal_data', 'Set to put data in Mac OS X application fork', False),
|
||||
PathVariable('localedirname', 'sets the locale data directory to a non-default location', "translations", PathVariable.PathAccept),
|
||||
PathVariable('mandir', 'sets the man pages directory to a non-default location', "$datarootdir/man", PathVariable.PathAccept),
|
||||
PathVariable('docdir', 'sets the doc directory to a non-default location', "$datarootdir/doc/wesnoth", PathVariable.PathAccept),
|
||||
PathVariable('python_site_packages_dir', 'sets the directory where python modules are installed', "lib/python/site-packages/wesnoth", PathVariable.PathAccept),
|
||||
BoolVariable('lowmem', 'Set to reduce memory usage by removing extra functionality', False),
|
||||
BoolVariable('notifications', 'Enable support for desktop notifications', True),
|
||||
BoolVariable('nls','enable compile/install of gettext message catalogs',True),
|
||||
BoolVariable('libintl', 'Use lib intl for translations, instead of boost locale', False),
|
||||
BoolVariable('png', 'Clear to disable writing png files for screenshots, images', True),
|
||||
PathVariable('prefix', 'autotools-style installation prefix', "/usr/local", PathVariable.PathAccept),
|
||||
PathVariable('prefsdir', 'user preferences directory', "", PathVariable.PathAccept),
|
||||
PathVariable('default_prefs_file', 'default preferences file name', "", PathVariable.PathAccept),
|
||||
|
@ -90,20 +82,19 @@ opts.AddVariables(
|
|||
BoolVariable('prereqs','abort if prerequisites cannot be detected',True),
|
||||
('program_suffix', 'suffix to append to names of installed programs',"$version_suffix"),
|
||||
('version_suffix', 'suffix that will be added to default values of prefsdir, program_suffix and datadirname', ""),
|
||||
BoolVariable('forum_user_handler', 'Enable forum user handler in wesnothd and campaignd', False),
|
||||
BoolVariable('raw_sockets', 'Set to use raw receiving sockets in the multiplayer network layer rather than the SDL_net facilities', False),
|
||||
BoolVariable('forum_user_handler', 'Enable forum user handler in wesnothd', False),
|
||||
('server_gid', 'group id of the user who runs wesnothd', ""),
|
||||
('server_uid', 'user id of the user who runs wesnothd', ""),
|
||||
BoolVariable('strict', 'Set to strict compilation', False),
|
||||
BoolVariable('pedantic', 'Set to pedantic compilation', False),
|
||||
BoolVariable('static_test', 'Staticaly build against boost test (Not supported yet)', False),
|
||||
BoolVariable('verbose', 'Emit progress messages during data installation.', False),
|
||||
PathVariable('sdldir', 'Directory of SDL installation.', "", OptionalPath),
|
||||
PathVariable('boostdir', 'Directory of boost installation.', "", OptionalPath),
|
||||
PathVariable('boostlibdir', 'Directory where boost libraries are installed.', "", OptionalPath),
|
||||
('boost_suffix', 'Suffix of boost libraries.'),
|
||||
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
|
||||
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
|
||||
PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", OptionalPath),
|
||||
BoolVariable('system_lua', 'Enable use of system Lua ' + lua_ver + ' (compiled as C++, only for non-Windows systems).', False),
|
||||
PathVariable('luadir', 'Directory where Lua binary package is unpacked.', "", OptionalPath),
|
||||
('host', 'Cross-compile host.', ''),
|
||||
EnumVariable('multilib_arch', 'Address model for multilib compiler: 32-bit or 64-bit', "", ["", "32", "64"]),
|
||||
|
@ -112,15 +103,13 @@ opts.AddVariables(
|
|||
BoolVariable('ccache', "Use ccache", False),
|
||||
('ctool', 'Set c compiler command if not using standard compiler.'),
|
||||
('cxxtool', 'Set c++ compiler command if not using standard compiler.'),
|
||||
EnumVariable('cxx_std', 'Target c++ std version', '17', ['17', '20']),
|
||||
EnumVariable('cxx_std', 'Target c++ std version', '11', ['11', '14', '1y']),
|
||||
BoolVariable('openmp', 'Enable openmp use.', False),
|
||||
('sanitize', 'Enable clang and GCC sanitizer functionality. A comma separated list of sanitize suboptions must be passed as value.', ''),
|
||||
BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False),
|
||||
BoolVariable("autorevision", 'Use autorevision tool to fetch current git revision that will be embedded in version string', True),
|
||||
BoolVariable("lockfile", "Create a lockfile to prevent multiple instances of scons from being run at the same time on this working copy.", False),
|
||||
BoolVariable("OS_ENV", "Forward the entire OS environment to scons", False),
|
||||
BoolVariable("history", "Clear to disable GNU history support in lua console", True),
|
||||
BoolVariable('force_color', 'Always produce ANSI-colored output (GNU/Clang only).', False),
|
||||
BoolVariable('compile_db', 'Produce a compile_commands.json file.', False),
|
||||
BoolVariable("history", "Clear to disable GNU history support in lua console", True)
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -134,21 +123,16 @@ for repo in Dir(".").repositories:
|
|||
# source code root and supplying this path with -Y option.
|
||||
toolpath.append(repo.abspath + "/scons")
|
||||
sys.path = toolpath + sys.path
|
||||
env = Environment(tools=["tar", "gettext_tool", "install", "scanreplace"], options = opts, toolpath = toolpath)
|
||||
env = Environment(tools=["tar", "gettext", "install", "python_devel", "scanreplace"], options = opts, toolpath = toolpath)
|
||||
|
||||
if env["lockfile"]:
|
||||
print("Creating lockfile")
|
||||
print "Creating lockfile"
|
||||
lockfile = os.path.abspath("scons.lock")
|
||||
if sys.version_info.major >= 3:
|
||||
create = "x"
|
||||
else:
|
||||
create = "wx"
|
||||
open(lockfile, create).write(str(os.getpid()))
|
||||
open(lockfile, "wx").write(str(os.getpid()))
|
||||
import atexit
|
||||
atexit.register(os.remove, lockfile)
|
||||
|
||||
if GetOption("option_cache") != "":
|
||||
opts.Save(GetOption("option_cache"), env)
|
||||
opts.Save(GetOption("option_cache"), env)
|
||||
env.SConsignFile("$build_dir/sconsign.dblite")
|
||||
|
||||
# If OS_ENV was enabled, copy the entire OS environment.
|
||||
|
@ -163,12 +147,19 @@ if term is not None:
|
|||
|
||||
if env["PLATFORM"] == "win32":
|
||||
env.Tool("mingw")
|
||||
elif env["PLATFORM"] == "sunos":
|
||||
env.Tool("sunc++")
|
||||
env.Tool("suncc")
|
||||
env.Tool("sunar")
|
||||
env.Tool("sunlink")
|
||||
env.Append(CXXFLAGS = Split("-library=stlport4 -staticlib=stlport4 -norunpath -features=tmplife -features=tmplrefstatic -features=extensions"))
|
||||
env.Append(LINKFLAGS = Split("-library=stlport4 -staticlib=stlport4 -lsocket -lnsl -lboost_iostreams -L. -R."))
|
||||
env['CC'] = env['CXX']
|
||||
else:
|
||||
from cross_compile import *
|
||||
setup_cross_compile(env)
|
||||
|
||||
if sys.platform != 'win32':
|
||||
env.Tool("system_include")
|
||||
env.Tool("system_include")
|
||||
|
||||
if 'HOME' in os.environ:
|
||||
env['ENV']['HOME'] = os.environ['HOME']
|
||||
|
@ -182,57 +173,52 @@ if env.get('cxxtool',""):
|
|||
|
||||
if env['jobs'] > 1:
|
||||
SetOption("num_jobs", env['jobs'])
|
||||
else:
|
||||
env['jobs'] = 1
|
||||
|
||||
if env['distcc']:
|
||||
if env['distcc']:
|
||||
env.Tool('distcc')
|
||||
|
||||
if env['ccache']: env.Tool('ccache')
|
||||
|
||||
if env['compile_db']:
|
||||
env.Tool('compilation_db')
|
||||
cdb = env.CompilationDatabase()
|
||||
Alias('cdb', cdb)
|
||||
SDL2_version = '';
|
||||
if env["PLATFORM"] is "win32" or env["PLATFORM"] is "cygwin" or env["PLATFORM"] is "darwin":
|
||||
SDL2_version = '2.0.4';
|
||||
else:
|
||||
SDL2_version = '2.0.2';
|
||||
|
||||
boost_version = "1.67"
|
||||
|
||||
def SortHelpText(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
||||
Help("""Arguments may be a mixture of switches and targets in any order.
|
||||
Switches apply to the entire build regardless of where they are in the order.
|
||||
Important switches include:
|
||||
|
||||
prefix=/usr probably what you want for production tools
|
||||
use_srcdir=yes build directly in the distribution root;
|
||||
build=base build directly in the distribution root;
|
||||
you'll need this if you're trying to use Emacs compile mode.
|
||||
build=release build the release build variant with appropriate flags
|
||||
in build/release and copy resulting binaries
|
||||
into distribution/working copy root.
|
||||
build=debug same for debug build variant
|
||||
build=profile build with instrumentation for a supported profiler
|
||||
build=debug same for debug build variant, binaries will be copied with -debug suffix
|
||||
|
||||
With no arguments, the recipe builds wesnoth and wesnothd. Available
|
||||
build targets include the individual binaries:
|
||||
|
||||
wesnoth wesnothd campaignd boost_unit_tests
|
||||
wesnoth wesnothd campaignd exploder cutter test
|
||||
|
||||
You can make the following special build targets:
|
||||
|
||||
all = wesnoth wesnothd campaignd boost_unit_tests (*).
|
||||
all = wesnoth exploder cutter wesnothd campaignd test (*).
|
||||
TAGS = build tags for Emacs (*).
|
||||
wesnoth-deps.png = project dependency graph
|
||||
install = install all executables that currently exist, and any data needed
|
||||
install-wesnothd = install the Wesnoth multiplayer server.
|
||||
install-campaignd = install the Wesnoth campaign server.
|
||||
install-cutter = install the castle cutter
|
||||
install-exploder = install the castle exploder
|
||||
install-pytools = install all Python tools and modules
|
||||
uninstall = uninstall all executables, tools, modules, and servers.
|
||||
pot-update = generate gettext message catalog templates and merge them with localized message catalogs
|
||||
update-po = merge message catalog templates with localized message catalogs for particular lingua
|
||||
update-po4a = update translations of manual and manpages
|
||||
af bg ca ... = linguas for update-po
|
||||
translations = build all translations
|
||||
dist = make distribution tarball as wesnoth.tar.bz2 (*).
|
||||
data-dist = make data tarball as wesnoth-data.tar.bz2 (*).
|
||||
binary-dist = make data tarball as wesnoth-binaries.tar.bz2 (*).
|
||||
|
@ -249,7 +235,7 @@ specifying --option-cache=FILE command line argument. Current option values can
|
|||
|
||||
If you set CXXFLAGS and/or LDFLAGS in the environment, the values will
|
||||
be appended to the appropriate variables within scons.
|
||||
""" + opts.GenerateHelpText(env, sort=SortHelpText))
|
||||
""" + opts.GenerateHelpText(env, sort=cmp))
|
||||
|
||||
if GetOption("help"):
|
||||
Return()
|
||||
|
@ -263,7 +249,7 @@ if env["fast"]:
|
|||
SetOption('implicit_cache', 1)
|
||||
|
||||
if not os.path.isabs(env["prefix"]):
|
||||
print("Warning: prefix is set to relative dir. destdir setting will be ignored.")
|
||||
print "Warning: prefix is set to relative dir. destdir setting will be ignored."
|
||||
env["destdir"] = ""
|
||||
|
||||
#
|
||||
|
@ -284,7 +270,7 @@ if sys.platform == 'win32':
|
|||
|
||||
sAttrs = win32security.SECURITY_ATTRIBUTES()
|
||||
StartupInfo = win32process.STARTUPINFO()
|
||||
newargs = ' '.join(map(escape, args[1:]))
|
||||
newargs = string.join(map(escape, args[1:]), ' ')
|
||||
cmdline = cmd + " " + newargs
|
||||
|
||||
# check for any special operating system commands
|
||||
|
@ -297,8 +283,8 @@ if sys.platform == 'win32':
|
|||
hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
|
||||
win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
|
||||
exit_code = win32process.GetExitCodeProcess(hProcess)
|
||||
win32file.CloseHandle(hProcess)
|
||||
win32file.CloseHandle(hThread)
|
||||
win32file.CloseHandle(hProcess);
|
||||
win32file.CloseHandle(hThread);
|
||||
return exit_code
|
||||
|
||||
env['SPAWN'] = my_spawn
|
||||
|
@ -310,19 +296,19 @@ if sys.platform == 'win32':
|
|||
#
|
||||
# Check some preconditions
|
||||
#
|
||||
print("---[checking prerequisites]---")
|
||||
print "---[checking prerequisites]---"
|
||||
|
||||
def Info(message):
|
||||
print("INFO: " + message)
|
||||
print message
|
||||
return True
|
||||
|
||||
def Warning(message):
|
||||
print("WARNING: " + message)
|
||||
print message
|
||||
return False
|
||||
|
||||
from metasconf import init_metasconf
|
||||
configure_args = dict(
|
||||
custom_tests = init_metasconf(env, ["cplusplus", "sdl", "boost", "cairo", "pango", "pkgconfig", "gettext_tool", "lua"]),
|
||||
custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "pango", "pkgconfig", "gettext", "lua"]),
|
||||
config_h = "$build_dir/config.h",
|
||||
log_file="$build_dir/config.log", conf_dir="$build_dir/sconf_temp")
|
||||
|
||||
|
@ -335,26 +321,17 @@ if env["multilib_arch"]:
|
|||
# Some tests need to load parts of boost
|
||||
env.PrependENVPath('LD_LIBRARY_PATH', env["boostlibdir"])
|
||||
|
||||
# Some tests require at least C++11
|
||||
if "gcc" in env["TOOLS"]:
|
||||
env.AppendUnique(CCFLAGS = Split("-Wall -Wextra"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Werror=non-virtual-dtor -std=c++" + env["cxx_std"]))
|
||||
|
||||
# GCC-13 added this new warning, and included it in -Wextra,
|
||||
# however in GCC-13 it has a lot of false positives.
|
||||
#
|
||||
# It's likely to generate false postives with GCC-14 too, but
|
||||
# I'm using a narrow version check as GCC-14 is still in dev.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110075
|
||||
if "CXXVERSION" in env and env["CXXVERSION"].startswith("13."):
|
||||
env.AppendUnique(CXXFLAGS = "-Wno-dangling-reference")
|
||||
|
||||
if env["prereqs"]:
|
||||
conf = env.Configure(**configure_args)
|
||||
|
||||
if env["PLATFORM"] == "posix":
|
||||
conf.CheckCHeader("poll.h", "<>")
|
||||
conf.CheckCHeader("sys/poll.h", "<>")
|
||||
conf.CheckCHeader("sys/select.h", "<>")
|
||||
if conf.CheckCHeader("sys/sendfile.h", "<>"):
|
||||
conf.CheckFunc("sendfile")
|
||||
conf.CheckLib("m")
|
||||
conf.CheckFunc("round")
|
||||
|
||||
def CheckAsio(conf):
|
||||
if env["PLATFORM"] == 'win32':
|
||||
|
@ -364,122 +341,126 @@ if env["prereqs"]:
|
|||
have_libpthread = conf.CheckLib("pthread")
|
||||
return have_libpthread & \
|
||||
conf.CheckBoost("system") & \
|
||||
conf.CheckBoost("asio", header_only = True) & \
|
||||
conf.CheckBoost("context") & \
|
||||
conf.CheckBoost("coroutine")
|
||||
conf.CheckBoost("asio", header_only = True)
|
||||
|
||||
if env['host'] in ['x86_64-nacl', 'i686-nacl']:
|
||||
# libppapi_cpp has a reverse dependency on the following function
|
||||
env.Append(LINKFLAGS = ['-Wl,--undefined=_ZN2pp12CreateModuleEv'])
|
||||
conf.CheckLib("ppapi")
|
||||
conf.CheckLib("ppapi_cpp")
|
||||
conf.CheckLib("nacl-mounts")
|
||||
# We are linking static libraries without libtool.
|
||||
# Enumerating all transitive dependencies.
|
||||
conf.CheckLib("pthread")
|
||||
conf.CheckLib("dl")
|
||||
conf.CheckLib("SDL")
|
||||
conf.CheckLib("jpeg")
|
||||
conf.CheckLib("png")
|
||||
conf.CheckLib("tiff")
|
||||
conf.CheckLib("ogg")
|
||||
conf.CheckLib("expat")
|
||||
conf.CheckLib("pixman-1")
|
||||
conf.CheckLib("vorbisfile")
|
||||
conf.CheckLib("vorbis")
|
||||
conf.CheckLib("mikmod")
|
||||
|
||||
|
||||
def have_sdl_net():
|
||||
return \
|
||||
conf.CheckSDL(require_version = SDL2_version) & \
|
||||
conf.CheckSDL("SDL2_net", header_file = "SDL_net")
|
||||
|
||||
def have_sdl_other():
|
||||
return \
|
||||
conf.CheckSDL2('2.0.18') & \
|
||||
conf.CheckSDL2Mixer() & \
|
||||
conf.CheckSDL2Image()
|
||||
conf.CheckSDL(require_version = SDL2_version) & \
|
||||
conf.CheckSDL("SDL2_ttf", header_file = "SDL_ttf") & \
|
||||
conf.CheckSDL("SDL2_mixer", header_file = "SDL_mixer") & \
|
||||
conf.CheckSDL("SDL2_image", header_file = "SDL_image")
|
||||
|
||||
if sys.platform == "msys":
|
||||
env["PKG_CONFIG_FLAGS"] = "--dont-define-prefix"
|
||||
if env["libintl"]:
|
||||
def have_i18n_prereqs():
|
||||
return conf.CheckGettextLibintl()
|
||||
else:
|
||||
def have_i18n_prereqs():
|
||||
return conf.CheckBoost("locale")
|
||||
|
||||
have_server_prereqs = (\
|
||||
conf.CheckCPlusPlus(gcc_version = "8") & \
|
||||
conf.CheckBoost("iostreams", require_version = boost_version) & \
|
||||
conf.CheckCPlusPlus(gcc_version = "3.3") & \
|
||||
conf.CheckBoost("iostreams", require_version = "1.34.1") & \
|
||||
conf.CheckBoostIostreamsGZip() & \
|
||||
conf.CheckBoostIostreamsBZip2() & \
|
||||
conf.CheckBoost("program_options", require_version = boost_version) & \
|
||||
conf.CheckBoost("random", require_version = boost_version) & \
|
||||
CheckAsio(conf) & \
|
||||
conf.CheckBoost("random",require_version = "1.40.0") & \
|
||||
conf.CheckBoost("smart_ptr", header_only = True) & \
|
||||
conf.CheckBoostCharconv() & \
|
||||
CheckAsio(conf) & \
|
||||
conf.CheckBoost("thread") & \
|
||||
conf.CheckBoost("locale") & \
|
||||
conf.CheckBoost("filesystem") \
|
||||
and Info("Base prerequisites are met")) \
|
||||
or Warning("Base prerequisites are not met")
|
||||
if(have_server_prereqs and not env["host"]):
|
||||
conf.CheckBoostLocaleBackends(["icu", "winapi"]) \
|
||||
or Warning("Only icu and winapi backends of Boost Locale are supported. Bugs/crashes are very likely with other backends")
|
||||
|
||||
if env['harden']:
|
||||
env["have_fortify"] = conf.CheckFortifySource()
|
||||
|
||||
if(env["PLATFORM"] != 'darwin'):
|
||||
# Otherwise, use Security.framework
|
||||
have_server_prereqs = have_server_prereqs & conf.CheckLib("libcrypto") & conf.CheckLib("ssl")
|
||||
conf.CheckBoost("system") & \
|
||||
conf.CheckBoost("filesystem", require_version = "1.44.0") & \
|
||||
have_i18n_prereqs() \
|
||||
and Info("GOOD: Base prerequisites are met")) \
|
||||
or Warning("WARN: Base prerequisites are not met")
|
||||
|
||||
env = conf.Finish()
|
||||
|
||||
client_env = env.Clone()
|
||||
conf = client_env.Configure(**configure_args)
|
||||
have_client_prereqs = have_server_prereqs & have_sdl_other()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckLib("vorbisfile") & conf.CheckOgg()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPNG()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckJPG()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckWebP()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckCairo(min_version = "1.10")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPango("cairo", require_version = "1.44.0")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPKG("fontconfig")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckBoost("regex")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckLib("curl")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckBoost("graph")
|
||||
|
||||
if env["system_lua"]:
|
||||
if env["PLATFORM"] == 'win32':
|
||||
Warning("System Lua cannot be used on Windows.")
|
||||
if not conf.CheckLua(lua_ver):
|
||||
have_client_prereqs = False
|
||||
else:
|
||||
if not File("#/src/modules/lua/.git").rfile().exists():
|
||||
have_client_prereqs = False
|
||||
Warning("Lua submodule does not exist. You must run 'git submodule update --init --recursive' to initialize it.")
|
||||
else:
|
||||
print("Lua submodule found.")
|
||||
|
||||
if not have_client_prereqs:
|
||||
Warning("Client prerequisites are not met. wesnoth cannot be built.")
|
||||
have_client_prereqs = have_server_prereqs & have_sdl_other() & \
|
||||
conf.CheckLib("vorbisfile") & \
|
||||
conf.CheckOgg() & \
|
||||
conf.CheckPNG() & \
|
||||
conf.CheckJPG() & \
|
||||
conf.CheckPango("cairo", require_version = "1.21.3") & \
|
||||
conf.CheckPKG("fontconfig") & \
|
||||
conf.CheckBoost("program_options", require_version="1.35.0") & \
|
||||
conf.CheckBoost("thread") & \
|
||||
conf.CheckBoost("regex") \
|
||||
or Warning("WARN: Client prerequisites are not met. wesnoth, cutter and exploder cannot be built")
|
||||
|
||||
have_X = False
|
||||
if have_client_prereqs:
|
||||
if env["PLATFORM"] != "win32":
|
||||
have_X = conf.CheckLib('X11')
|
||||
else:
|
||||
if env["libintl"]:
|
||||
Warning("ERROR: You cannot use the libintl option when building for windows")
|
||||
have_client_prereqs = False
|
||||
|
||||
env["notifications"] = env["notifications"] and conf.CheckPKG("dbus-1")
|
||||
if env["notifications"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_LIBDBUS"])
|
||||
|
||||
client_env['fribidi'] = client_env['fribidi'] and (conf.CheckPKG('fribidi >= 0.10.9') or Warning("Can't find FriBiDi, disabling FriBiDi support."))
|
||||
if client_env['fribidi']:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_FRIBIDI"])
|
||||
|
||||
env["png"] = env["png"] and conf.CheckLib("png")
|
||||
if env["png"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_LIBPNG"])
|
||||
|
||||
env["history"] = env["history"] and (conf.CheckLib("history") or Warning("Can't find GNU history, disabling history support."))
|
||||
|
||||
client_env = conf.Finish()
|
||||
|
||||
# We set those outside of Configure() section because SCons doesn't merge CPPPATH var properly in conf.Finish()
|
||||
if env["notifications"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_LIBDBUS"])
|
||||
if env["history"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_HISTORY"])
|
||||
|
||||
env.Append(CPPDEFINES = ["BOOST_COROUTINES_NO_DEPRECATION_WARNING"])
|
||||
if env["history"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_HISTORY"])
|
||||
|
||||
if env["forum_user_handler"]:
|
||||
found_connector = False
|
||||
for sql_config in ["mariadb_config", "mysql_config"]:
|
||||
try:
|
||||
mysql_config = check_output([sql_config, "--libs", "--cflags"]).decode("utf-8").replace("\n", " ").replace("-DNDEBUG", "")
|
||||
mysql_flags = env.ParseFlags(mysql_config+"-I"+Dir("#/src/modules/mariadbpp/include/").rdir().abspath)
|
||||
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
|
||||
env.MergeFlags(mysql_flags)
|
||||
found_connector = True
|
||||
break
|
||||
except OSError:
|
||||
print("Failed to run script '%s'" % sql_config)
|
||||
flags = env.ParseFlags("!mysql_config --libs --cflags")
|
||||
try: # Some versions of mysql_config add -DNDEBUG but we don't want it
|
||||
flags["CPPDEFINES"].remove("NDEBUG")
|
||||
except ValueError:
|
||||
pass
|
||||
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
|
||||
env.MergeFlags(flags)
|
||||
|
||||
if not found_connector:
|
||||
Exit("Failed to find sql connector library but forum user handler support is requested.")
|
||||
have_server_prereqs = False
|
||||
client_env = conf.Finish()
|
||||
|
||||
test_env = client_env.Clone()
|
||||
conf = test_env.Configure(**configure_args)
|
||||
|
||||
have_test_prereqs = have_client_prereqs and conf.CheckBoost('unit_test_framework') \
|
||||
or Warning("Unit tests are disabled because their prerequisites are not met")
|
||||
or Warning("WARN: Unit tests are disabled because their prerequisites are not met")
|
||||
test_env = conf.Finish()
|
||||
if not have_test_prereqs and "boost_unit_tests" in env["default_targets"]:
|
||||
env["default_targets"].remove("boost_unit_tests")
|
||||
if not have_test_prereqs and "test" in env["default_targets"]:
|
||||
env["default_targets"].remove("test")
|
||||
|
||||
print(" " + env.subst("If any config checks fail, look in $build_dir/config.log for details"))
|
||||
print(" If a check fails spuriously due to caching, use --config=force to force its rerun")
|
||||
print " " + env.subst("If any config checks fail, look in $build_dir/config.log for details")
|
||||
print " If a check fails spuriously due to caching, use --config=force to force its rerun"
|
||||
|
||||
else:
|
||||
have_client_prereqs = True
|
||||
|
@ -492,173 +473,58 @@ else:
|
|||
client_env = env.Clone()
|
||||
|
||||
|
||||
if not env["MSGFMT"]:
|
||||
if env['host'] in ['x86_64-nacl', 'i686-nacl']:
|
||||
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
|
||||
client_env['_LIBFLAGS'] = '-Wl,--start-group ' + client_env['_LIBFLAGS'] + ' -Wl,--end-group'
|
||||
|
||||
have_msgfmt = env["MSGFMT"]
|
||||
if not have_msgfmt:
|
||||
env["nls"] = False
|
||||
print("NLS tools are not present...")
|
||||
if not have_msgfmt:
|
||||
print "NLS tools are not present..."
|
||||
if not env['nls']:
|
||||
print("NLS catalogue installation is disabled.")
|
||||
print "NLS catalogue installation is disabled."
|
||||
|
||||
#
|
||||
# Implement configuration switches
|
||||
#
|
||||
print("---[applying configuration]---")
|
||||
print "---[applying configuration]---"
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
build_root="#/"
|
||||
if os.path.isabs(env["build_dir"]):
|
||||
build_root = ""
|
||||
env.Prepend(CPPPATH = [build_root + "$build_dir", "#/src"])
|
||||
if env["system_lua"]:
|
||||
env.Append(CPPDEFINES = ["HAVE_SYSTEM_LUA"])
|
||||
|
||||
env.Append(CPPDEFINES = ["HAVE_CONFIG_H"])
|
||||
|
||||
if "clang" in env["CXX"]:
|
||||
# Silence warnings about unused -I options and unknown warning switches.
|
||||
env.AppendUnique(CCFLAGS = Split("-Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized -Wno-unused-lambda-capture"))
|
||||
|
||||
if env['pedantic']:
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wdocumentation -Wno-documentation-deprecated-sync"))
|
||||
if env['force_color']:
|
||||
env.AppendUnique(CCFLAGS = ["-fcolor-diagnostics"])
|
||||
|
||||
if "gcc" in env["TOOLS"]:
|
||||
env.AppendUnique(CCFLAGS = Split("-Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wtrampolines"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wold-style-cast"))
|
||||
env.AppendUnique(CCFLAGS = Split("-W -Wall"), CFLAGS = ["-std=c99"])
|
||||
|
||||
env.AppendUnique(CXXFLAGS = "-std=c++" + env["cxx_std"])
|
||||
|
||||
if env['openmp']:
|
||||
env.AppendUnique(CXXFLAGS = ["-fopenmp"], LIBS = ["gomp"])
|
||||
|
||||
if env['strict']:
|
||||
env.AppendUnique(CCFLAGS = Split("-Werror"))
|
||||
if env['pedantic']:
|
||||
env.AppendUnique(CCFLAGS = Split("-Wlogical-op -Wmissing-declarations -Wredundant-decls -Wdouble-promotion"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wctor-dtor-privacy -Wuseless-cast -Wnoexcept"))
|
||||
env.AppendUnique(CCFLAGS = Split("-Werror $(-Wno-unused-local-typedefs$)"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wold-style-cast"))
|
||||
if env['sanitize']:
|
||||
env.AppendUnique(CCFLAGS = ["-fsanitize=" + env["sanitize"]], LINKFLAGS = ["-fsanitize=" + env["sanitize"]])
|
||||
env.AppendUnique(CCFLAGS = Split("-fno-omit-frame-pointer -fno-optimize-sibling-calls"))
|
||||
if env['force_color']:
|
||||
env.AppendUnique(CCFLAGS = ["-fdiagnostics-color=always"])
|
||||
|
||||
env["OPT_FLAGS"] = "-O2"
|
||||
env["DEBUG_FLAGS"] = Split("-O0 -DDEBUG -ggdb3")
|
||||
|
||||
# #
|
||||
# Determine optimization level
|
||||
# #
|
||||
if "clang" in env["CXX"]:
|
||||
# Silence warnings about unused -I options and unknown warning switches.
|
||||
env.AppendUnique(CCFLAGS = Split("-Qunused-arguments -Wno-unknown-warning-option"))
|
||||
|
||||
if not env["opt"]:
|
||||
if env["build"] == "release":
|
||||
env["opt"] = "-O3 "
|
||||
elif env["profiler"] == "perf":
|
||||
env["opt"] = "-Og "
|
||||
else:
|
||||
env["opt"] = "-O0 "
|
||||
else:
|
||||
env["opt"] = env["opt"]+" "
|
||||
if "suncc" in env["TOOLS"]:
|
||||
env["OPT_FLAGS"] = "-g0"
|
||||
env["DEBUG_FLAGS"] = "-g"
|
||||
|
||||
# #
|
||||
# Add options to provide more hardened executables
|
||||
# osx doesn't seem to support RELRO
|
||||
# windows' tdm-gcc doesn't seem to provide good support for the hardening options in general
|
||||
# #
|
||||
|
||||
if env['harden'] and env["PLATFORM"] != 'win32':
|
||||
env.AppendUnique(CCFLAGS = ["-fPIE", "-fstack-protector-strong"])
|
||||
if not env.get("have_fortify") and "-O0" not in env["opt"]:
|
||||
env.AppendUnique(CPPDEFINES = ["_FORTIFY_SOURCE=2"])
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
env.AppendUnique(LINKFLAGS = ["-fstack-protector-strong"])
|
||||
|
||||
if env["PLATFORM"] == 'darwin':
|
||||
env.AppendUnique(LINKFLAGS = ["-fPIE", "-Wl,-pie"])
|
||||
else:
|
||||
env.AppendUnique(LINKFLAGS = ["-fPIE", "-pie", "-Wl,-z,relro,-z,now"])
|
||||
|
||||
# #
|
||||
# Start determining options for debug build
|
||||
# #
|
||||
|
||||
debug_flags = env["opt"]+"-DDEBUG -ggdb3"
|
||||
if "mingw" in env["TOOLS"]:
|
||||
debug_flags += " -Wa,-mbig-obj"
|
||||
debug_flags = Split(debug_flags)
|
||||
debug_flags.append("${ '-O3' if TARGET.name == 'gettext.o' else '' }") # workaround for "File too big" errors
|
||||
|
||||
glibcxx_debug_flags = ""
|
||||
if env["glibcxx_assertions"] == True:
|
||||
glibcxx_debug_flags = " ".join([glibcxx_debug_flags, "_GLIBCXX_ASSERTIONS"])
|
||||
if env["glibcxx_debug"] == True:
|
||||
glibcxx_debug_flags = " ".join([glibcxx_debug_flags, "_GLIBCXX_DEBUG", "_GLIBCXX_DEBUG_PEDANTIC"])
|
||||
|
||||
# #
|
||||
# End determining options for debug build
|
||||
# Start setting options for release build
|
||||
# #
|
||||
|
||||
# default compiler flags
|
||||
rel_comp_flags = env["opt"]
|
||||
rel_link_flags = ""
|
||||
|
||||
# #
|
||||
# Add flags if using profiling
|
||||
# #
|
||||
|
||||
if env["profiler"] == "gprof":
|
||||
rel_comp_flags += " -pg"
|
||||
rel_link_flags += " -pg"
|
||||
|
||||
if env["profiler"] == "gcov":
|
||||
rel_comp_flags += " --coverage"
|
||||
rel_link_flags += " --coverage"
|
||||
|
||||
if env["profiler"] == "gperftools":
|
||||
rel_comp_flags += ""
|
||||
rel_link_flags += " -Wl,--no-as-needed,-lprofiler"
|
||||
|
||||
if env["profiler"] == "perf":
|
||||
rel_comp_flags += " -ggdb -fno-omit-frame-pointer"
|
||||
rel_link_flags += ""
|
||||
|
||||
# use the arch if provided, or if on Windows and no arch was passed in then default to pentiumpro
|
||||
# without setting to pentiumpro, compiling on Windows with 64-bit tdm-gcc and -O3 currently fails
|
||||
if env["arch"]:
|
||||
env["arch"] = " -march=" + env["arch"]
|
||||
|
||||
if env["PLATFORM"] == "win32" and not env["arch"]:
|
||||
env["arch"] = " -march=pentiumpro"
|
||||
|
||||
rel_comp_flags += env["arch"]
|
||||
|
||||
# PGO and LTO setup
|
||||
if "gcc" in env["CC"]:
|
||||
if env["pgo_data"] == "generate":
|
||||
rel_comp_flags += " -fprofile-generate=pgo_data/"
|
||||
rel_link_flags += " -fprofile-generate=pgo_data/"
|
||||
|
||||
if env["pgo_data"] == "use":
|
||||
rel_comp_flags += " -fprofile-correction -fprofile-use=pgo_data/"
|
||||
rel_link_flags += " -fprofile-correction -fprofile-use=pgo_data/"
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
rel_comp_flags += " -flto=" + str(env["jobs"])
|
||||
rel_link_flags += rel_comp_flags + " -fuse-ld=gold -Wno-stringop-overflow"
|
||||
elif "clang" in env["CXX"]:
|
||||
if env["pgo_data"] == "generate":
|
||||
rel_comp_flags += " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
rel_link_flags += " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
|
||||
if env["pgo_data"] == "use":
|
||||
rel_comp_flags += " -fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
rel_link_flags += " -fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
rel_comp_flags += " -flto=thin"
|
||||
rel_link_flags += rel_comp_flags + " -fuse-ld=lld"
|
||||
|
||||
# Enable ASLR and NX bit support on mingw
|
||||
if "mingw" in env["TOOLS"]:
|
||||
rel_link_flags += " -Wl,--dynamicbase -Wl,--nxcompat"
|
||||
|
||||
# #
|
||||
# End setting options for release build
|
||||
# #
|
||||
if env['lowmem']:
|
||||
env.Append(CPPDEFINES = "LOW_MEM")
|
||||
|
||||
if env['internal_data']:
|
||||
env.Append(CPPDEFINES = "USE_INTERNAL_DATA")
|
||||
|
@ -667,69 +533,62 @@ for env in [test_env, client_env, env]:
|
|||
env.Append(CPPDEFINES = "_X11")
|
||||
|
||||
# Simulate autools-like behavior of prefix on various paths
|
||||
installdirs = Split("bindir datadir fifodir icondir desktopdir appdatadir mandir docdir python_site_packages_dir")
|
||||
installdirs = Split("bindir datadir fifodir icondir desktopdir mandir docdir python_site_packages_dir")
|
||||
for d in installdirs:
|
||||
env[d] = os.path.join(env["prefix"], env[d])
|
||||
|
||||
if env["PLATFORM"] == 'win32':
|
||||
env.Append(LIBS = ["wsock32", "crypt32", "iconv", "z", "shlwapi", "winmm", "ole32", "uuid"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0A00"])
|
||||
env.Append(LIBS = ["wsock32", "iconv", "z"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0501"])
|
||||
|
||||
if env["PLATFORM"] == 'darwin': # Mac OS X
|
||||
env.Append(FRAMEWORKS = "Cocoa") # Cocoa GUI
|
||||
env.Append(FRAMEWORKS = "Security") # commonCrypto (after OpenSSL replacement on Mac)
|
||||
env.Append(FRAMEWORKS = "IOKit") # IOKit
|
||||
env.Append(FRAMEWORKS = "CoreGraphics") # CoreGraphics
|
||||
|
||||
if env["PLATFORM"] == 'sunos':
|
||||
env.Append(LINKFLAGS = "-lsocket")
|
||||
env.Append(FRAMEWORKS = "Carbon") # Carbon GUI
|
||||
|
||||
if not env['static_test']:
|
||||
test_env.Append(CPPDEFINES = "BOOST_TEST_DYN_LINK")
|
||||
|
||||
if env['autorevision']:
|
||||
try:
|
||||
if call(env.subst("utils/autorevision.sh -t h > $build_dir/revision.h"), shell=True) == 0:
|
||||
env["have_autorevision"] = True
|
||||
if not call(env.subst("cmp -s $build_dir/revision.h src/revision.h"), shell=True) == 0:
|
||||
call(env.subst("cp $build_dir/revision.h src/revision.h"), shell=True)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if call(env.subst("utils/autorevision -t h > $build_dir/revision.h"), shell=True) == 0:
|
||||
env["have_autorevision"] = True
|
||||
except:
|
||||
pass
|
||||
|
||||
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
|
||||
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))
|
||||
|
||||
binaries = Split("wesnoth wesnothd campaignd boost_unit_tests")
|
||||
binaries = Split("wesnoth wesnothd cutter exploder campaignd test")
|
||||
builds = {
|
||||
"release" : dict(CCFLAGS = Split(rel_comp_flags) , LINKFLAGS = Split(rel_link_flags)),
|
||||
"debug" : dict(CCFLAGS = Split(debug_flags) , CPPDEFINES = Split(glibcxx_debug_flags))
|
||||
"base" : dict(CCFLAGS = "$OPT_FLAGS"), # Don't build in subdirectory
|
||||
"debug" : dict(CCFLAGS = Split("$DEBUG_FLAGS")),
|
||||
"glibcxx_debug" : dict(CPPDEFINES = Split("_GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC")),
|
||||
"release" : dict(CCFLAGS = "$OPT_FLAGS"),
|
||||
"profile" : dict(CCFLAGS = "-pg", LINKFLAGS = "-pg")
|
||||
}
|
||||
builds["glibcxx_debug"].update(builds["debug"])
|
||||
build = env["build"]
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
env["extra_flags_glibcxx_debug"] = env["extra_flags_debug"]
|
||||
env.AppendUnique(**builds[build])
|
||||
env.Append(CXXFLAGS = Split(os.environ.get('CXXFLAGS', [])), LINKFLAGS = Split(os.environ.get('LDFLAGS', [])))
|
||||
env.MergeFlags(env["extra_flags_" + build])
|
||||
|
||||
if env["use_srcdir"] == True:
|
||||
if build == "base":
|
||||
build_dir = ""
|
||||
else:
|
||||
build_dir = os.path.join("$build_dir", build)
|
||||
|
||||
if build == "release" : build_suffix = ""
|
||||
else : build_suffix = "-" + build
|
||||
Export("build_suffix")
|
||||
env.SConscript("src/SConscript", variant_dir = build_dir, duplicate = False)
|
||||
Import(binaries + ["sources"])
|
||||
binary_nodes = [eval(binary) for binary in binaries]
|
||||
all = env.Alias("all", [Alias(binary) for binary in binaries])
|
||||
env.Default([Alias(target) for target in env["default_targets"]])
|
||||
binary_nodes = map(eval, binaries)
|
||||
all = env.Alias("all", map(Alias, binaries))
|
||||
env.Default(map(Alias, env["default_targets"]))
|
||||
|
||||
if have_client_prereqs and env["nls"]:
|
||||
env.Requires("wesnoth", Dir("translations"))
|
||||
|
||||
#
|
||||
# clean out any PGO-related files
|
||||
#
|
||||
|
||||
env.Clean(all, "pgo_data/")
|
||||
|
||||
#
|
||||
# Utility productions (Unix-like systems only)
|
||||
#
|
||||
|
@ -743,7 +602,7 @@ env.Clean(all, 'TAGS')
|
|||
# Unix installation productions
|
||||
#
|
||||
# These will not be portable to Windows or Mac. They assume a Unix-like
|
||||
# directory structure and FreeDesktop standard locations for icon, app,
|
||||
# directory structure and FreeDesktop standard locations foicon, app,
|
||||
# and doc files.
|
||||
#
|
||||
|
||||
|
@ -754,9 +613,9 @@ if os.path.isabs(env["localedirname"]):
|
|||
env["localedir"] = env["localedirname"]
|
||||
else:
|
||||
env["localedir"] = "$datadir/$localedirname"
|
||||
|
||||
|
||||
pythontools = Split("wmlscope wmllint wmlindent wesnoth_addon_manager")
|
||||
pythonmodules = Split("wmltools3.py wmlparser.py wmlparser3.py wmldata.py wmliterator3.py campaignserver_client.py __init__.py")
|
||||
pythonmodules = Split("wmltools.py wmlparser.py wmldata.py wmliterator.py campaignserver_client.py __init__.py")
|
||||
|
||||
def CopyFilter(fn):
|
||||
"Filter out data-tree things that shouldn't be installed."
|
||||
|
@ -764,37 +623,34 @@ def CopyFilter(fn):
|
|||
|
||||
env["copy_filter"] = CopyFilter
|
||||
|
||||
def MoFileFilter(fn):
|
||||
"Don't install .mo files for manual and manpages. They're built only to catch broken po files"
|
||||
return not "wesnoth-manual.mo" in str(fn) and not "wesnoth-manpages.mo" in str(fn)
|
||||
|
||||
linguas = Split(File("po/LINGUAS").get_contents().decode("utf-8"))
|
||||
linguas = Split(File("po/LINGUAS").get_contents())
|
||||
|
||||
def InstallManpages(env, component):
|
||||
env.InstallData("mandir", component, os.path.join("doc", "man", component + ".6"), "man6")
|
||||
for lingua in linguas:
|
||||
manpage = FindFile(os.path.join(lingua, component + ".6"), "doc/man")
|
||||
if manpage:
|
||||
env.InstallData("mandir", component, manpage, os.path.join(lingua, "man6"))
|
||||
manpage = os.path.join("doc", "man", lingua, component + ".6")
|
||||
env.InstallData("mandir", component, manpage, os.path.join(lingua, "man6"))
|
||||
|
||||
# Now the actual installation productions
|
||||
|
||||
# The game and associated resources
|
||||
env.InstallBinary(wesnoth)
|
||||
env.InstallData("datadir", "wesnoth", [Dir(sub) for sub in installable_subs])
|
||||
env.InstallData("datadir", "wesnoth", map(Dir, installable_subs))
|
||||
env.InstallData("docdir", "wesnoth", [Glob("doc/manual/*.html"), Dir("doc/manual/styles"), Dir("doc/manual/images")])
|
||||
if env["nls"]:
|
||||
env.InstallData("localedir", "wesnoth", Dir("translations"), copy_filter = MoFileFilter)
|
||||
env.InstallData("localedir", "wesnoth", Dir("translations"))
|
||||
env.InstallData("datadir", "wesnoth", "l10n-track")
|
||||
InstallManpages(env, "wesnoth")
|
||||
if have_client_prereqs and have_X and env["desktop_entry"]:
|
||||
env.InstallData("icondir", "wesnoth", "packaging/icons")
|
||||
env.InstallData("desktopdir", "wesnoth", "packaging/org.wesnoth.Wesnoth.desktop")
|
||||
if have_client_prereqs and "linux" in sys.platform and env["appdata_file"]:
|
||||
env.InstallData("appdatadir", "wesnoth", "packaging/org.wesnoth.Wesnoth.appdata.xml")
|
||||
if sys.platform == "darwin":
|
||||
env.InstallData("icondir", "wesnoth", "icons/wesnoth-icon-Mac.png")
|
||||
else:
|
||||
env.InstallData("icondir", "wesnoth", "icons/wesnoth-icon.png")
|
||||
env.InstallData("desktopdir", "wesnoth", "icons/wesnoth.desktop")
|
||||
|
||||
# Python tools
|
||||
env.InstallData("bindir", "pytools", [os.path.join("data", "tools", tool) for tool in pythontools])
|
||||
env.InstallData("python_site_packages_dir", "pytools", [os.path.join("data", "tools", "wesnoth", module) for module in pythonmodules])
|
||||
env.InstallData("bindir", "pytools", map(lambda tool: os.path.join("data", "tools", tool), pythontools))
|
||||
env.InstallData("python_site_packages_dir", "pytools", map(lambda module: os.path.join("data", "tools", "wesnoth", module), pythonmodules))
|
||||
|
||||
# Wesnoth MP server install
|
||||
env.InstallBinary(wesnothd)
|
||||
|
@ -802,7 +658,7 @@ InstallManpages(env, "wesnothd")
|
|||
if not access(fifodir, F_OK):
|
||||
fifodir = env.Command(fifodir, [], [
|
||||
Mkdir(fifodir),
|
||||
Chmod(fifodir, 0o700),
|
||||
Chmod(fifodir, 0700),
|
||||
Action("chown %s:%s %s" %
|
||||
(env["server_uid"], env["server_gid"], fifodir)),
|
||||
])
|
||||
|
@ -810,17 +666,21 @@ if not access(fifodir, F_OK):
|
|||
env.Alias("install-wesnothd", fifodir)
|
||||
if env["systemd"]:
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.service", "lib/systemd/system")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.tmpfiles.conf", "lib/tmpfiles.d")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.sysusers.conf", "lib/sysusers.d")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.conf", "lib/tmpfiles.d")
|
||||
|
||||
# Wesnoth campaign server
|
||||
env.InstallBinary(campaignd)
|
||||
|
||||
# And the artists' tools
|
||||
env.InstallBinary(cutter)
|
||||
env.InstallBinary(exploder)
|
||||
|
||||
# Compute things for default install based on which targets have been created.
|
||||
install = env.Alias('install', [])
|
||||
for installable in ('wesnoth',
|
||||
'wesnothd', 'campaignd'):
|
||||
if os.path.exists(installable) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
|
||||
'wesnothd', 'campaignd',
|
||||
'exploder', 'cutter'):
|
||||
if os.path.exists(installable + build_suffix) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
|
||||
env.Alias('install', env.Alias('install-'+installable))
|
||||
|
||||
#
|
||||
|
@ -846,11 +706,11 @@ if 'dist' in COMMAND_LINE_TARGETS: # Speedup, the manifest is expensive
|
|||
def dist_manifest():
|
||||
"Get an argument list suitable for passing to a distribution archiver."
|
||||
# Start by getting a list of all files under version control
|
||||
lst = subprocess.check_output("git ls-files", shell=True).splitlines()
|
||||
lst = commands.getoutput("git ls-files | grep -v 'data\/test\/.*' | awk '/^[^?]/ {print $4;}'").split()
|
||||
lst = filter(os.path.isfile, lst)
|
||||
return lst
|
||||
dist_tarball = env.Tar('wesnoth-${version}.tar.bz2', [])
|
||||
open("dist.manifest", "w").write("\n".join(dist_manifest() + ["src/revision.h"]))
|
||||
open("dist.manifest", "w").write("\n".join(dist_manifest() + ["src/revision.hpp"]))
|
||||
env.Append(TARFLAGS='-j -T dist.manifest --transform "s,^,wesnoth-$version/,"',
|
||||
TARCOMSTR="Making distribution tarball...")
|
||||
env.AlwaysBuild(dist_tarball)
|
||||
|
@ -890,26 +750,14 @@ env.WindowsInstaller([
|
|||
# Making Mac OS X application bundles
|
||||
#
|
||||
env.Alias("wesnoth-bundle",
|
||||
env.Command("Wesnoth.app", "wesnoth", [
|
||||
env.Command("Battle For Wesnoth.app", "wesnoth", [
|
||||
Mkdir("${TARGET}/Contents"),
|
||||
Mkdir("${TARGET}/Contents/MacOS"),
|
||||
Mkdir("${TARGET}/Contents/Resources"),
|
||||
Action('echo "APPL????" > "${TARGET}/Contents/PkgInfo"'),
|
||||
Copy("${TARGET}/Contents/MacOS/Wesnoth", "wesnoth"),
|
||||
Copy("${TARGET}/Contents/MacOS/wesnothd", "wesnothd"),
|
||||
Copy("${TARGET}/Contents/Info.plist", "projectfiles/Xcode/Info.plist"),
|
||||
Action(r"""sed -i '' 's/\$[{].*[}]/Wesnoth/' "${TARGET}/Contents/Info.plist" """),
|
||||
Copy("${TARGET}/Contents/Resources/data", "data"),
|
||||
Copy("${TARGET}/Contents/Resources/English.lproj", "projectfiles/Xcode/English.lproj"),
|
||||
Copy("${TARGET}/Contents/Resources/fonts", "fonts"),
|
||||
Copy("${TARGET}/Contents/Resources/fonts.conf", "projectfiles/Xcode/Resources/fonts.conf"),
|
||||
Copy("${TARGET}/Contents/Resources/icon.icns", "projectfiles/Xcode/Resources/icon.icns"),
|
||||
Copy("${TARGET}/Contents/Resources/images", "images"),
|
||||
Copy("${TARGET}/Contents/Resources/SDLMain.nib", "projectfiles/Xcode/Resources/SDLMain.nib"),
|
||||
Copy("${TARGET}/Contents/Resources/sounds", "sounds"),
|
||||
Copy("${TARGET}/Contents/Resources/translations", "translations"),
|
||||
Copy("${TARGET}/Contents/MacOS/wesnoth", "wesnoth"),
|
||||
]))
|
||||
env.Clean(all, "Wesnoth.app")
|
||||
env.Clean(all, "Battle For Wesnoth.app")
|
||||
|
||||
#
|
||||
# Sanity checking
|
||||
|
|
332
add_source_file
|
@ -1,332 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# encoding: utf-8
|
||||
|
||||
# known issues:
|
||||
# xcode - if a file already exists in 'wesnoth' target, then it incorrectly thinks it also exists in the 'tests' target even though the tests build will fail
|
||||
|
||||
"""
|
||||
Add files to the specified build targets, supporting
|
||||
CMake, SCons, Xcode and the Code::Blocks projects.
|
||||
|
||||
Valid build targets are:
|
||||
* "wesnoth" - the main game (default if no target is specified)
|
||||
* "wesnothd" - the wesnoth server
|
||||
* "campaignd"
|
||||
* "lua"
|
||||
* "tests" - boost unit tests
|
||||
|
||||
The files will be added to:
|
||||
* the lists used by CMake and SCons in "source_lists"
|
||||
* the Xcode project
|
||||
* The Code::Blocks project
|
||||
|
||||
This only supports files inside the "src" directory.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import inspect
|
||||
import pathlib
|
||||
|
||||
try:
|
||||
import pbxproj
|
||||
except:
|
||||
print('\n'.join((
|
||||
'This script requires the "pbxproj" module.',
|
||||
'Install it using "pip install pbxproj"',
|
||||
'optionally setting up a python3-venv first.',
|
||||
)))
|
||||
exit(1)
|
||||
|
||||
#=========#
|
||||
# Globals #
|
||||
#=========#
|
||||
|
||||
# Either the executable directory or the current working directory
|
||||
# should be the wesnoth root directory
|
||||
rootdir = pathlib.Path(inspect.getsourcefile(lambda:0))
|
||||
if not rootdir.joinpath("projectfiles").exists():
|
||||
rootdir = pathlib.Path()
|
||||
if not rootdir.joinpath("projectfiles").exists():
|
||||
raise Exception("Could not find project file directory")
|
||||
|
||||
# the names of the targets in the Xcode project
|
||||
xcode_target_translations = {
|
||||
"wesnoth": ["The Battle for Wesnoth", "unit_tests"],
|
||||
"wesnothd": ["wesnothd"],
|
||||
"campaignd": ["campaignd"],
|
||||
"lua": ["liblua"],
|
||||
"tests": ["unit_tests"],
|
||||
}
|
||||
|
||||
# the names of the targets in source_lists
|
||||
source_list_target_translations = {
|
||||
"wesnoth": "wesnoth",
|
||||
"wesnothd": "wesnothd",
|
||||
"campaignd": "campaignd",
|
||||
"lua": "lua",
|
||||
"tests": "boost_unit_tests",
|
||||
}
|
||||
|
||||
# the names of the targets in Code::Blocks
|
||||
code_blocks_target_translations = {
|
||||
"wesnoth": "wesnoth",
|
||||
"wesnothd": "wesnothd",
|
||||
"campaignd": "campaignd",
|
||||
"lua": "liblua",
|
||||
"tests": "tests",
|
||||
}
|
||||
|
||||
#=======#
|
||||
# XCode #
|
||||
#=======#
|
||||
|
||||
def modify_xcode(filename, targets, remove):
|
||||
"""Add the given file to the specified targets.
|
||||
"""
|
||||
projectfile = rootdir.joinpath(
|
||||
"projectfiles",
|
||||
"Xcode",
|
||||
"The Battle for Wesnoth.xcodeproj",
|
||||
"project.pbxproj",
|
||||
)
|
||||
|
||||
project = pbxproj.XcodeProject.load(projectfile)
|
||||
|
||||
translated_targets = [item for t in targets for item in xcode_target_translations[t]]
|
||||
translated_targets = list(set(translated_targets))
|
||||
print(" xcode targets:", translated_targets)
|
||||
|
||||
for tname in translated_targets:
|
||||
if not project.get_target_by_name(tname):
|
||||
raise Exception(
|
||||
f"Could not find target '{tname}' in Xcode project file")
|
||||
|
||||
# groups are organized by directory structure under "src"
|
||||
# except for tests, which have a separate root, "tests"
|
||||
if pathlib.Path("tests") in filename.parents:
|
||||
src_groups = project.get_groups_by_name("tests")
|
||||
else:
|
||||
src_groups = project.get_groups_by_name("src")
|
||||
if len(src_groups) != 1:
|
||||
raise Exception("problem finding 'src' group in xcode project")
|
||||
src_group = src_groups[0]
|
||||
parent_group = src_group
|
||||
for d in filename.parts[:-1]:
|
||||
if d == "tests":
|
||||
continue
|
||||
found_groups = project.get_groups_by_name(d, parent=parent_group)
|
||||
if len(found_groups) != 1:
|
||||
groupname = parent_group.get_name()
|
||||
raise Exception(f"problem finding '{d}' group in '{groupname}'")
|
||||
parent_group = found_groups[0]
|
||||
|
||||
if remove :
|
||||
# Remove from all targets if we want to remove
|
||||
for file in project.get_files_by_name(filename.name, parent=parent_group):
|
||||
project.remove_file_by_id(file.get_id())
|
||||
else:
|
||||
# if the group already has an entry with the same filename, loudly skip.
|
||||
# note: this doesn't allow adding to targets one at a time.
|
||||
# a new file should be added to all targets at once...
|
||||
# or maybe targets could be checked somehow,
|
||||
# or maybe the file could simply be completely removed and readded.
|
||||
if project.get_files_by_name(filename.name, parent=parent_group):
|
||||
print(" '"+filename.name+"' already found in Xcode project '"+",".join(translated_targets)+"', skipping")
|
||||
return
|
||||
|
||||
# force is True here because otherwise a duplicate filename in
|
||||
# a different place will block addition of the new file.
|
||||
# the rest is just to match existing project file structure.
|
||||
project.add_file(filename.name,
|
||||
force=True,
|
||||
tree="<group>",
|
||||
parent=parent_group,
|
||||
target_name=translated_targets,
|
||||
)
|
||||
|
||||
# that's done, save the file
|
||||
project.save()
|
||||
return
|
||||
|
||||
#==============#
|
||||
# source_lists #
|
||||
#==============#
|
||||
|
||||
def modify_source_list(filename, source_list, remove):
|
||||
source_list_file = rootdir.joinpath("source_lists", source_list)
|
||||
sl_lines = open(source_list_file).readlines()
|
||||
file_line = filename.as_posix() + '\n'
|
||||
|
||||
# we only need source files in the source_lists, not header files
|
||||
if filename.suffix != ".cpp":
|
||||
return
|
||||
|
||||
if remove:
|
||||
if file_line in sl_lines: sl_lines.remove(file_line)
|
||||
else:
|
||||
# if the target already has an entry with the same filename, loudly skip
|
||||
if file_line in sl_lines:
|
||||
print(f" '{filename}' already found in '{source_list}', skipping")
|
||||
return
|
||||
|
||||
sl_lines.append(file_line)
|
||||
|
||||
sl_lines.sort()
|
||||
open(source_list_file, 'w').writelines(sl_lines)
|
||||
|
||||
def add_to_source_lists(filename, targets):
|
||||
translated_targets = [source_list_target_translations[t] for t in targets]
|
||||
print(" source_list targets:", translated_targets)
|
||||
for t in translated_targets:
|
||||
modify_source_list(filename, t, False)
|
||||
|
||||
def remove_from_source_lists(filename):
|
||||
# remove from all tagerts if -r was specified.
|
||||
for t in source_list_target_translations.values():
|
||||
modify_source_list(filename, t, True)
|
||||
|
||||
#==============#
|
||||
# Code::Blocks #
|
||||
#==============#
|
||||
|
||||
def modify_code_blocks_target(filename, target, remove):
|
||||
cbp_file = rootdir.joinpath(
|
||||
"projectfiles",
|
||||
"CodeBlocks",
|
||||
f"{target}.cbp",
|
||||
)
|
||||
cbp_lines = open(cbp_file).readlines()
|
||||
|
||||
filename_for_cbp = pathlib.PurePath(
|
||||
"..", "..", "src", filename
|
||||
).as_posix()
|
||||
|
||||
elem = f"\t\t<Unit filename=\"{filename_for_cbp}\" />\n"
|
||||
|
||||
if remove:
|
||||
if elem in cbp_lines: cbp_lines.remove(elem)
|
||||
else:
|
||||
# if the target already has an entry with the same filename, loudly skip
|
||||
if elem in cbp_lines:
|
||||
print(f" '{filename}' already found in '{target}.cbp', skipping")
|
||||
return
|
||||
|
||||
# find an appropriate line to add before/after
|
||||
index = 0
|
||||
for line in cbp_lines:
|
||||
if line.startswith("\t\t<Unit "):
|
||||
if elem < line:
|
||||
break
|
||||
elif line.startswith("\t\t<Extensions>"):
|
||||
# we must be the last entry, as this comes after the Unit section
|
||||
break
|
||||
index += 1
|
||||
cbp_lines.insert(index, elem)
|
||||
|
||||
open(cbp_file, 'w').writelines(cbp_lines)
|
||||
|
||||
def modify_code_blocks(filename, targets, remove):
|
||||
translated_targets = code_blocks_target_translations.values() if remove else [code_blocks_target_translations[t] for t in targets]
|
||||
print(" code::blocks targets:", translated_targets)
|
||||
for t in translated_targets:
|
||||
modify_code_blocks_target(filename, t, remove)
|
||||
|
||||
def sanity_check_existing_cpp_hpp(filenames):
|
||||
"""
|
||||
If we're adding a .cpp file, check whether a .hpp should be added too, etc.
|
||||
Only the files named on the command line are added, this exits if the check fails.
|
||||
"""
|
||||
any_check_failed = False
|
||||
for filename in filenames:
|
||||
if filenames.count(filename) > 1:
|
||||
print(f"ERROR: File '{filename}' given multiple times")
|
||||
any_check_failed = True
|
||||
|
||||
if not rootdir.joinpath("src", filename).exists():
|
||||
print(f"WARN: File '{filename}' does not exist")
|
||||
any_check_failed = True
|
||||
|
||||
spouse = None
|
||||
if filename.suffix == ".cpp":
|
||||
spouse = filename.with_suffix(".hpp")
|
||||
elif filename.suffix == ".hpp":
|
||||
spouse = filename.with_suffix(".cpp")
|
||||
|
||||
if rootdir.joinpath("src", spouse).exists() and not filenames.count(spouse):
|
||||
print(f"WARN: Requested to add '{filename}', should '{spouse}' be added too?")
|
||||
any_check_failed = True
|
||||
|
||||
if any_check_failed:
|
||||
break
|
||||
|
||||
if any_check_failed:
|
||||
print("ERROR: Not making changes, as checks failed and --no-checks option was not used.")
|
||||
exit(1)
|
||||
|
||||
def canonicalise_filenames(original_filenames):
|
||||
"""
|
||||
The script supports giving the filenames with or without the "src/" prefix.
|
||||
|
||||
Strip the "src/" if present, functions that need it will add it again later.
|
||||
"""
|
||||
filenames = []
|
||||
|
||||
# If src/src/ exists, the filenames become ambiguous. No need to support that.
|
||||
if rootdir.joinpath("src", "src").exists():
|
||||
print("Please don't add a file or directory called src/src.")
|
||||
exit(1)
|
||||
|
||||
for filename in options.filename:
|
||||
filename = pathlib.PurePath(filename)
|
||||
parts = filename.parts
|
||||
if parts[0] == "src":
|
||||
filename = pathlib.PurePath(*parts[1:])
|
||||
else:
|
||||
filename = pathlib.PurePath(*parts)
|
||||
filenames.append(filename)
|
||||
|
||||
return filenames
|
||||
|
||||
#======#
|
||||
# main #
|
||||
#======#
|
||||
|
||||
if __name__ == "__main__":
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
# a file argument is mandatory
|
||||
ap.add_argument("filename", action="store", nargs="+",
|
||||
help="the .cpp and .hpp files to add")
|
||||
ap.add_argument("--target", action="store", nargs=1,
|
||||
default=["wesnoth"],
|
||||
help="which build targets to add the file to")
|
||||
ap.add_argument("--no-checks", action="store_true",
|
||||
help="do not check whether the files exist, etc")
|
||||
ap.add_argument("-r", "--remove", action="store_true",
|
||||
help="remove the specified files from projectfiles instead of adding them, --target is then ignored")
|
||||
# By default, recognise --help too
|
||||
options = ap.parse_args()
|
||||
|
||||
# Bail out if someone uses the old syntax of "add_source_file src/foo.cpp campaignd"
|
||||
if not options.no_checks:
|
||||
if len(options.filename) == 2 and not options.filename[1].count('.'):
|
||||
print("The usage has changed, targets now need to be given using --target name")
|
||||
exit(1)
|
||||
|
||||
# Convert the names to pathlib.PurePath objects without leading "src/"
|
||||
filenames = canonicalise_filenames(options.filename)
|
||||
|
||||
if not options.no_checks:
|
||||
sanity_check_existing_cpp_hpp(filenames)
|
||||
|
||||
for filename in filenames:
|
||||
if options.remove:
|
||||
print(f"removing '{filename}' from all targets")
|
||||
modify_xcode(filename, options.target, True)
|
||||
remove_from_source_lists(filename)
|
||||
modify_code_blocks(filename, options.target, True)
|
||||
else:
|
||||
print(f"adding '{filename}' to targets: {options.target}")
|
||||
modify_xcode(filename, options.target, False)
|
||||
add_to_source_lists(filename, options.target)
|
||||
modify_code_blocks(filename, options.target, False)
|
25
attic/README
Normal file
|
@ -0,0 +1,25 @@
|
|||
This directory contains old art and resources not currently used anywhere in
|
||||
the game. It should not ship with the distribution tarball.
|
||||
Some notes on specific images and image groups follow:
|
||||
|
||||
scepter_of_fire.png:
|
||||
Old story image of the Scepter, quite large.
|
||||
|
||||
units/thain.png,units/thain2.png:
|
||||
Originally from SoF. 1.3-sized.
|
||||
|
||||
desert-elvish-druid-statue.png, desert-elvish-shyde-statue:
|
||||
Used in older versions of UtBS. 1.3-sized.
|
||||
|
||||
keratur.png:
|
||||
The original image for the uncloaked assassin in UtBS. 1.3-sized.
|
||||
|
||||
spider-lich.png:
|
||||
Old unit image from UtBS.
|
||||
|
||||
clasher-attack-mace.png
|
||||
Orphaned when the Drake Clasher lost this attack.
|
||||
|
||||
units/fire-dragon-flying-*.png
|
||||
Jetryl plans to finish these. See FR #11041.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
This directory contains old art and resources not currently used anywhere in
|
||||
the game. It should not ship with the distribution tarball.
|
||||
Some notes on specific images and image groups follow:
|
||||
|
||||
clasher-attack-mace.png
|
||||
Orphaned when the Drake Clasher lost this attack.
|
||||
|
||||
keratur.png
|
||||
The original image for the uncloaked assassin in UtBS. 1.3-sized.
|
||||
|
||||
perrin.png
|
||||
Originally from THoT. No longer used, removed for GitHub #6602.
|
||||
|
||||
ratheln.png
|
||||
Originally from THoT. No longer used, removed in GitHub #6593.
|
||||
|
||||
righteous-flame-icon.png
|
||||
Originally from THoT. No longer used, removed for GitHub #6602.
|
||||
|
||||
scepter_of_fire.png
|
||||
Old story image of the Scepter, quite large.
|
||||
|
||||
spider-lich.png
|
||||
Old unit image from UtBS.
|
||||
|
||||
thain.png,thain2.png
|
||||
Originally from SoF. 1.3-sized.
|
||||
|
||||
units/fire-dragon-flying-*.png
|
||||
Jetryl plans to finish these. See FR #11041.
|
BIN
attic/abyss2.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
attic/abyssbridge2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
attic/bar-energy-tinygui.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
attic/botleft-corner.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
attic/botright-corner.png
Normal file
After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
attic/compass-north.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
attic/compass-south.png
Normal file
After Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
BIN
attic/desert-elvish-druid-statue.png
Normal file
After Width: | Height: | Size: 691 B |
BIN
attic/desert-elvish-shyde-statue.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
attic/disk.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
attic/football-shadow.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
attic/football.png
Normal file
After Width: | Height: | Size: 419 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
2
attic/maps/README.map
Normal file
|
@ -0,0 +1,2 @@
|
|||
These maps used to live under the campaign directory for The South Guard.
|
||||
They're not used anywhere in it.
|
BIN
attic/missing-image-trans.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
BIN
attic/perrin.png
Before Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 214 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1,014 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 815 B |
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 953 B |
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 250 B |