Skip to content

Commit 1640b89

Browse files
committed
Merge branch 'master' into for-0.56.0/sync
2 parents d55fd59 + ed4ffa8 commit 1640b89

File tree

16 files changed

+167
-180
lines changed

16 files changed

+167
-180
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,18 @@ endif()
725725

726726
# SDL, required for all targets on win32 because of iconv and SDL_SetHint(SDL_TIMER_RESOLUTION, 0)
727727
if (BUILD_CLIENT OR WIN32)
728+
# Use our detected architecture instead of letting SDL do it again
729+
# Note that sdlcpu.cmake is only included on a random subset of platforms
730+
set(sdlvar_i686 SDL_CPU_X86)
731+
set(sdlvar_amd64 SDL_CPU_X64)
732+
set(sdlvar_armhf SDL_CPU_ARM32)
733+
set(sdlvar_arm64 SDL_CPU_ARM64)
734+
if (sdlvar_${ARCH})
735+
set(${sdlvar_${ARCH}} 1)
736+
else()
737+
message("Developer TODO: translate architecture ${ARCH} for SDL")
738+
endif()
739+
728740
find_package(SDL3 REQUIRED CONFIG)
729741

730742
if (WIN32)

external_deps/build.sh

Lines changed: 92 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -93,38 +93,44 @@ log() {
9393
# Extract an archive into the given subdirectory of the build dir and cd to it
9494
# Usage: extract <filename> <directory>
9595
extract() {
96-
rm -rf "${2}"
97-
mkdir -p "${2}"
98-
case "${1}" in
96+
local archive_file="${1}"; shift
97+
local extract_dir="${1}"; shift
98+
99+
local archive_name="$(basename "${archive_file}")"
100+
log STATUS "Extracting ${archive_name}"
101+
102+
rm -rf "${extract_dir}"
103+
mkdir -p "${extract_dir}"
104+
case "${archive_file}" in
99105
*.tar.bz2)
100-
tar xjf "${1}" -C "${2}"
106+
tar xjf "${archive_file}" -C "${extract_dir}"
101107
;;
102108
*.tar.xz)
103-
tar xJf "${1}" -C "${2}"
109+
tar xJf "${archive_file}" -C "${extract_dir}"
104110
;;
105111
*.tar.gz|*.tgz)
106-
tar xzf "${1}" -C "${2}"
112+
tar xzf "${archive_file}" -C "${extract_dir}"
107113
;;
108114
*.zip)
109-
unzip -d "${2}" "${1}"
115+
unzip -d "${extract_dir}" "${archive_file}"
110116
;;
111117
*.cygtar.bz2)
112118
# Some Windows NaCl SDK packages have incorrect symlinks, so use
113119
# cygtar to extract them.
114-
"${SCRIPT_DIR}/cygtar.py" -xjf "${1}" -C "${2}"
120+
"${SCRIPT_DIR}/cygtar.py" -xjf "${archive_file}" -C "${extract_dir}"
115121
;;
116122
*.dmg)
117123
local dmg_temp_dir="$(mktemp -d)"
118-
hdiutil attach -mountpoint "${dmg_temp_dir}" "${1}"
119-
cp -R "${dmg_temp_dir}/"* "${2}/"
124+
hdiutil attach -mountpoint "${dmg_temp_dir}" "${archive_file}"
125+
cp -R "${dmg_temp_dir}/"* "${extract_dir}/"
120126
hdiutil detach "${dmg_temp_dir}"
121127
rmdir "${dmg_temp_dir}"
122128
;;
123129
*)
124-
log ERROR "Unknown archive type for ${1}"
130+
log ERROR "Unknown archive type for ${archive_name}"
125131
;;
126132
esac
127-
cd "${2}"
133+
cd "${extract_dir}"
128134
}
129135

130136
download() {
@@ -1110,7 +1116,7 @@ build_depcheck() {
11101116
for dll in $(find "${PREFIX}/bin" -type f -name '*.dll'); do
11111117
# https://wiki.unvanquished.net/wiki/MinGW#Built-in_DLL_dependencies
11121118
if objdump -p "${dll}" | grep -oP '(?<=DLL Name: )(libgcc_s|libstdc|libssp|libwinpthread).*'; then
1113-
echo "${dll} depends on above DLLs"
1119+
log WARNING "${dll} depends on above DLLs"
11141120
good=false
11151121
fi
11161122
done
@@ -1163,14 +1169,20 @@ build_genlib() {
11631169
esac
11641170
}
11651171

1172+
build() {
1173+
for pkg in "${@}"
1174+
do
1175+
cd "${WORK_DIR}"
1176+
log STATUS "Processing target '${pkg}' for ${PLATFORM}"
1177+
"build_${pkg}"
1178+
done
1179+
}
1180+
11661181
list_build() {
11671182
local list_name="${1}"
11681183
local package_list
11691184
eval "package_list=(\${${list_name}_${PLATFORM//-/_}_packages})"
1170-
for pkg in "${package_list[@]}"; do
1171-
cd "${WORK_DIR}"
1172-
"build_${pkg}"
1173-
done
1185+
build "${package_list[@]}"
11741186
}
11751187

11761188
build_base() {
@@ -1454,69 +1466,79 @@ all_linux_arm64_default_packages='zlib gmp nettle curl sdl3 glew png jpeg webp o
14541466
base_linux_armhf_default_packages="${base_linux_arm64_default_packages}"
14551467
all_linux_armhf_default_packages="${all_linux_arm64_default_packages}"
14561468

1457-
linux_build_platforms='linux-amd64-default linux-arm64-default linux-armhf-default linux-i686-default windows-amd64-mingw windows-amd64-msvc windows-i686-mingw windows-i686-msvc'
1458-
macos_build_platforms='macos-amd64-default'
1459-
all_platforms="$(echo ${linux_build_platforms} ${macos_build_platforms} | tr ' ' '\n' | sort -u | xargs echo)"
1469+
all_linux_platforms='linux-amd64-default linux-arm64-default linux-armhf-default linux-i686-default'
1470+
all_windows_platforms='windows-amd64-mingw windows-amd64-msvc windows-i686-mingw windows-i686-msvc'
1471+
all_macos_platforms='macos-amd64-default'
1472+
all_platforms="${all_linux_platforms} ${all_windows_platforms} ${all_macos_platforms}"
14601473

1461-
errorHelp() {
1462-
sed -e 's/\\t/'$'\t''/g' <<-EOF
1463-
usage: $(basename "${BASH_SOURCE[0]}") [OPTION] <PLATFORM> <PACKAGE[S]...>
1474+
printHelp() {
1475+
# Please align to 4-space tabs.
1476+
cat >&2 <<-EOF
1477+
usage: $(basename "${BASH_SOURCE[0]}") [OPTION] <PLATFORM> <PACKAGE(S)...>
14641478
14651479
Script to build dependencies for platforms which do not provide them
14661480
14671481
Options:
1468-
\t--download-only only download source packages, do not build them
1469-
\t--prefer-ours attempt to download from unvanquished.net first
1482+
--download-only only download source packages, do not build them
1483+
--prefer-ours attempt to download from unvanquished.net first
14701484
14711485
Platforms:
1472-
\t${all_platforms}
1486+
${all_platforms}
14731487
14741488
Virtual platforms:
1475-
\tall: all platforms
1476-
\tbuild-linux — platforms buildable on linux: ${linux_build_platforms}
1477-
\tbuild-macos — platforms buildable on macos: ${macos_build_platforms}
1489+
linux ${all_linux_platforms}
1490+
windows ${all_windows_platforms}
1491+
macos ${all_macos_platforms}
1492+
all linux windows macos
14781493
14791494
Packages:
1480-
\tpkgconfig nasm zlib gmp nettle curl sdl3 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk wasisdk wasmtime
1495+
pkgconfig nasm zlib gmp nettle curl sdl3 glew png jpeg webp openal ogg vorbis opus opusfile naclsdk wasisdk wasmtime
14811496
14821497
Virtual packages:
1483-
\tbase — build packages for pre-built binaries to be downloaded when building the game
1484-
\tall — build all supported packages that can possibly be involved in building the game
1485-
\tinstall — create a stripped down version of the built packages that CMake can use
1486-
\tpackage — create a zip/tarball of the dependencies so they can be distributed
1487-
\twipe — remove products of build process, excepting download cache but INCLUDING installed files. Must be last
1498+
base build packages for pre-built binaries to be downloaded when building the game
1499+
all build all supported packages that can possibly be involved in building the game
1500+
install create a stripped down version of the built packages that CMake can use
1501+
package create a tarball of the dependencies so they can be distributed
1502+
wipe remove products of build process, excepting download cache but INCLUDING installed files. Must be last
14881503
14891504
Packages required for each platform:
14901505
14911506
windows-amd64-msvc:
14921507
windows-i686-msvc:
1493-
\tbase: ${base_windows_amd64_msvc_packages}
1494-
\tall: same
1508+
base ${base_windows_amd64_msvc_packages}
1509+
all same
14951510
14961511
windows-amd64-mingw:
14971512
windows-i686-mingw:
1498-
\tbase: ${base_windows_amd64_mingw_packages}
1499-
\tall: same
1513+
base ${base_windows_amd64_mingw_packages}
1514+
all same
15001515
15011516
macos-amd64-default:
1502-
\tbase: ${base_macos_amd64_default_packages}
1503-
\tall: same
1517+
base ${base_macos_amd64_default_packages}
1518+
all same
15041519
15051520
linux-amd64-default:
1506-
\tbase: ${base_linux_amd64_default_packages}
1507-
\tall: ${all_linux_amd64_default_packages}
1521+
base ${base_linux_amd64_default_packages}
1522+
all ${all_linux_amd64_default_packages}
15081523
15091524
linux-i686-default:
1510-
\tbase: ${base_linux_i686_default_packages}
1511-
\tall: ${all_linux_i686_default_packages}
1525+
base ${base_linux_i686_default_packages}
1526+
all ${all_linux_i686_default_packages}
15121527
15131528
linux-arm64-default:
15141529
linux-armhf-default:
1515-
\tbase: ${base_linux_arm64_default_packages}
1516-
\tall: ${all_linux_arm64_default_packages}
1530+
base ${base_linux_arm64_default_packages}
1531+
all ${all_linux_arm64_default_packages}
15171532
15181533
EOF
1519-
false
1534+
1535+
exit
1536+
}
1537+
1538+
syntaxError() {
1539+
log ERROR "${1}" || true
1540+
echo >&2
1541+
printHelp
15201542
}
15211543

15221544
download_only='false'
@@ -1537,17 +1559,24 @@ do
15371559
require_theirs='true'
15381560
shift
15391561
;;
1540-
'--'*)
1541-
helpError
1562+
'-h'|'--help')
1563+
printHelp
1564+
;;
1565+
'-'*)
1566+
syntaxError 'Unknown option'
15421567
;;
15431568
*)
15441569
break
15451570
esac
15461571
done
15471572

15481573
# Usage
1549-
if [ "${#}" -lt "2" ]; then
1550-
errorHelp
1574+
if [ "${#}" -lt "1" ]
1575+
then
1576+
syntaxError 'Missing platform and package(s)'
1577+
elif [ "${#}" -lt "2" ]
1578+
then
1579+
syntaxError 'Missing package(s)'
15511580
fi
15521581

15531582
# Do not reuse self-built curl from external_deps custom PATH
@@ -1556,9 +1585,9 @@ fi
15561585
CURL="$(command -v curl)" || log ERROR "Command 'curl' not found"
15571586

15581587
# Enable parallel build
1559-
export MAKEFLAGS="-j`nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1`"
1588+
export CMAKE_BUILD_PARALLEL_LEVEL="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)"
1589+
export MAKEFLAGS="-j${CMAKE_BUILD_PARALLEL_LEVEL}"
15601590
export SCONSFLAGS="${MAKEFLAGS}"
1561-
export CMAKE_BUILD_PARALLEL_LEVEL="$(nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1)"
15621591

15631592
# Setup platform
15641593
platform="${1}"; shift
@@ -1568,11 +1597,14 @@ case "${platform}" in
15681597
'all')
15691598
platform_list="${all_platforms}"
15701599
;;
1571-
'build-linux')
1572-
platform_list="${linux_build_platforms}"
1600+
'linux')
1601+
platform_list="${all_linux_platforms}"
1602+
;;
1603+
'windows')
1604+
platform_list="${all_windows_platforms}"
15731605
;;
1574-
'build-macos')
1575-
platform_list="${macos_build_platforms}"
1606+
'macos')
1607+
platform_list="${all_macos_platforms}"
15761608
;;
15771609
*)
15781610
for known_platform in ${all_platforms}
@@ -1585,18 +1617,13 @@ case "${platform}" in
15851617
done
15861618
if [ -z "${platform_list}" ]
15871619
then
1588-
errorHelp
1620+
syntaxError 'Unknown platform'
15891621
fi
15901622
;;
15911623
esac
15921624

15931625
for PLATFORM in ${platform_list}
15941626
do (
15951627
"setup_${PLATFORM}"
1596-
1597-
# Build packages
1598-
for pkg in "${@}"; do
1599-
cd "${WORK_DIR}"
1600-
"build_${pkg}"
1601-
done
1628+
build "${@}"
16021629
) done

src/engine/client/ClientApplication.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ class ClientApplication : public Application {
8080
}
8181

8282
void Initialize() override {
83-
#if defined(__linux__) && defined(BUILD_GRAPHICAL_CLIENT)
84-
// identify the game by its name in certain
85-
// volume control / power control applets,
86-
// for example, the one found on KDE:
87-
// "Unvanquished is currently blocking sleep."
88-
// instead of "My SDL application ..."
89-
// this feature was introduced in SDL 2.0.22
90-
SDL_SetHint("SDL_APP_NAME", PRODUCT_NAME);
91-
// SDL_hints.h: #define SDL_HINT_APP_NAME "SDL_APP_NAME"
92-
// don't use the macro here, in case
93-
// SDL doesn't use current headers.
94-
#endif
95-
9683
Hunk_Init();
9784

9885
Com_Init();

src/engine/client/cl_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ static void CL_LoadRSAKeys()
13871387

13881388
if ( !f || len < 1 )
13891389
{
1390-
Log::Notice( "^2%s", "Daemon RSA public-key file not found, regenerating\n" );
1390+
Log::Notice( "^2Daemon RSA public-key file not found, regenerating" );
13911391
CL_GenerateRSAKeys( fileName );
13921392
return;
13931393
}

src/engine/framework/Resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ namespace Resource {
209209
Manager<T>::Manager(Str::StringRef defaultName): inRegistration(false), immediate(false) {
210210
defaultValue = RegisterInternal(defaultName);
211211
if (not defaultValue) {
212-
Sys::Error("Couldn't load the default resource for %s\n", typeid(T).name());
212+
Sys::Error("Couldn't load the default resource for %s", typeid(T).name());
213213
}
214214
}
215215

src/engine/qcommon/crypto.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2727
#include "q_shared.h"
2828
#include "qcommon.h"
2929

30+
/* The Nettle headers include the GMP header, this disables the warning
31+
on GMP alone, not the whole Nettle. We don't use GMP directly ourselves. */
32+
#if defined(_MSC_VER)
3033
#pragma warning(push)
3134
#pragma warning(disable : 4146) // "unary minus operator applied to unsigned type, result still unsigned"
3235
#include <gmp.h>
3336
#pragma warning(pop)
37+
#endif
3438

3539
#include <nettle/bignum.h>
3640
#include <nettle/rsa.h>

src/engine/qcommon/files.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ bool FS_LoadServerPaks(const char* paks, bool isDemo)
722722
Cmd::Args extrapaks(fs_extrapaks.Get());
723723
for (auto& x: extrapaks) {
724724
if (!FS_LoadPak(x))
725-
Sys::Error("Could not load extra pak '%s'\n", x.c_str());
725+
Sys::Error("Could not load extra pak '%s'", x.c_str());
726726
}
727727
}
728728

src/engine/renderer/Material.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,12 @@ void MaterialSystem::AddStage( MaterialSurface* surface, shaderStage_t* pStage,
13601360
continue;
13611361
}
13621362

1363+
if ( pStage->shader->reliefDepthScale != pStage2->shader->reliefDepthScale
1364+
|| pStage->shader->reliefOffsetBias != pStage2->shader->reliefOffsetBias )
1365+
{
1366+
continue;
1367+
}
1368+
13631369
if ( pStage->refractionIndexExp != pStage2->refractionIndexExp || pStage->specularExponentMin != pStage2->specularExponentMin
13641370
|| pStage->specularExponentMax != pStage2->specularExponentMax || pStage->fresnelPowerExp != pStage2->fresnelPowerExp
13651371
|| pStage->fresnelScaleExp != pStage2->fresnelScaleExp || pStage->fresnelBiasExp != pStage2->fresnelBiasExp

src/engine/renderer/Material.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ struct Material {
155155
std::vector<Texture*> textures;
156156

157157
bool operator==( const Material& other ) {
158-
if ( r_materialSeparatePerShader.Get() )
159-
{
160-
return refStage == other.refStage;
161-
}
162-
163158
return program == other.program && stateBits == other.stateBits
164159
&& fog == other.fog && cullType == other.cullType && usePolygonOffset == other.usePolygonOffset;
165160
}

0 commit comments

Comments
 (0)