Cataclysm-DDA: fix build with gcc-12

This commit is contained in:
Đoàn Trần Công Danh 2022-12-04 00:31:25 +07:00
parent 70d906517e
commit 70a3b1dca4
3 changed files with 84 additions and 19 deletions

View File

@ -0,0 +1,37 @@
Index: Cataclysm-DDA-0.E/src/sdltiles.cpp
===================================================================
--- Cataclysm-DDA-0.E.orig/src/sdltiles.cpp
+++ Cataclysm-DDA-0.E/src/sdltiles.cpp
@@ -3246,7 +3246,7 @@ static void font_folder_list( std::ostre
}
// Add font family
- char *fami = TTF_FontFaceFamilyName( fnt.get() );
+ const char *fami = TTF_FontFaceFamilyName( fnt.get() );
if( fami != nullptr ) {
fout << fami;
} else {
@@ -3254,7 +3254,7 @@ static void font_folder_list( std::ostre
}
// Add font style
- char *style = TTF_FontFaceStyleName( fnt.get() );
+ const char *style = TTF_FontFaceStyleName( fnt.get() );
bool isbitmap = ends_with( f, ".fon" );
if( style != nullptr && !isbitmap && strcasecmp( style, "Regular" ) != 0 ) {
fout << " " << style;
@@ -3365,12 +3365,12 @@ static int test_face_size( const std::st
{
const TTF_Font_Ptr fnt( TTF_OpenFontIndex( f.c_str(), size, faceIndex ) );
if( fnt ) {
- char *style = TTF_FontFaceStyleName( fnt.get() );
+ const char *style = TTF_FontFaceStyleName( fnt.get() );
if( style != nullptr ) {
int faces = TTF_FontFaces( fnt.get() );
for( int i = faces - 1; i >= 0; i-- ) {
const TTF_Font_Ptr tf( TTF_OpenFontIndex( f.c_str(), size, i ) );
- char *ts = nullptr;
+ const char *ts = nullptr;
if( tf ) {
if( nullptr != ( ts = TTF_FontFaceStyleName( tf.get() ) ) ) {
if( 0 == strcasecmp( ts, style ) && TTF_FontHeight( tf.get() ) <= size ) {

View File

@ -0,0 +1,13 @@
Index: Cataclysm-DDA-0.E/CMakeLists.txt
===================================================================
--- Cataclysm-DDA-0.E.orig/CMakeLists.txt
+++ Cataclysm-DDA-0.E/CMakeLists.txt
@@ -222,7 +222,7 @@ IF(MSVC)
endif()
ELSE()
SET(CATA_WARNINGS
- "-Werror -Wall -Wextra \
+ "-Wall -Wextra \
-Wformat-signedness \
-Wlogical-op \
-Wmissing-declarations \

View File

@ -13,8 +13,12 @@ short_desc="Turn-based survival game set in a post-apocalyptic world"
maintainer="John <me@johnnynator.dev>"
license="CC-BY-SA-3.0, CC-BY-3.0"
homepage="https://cataclysmdda.org/"
distfiles="https://github.com/CleverRaven/Cataclysm-DDA/archive/${version}.tar.gz"
checksum=b0af9a9292929e17332edcea770bca9a91f1d08ea47726d78a47e09281a42fa3
distfiles="https://github.com/CleverRaven/Cataclysm-DDA/archive/${version}.tar.gz
https://github.com/catchorg/Catch2/releases/download/v2.13.10/catch.hpp"
checksum="b0af9a9292929e17332edcea770bca9a91f1d08ea47726d78a47e09281a42fa3
3725c0f0a75f376a5005dde31ead0feb8f7da7507644c201b814443de8355170"
skip_extraction="catch.hpp"
make_check=no # needs tap++.h
build_options="tiles backtrace"
build_options_default="tiles"
@ -29,26 +33,37 @@ esac
subpackages=""
if [ "$build_option_tiles" ]; then
subpackages+=" Cataclysm-DDA-tiles"
post_configure() {
local cmake_builddir=build-tiles
configure_args+=" -DTILES=ON -DSOUND=ON"
do_configure
}
post_build() {
local cmake_builddir=build-tiles
do_build
}
post_install() {
local cmake_builddir=build-tiles
do_install
}
fi
subpackages+=" Cataclysm-DDA-data"
do_check() {
: #needs tap++.h
post_extract() {
_srcdir="${XBPS_SRCDISTDIR}/${pkgname}-${version}"
cp ${_srcdir}/catch.hpp tests/catch/catch.hpp
}
post_configure() {
if [ "$build_option_tiles" ]; then
local cmake_builddir=build-tiles
local fprefix=$wrksrc/build-tiles/build
CFLAGS="${CFLAGS} -ffile-prefix-map=$fprefix=."
CXXFLAGS="${CXXFLAGS} -ffile-prefix-map=$fprefix=."
configure_args+=" -DTILES=ON -DSOUND=ON"
do_configure
fi
}
post_build() {
if [ "$build_option_tiles" ]; then
local cmake_builddir=build-tiles
do_build
fi
}
post_install() {
if [ "$build_option_tiles" ]; then
local cmake_builddir=build-tiles
do_install
fi
}
Cataclysm-DDA-tiles_package() {