From 70a3b1dca48a9f10110b2b2807054b4d2c1693b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 4 Dec 2022 00:31:25 +0700 Subject: [PATCH] Cataclysm-DDA: fix build with gcc-12 --- srcpkgs/Cataclysm-DDA/patches/gcc-12.patch | 37 +++++++++++++++++ srcpkgs/Cataclysm-DDA/patches/no-werror.patch | 13 ++++++ srcpkgs/Cataclysm-DDA/template | 41 +++++++++++++------ 3 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 srcpkgs/Cataclysm-DDA/patches/gcc-12.patch create mode 100644 srcpkgs/Cataclysm-DDA/patches/no-werror.patch diff --git a/srcpkgs/Cataclysm-DDA/patches/gcc-12.patch b/srcpkgs/Cataclysm-DDA/patches/gcc-12.patch new file mode 100644 index 000000000000..06d4e855d6fc --- /dev/null +++ b/srcpkgs/Cataclysm-DDA/patches/gcc-12.patch @@ -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 ) { diff --git a/srcpkgs/Cataclysm-DDA/patches/no-werror.patch b/srcpkgs/Cataclysm-DDA/patches/no-werror.patch new file mode 100644 index 000000000000..2855c96db62c --- /dev/null +++ b/srcpkgs/Cataclysm-DDA/patches/no-werror.patch @@ -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 \ diff --git a/srcpkgs/Cataclysm-DDA/template b/srcpkgs/Cataclysm-DDA/template index bbe66b9f29b9..b5044e01f092 100644 --- a/srcpkgs/Cataclysm-DDA/template +++ b/srcpkgs/Cataclysm-DDA/template @@ -13,8 +13,12 @@ short_desc="Turn-based survival game set in a post-apocalyptic world" maintainer="John " 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() { +fi +subpackages+=" Cataclysm-DDA-data" + +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() { +post_build() { + if [ "$build_option_tiles" ]; then local cmake_builddir=build-tiles do_build - } + fi +} - post_install() { +post_install() { + if [ "$build_option_tiles" ]; then local cmake_builddir=build-tiles do_install - } -fi -subpackages+=" Cataclysm-DDA-data" - -do_check() { - : #needs tap++.h + fi } Cataclysm-DDA-tiles_package() {