# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit cmake desktop xdg flag-o-matic DESCRIPTION="A modder-friendly OpenGL source port based on the DOOM engine" HOMEPAGE="https://zdoom.org" SRC_URI="https://github.com/coelckers/${PN}/archive/g${PV}.tar.gz -> ${P}.tar.gz" LICENSE="Apache-2.0 BSD BZIP2 GPL-3 LGPL-2.1+ LGPL-3 MIT non-free? ( Activision ChexQuest3 DOOM-COLLECTORS-EDITION freedist WidePix )" SLOT="0" KEYWORDS="~amd64 ~arm64" IUSE="debug gles2 gtk +non-free openmp +swr telemetry vulkan" DEPEND=" app-arch/bzip2 media-libs/libjpeg-turbo:0= media-libs/libsdl2[gles2?,opengl,vulkan?] media-libs/libvpx:= media-libs/openal media-libs/zmusic sys-libs/zlib gtk? ( x11-libs/gtk+:3 )" RDEPEND="${DEPEND}" S="${WORKDIR}/${PN}-g${PV}" PATCHES=( "${FILESDIR}"/${PN}-4.7.1-Introduce-the-BUILD_NONFREE-option.patch "${FILESDIR}"/0018-indicate-in-the-startup-window-title-when-GZDoom-is-.patch "${FILESDIR}"/0002-Fix-PMapValueReader-warning-on-Clang-GCC.patch "${FILESDIR}"/0020-new-characters-for-Doom-s-SmallFont-and-BigFont.patch "${FILESDIR}"/0032-Mark-const-methods-as-const-in-pseudo-generics.patch "${FILESDIR}"/0013-fixed-buffer-size-checks-for-raw-textures.patch "${FILESDIR}"/0005-fixed-GC-FullGC-not-collecting-everything-anymore.patch "${FILESDIR}"/0016-Fix-MapIterator-X-String-GetValue.patch "${FILESDIR}"/0037-Update-service.zs.patch "${FILESDIR}"/0004-fixed-some-bad-character-offsets-in-Doom-s-and-Raven.patch "${FILESDIR}"/0009-Error-out-instead-of-crashing-for-vector-out-variabl.patch "${FILESDIR}"/0012-Prevent-important-messages-from-being-accidentally-f.patch "${FILESDIR}"/0007-Fixed-IsActorPlayingSound-s-default-argument.patch "${FILESDIR}"/0030-Fixed-a-bug-where-calling-an-invalid-virtual-functio.patch "${FILESDIR}"/0001-Add-casts-to-F32-Map-MapIterator-functions-to-get-ri.patch "${FILESDIR}"/0042-Use-simpler-constructor-for-TArray-in-FBlockThingsIt.patch "${FILESDIR}"/0044-updated-RapidJson-library.patch "${FILESDIR}"/0023-convert-characters-to-Doom-patch-format.patch "${FILESDIR}"/0026-Add-Missing-Read-Barriers-to-Map-Get-Functions.patch "${FILESDIR}"/0049-Fix-BUILD_SHARED_LIBS-build-option-on-Windows.patch "${FILESDIR}"/0036-fixed-typo-in-string-label.patch "${FILESDIR}"/0043-Fix-possible-memory-corruption-in-TArray-Delete-inde.patch "${FILESDIR}"/0021-4-non-letter-characters-for-Chex.patch "${FILESDIR}"/0045-made-D_WriteUserInfoStrings-memory-safe.patch "${FILESDIR}"/0010-Fix-StripLeftRight.patch "${FILESDIR}"/0024-Mark-non-modifying-map-functions-as-const.patch "${FILESDIR}"/0038-Allow-GAMEINFO-LOAD-to-load-directories.patch "${FILESDIR}"/0011-Fixed-custom-height-and-width-not-saving.patch "${FILESDIR}"/0033-Fixing-GLES-mode-to-work-on-real-GLES-hardware-and-O.patch "${FILESDIR}"/0047-backported-RapidJSON-fix-from-Raze.patch "${FILESDIR}"/0028-refactor-add-some-logs-to-help-understand-what-is-ha.patch "${FILESDIR}"/0027-cleanup-of-the-Chex-Quest-small-font.patch "${FILESDIR}"/0015-Fixed-a-bug-where-static-events-would-fail-to-halt-p.patch "${FILESDIR}"/0046-avoid-arithmetics-with-literal-null-pointers-in-Pars.patch "${FILESDIR}"/0040-Fixed-incorrect-parameter-type-in-A_CheckForResurrec.patch "${FILESDIR}"/0025-Fix-iterator-invalidation-for-Map-Get.patch "${FILESDIR}"/0014-Impel-people-to-include-demo-mods-in-bug-reports.patch "${FILESDIR}"/0029-Added-check-for-invalid-class-on-in-VM-instantiation.patch "${FILESDIR}"/0017-Fix-two-different-portable-names.patch "${FILESDIR}"/0008-removed-clangformat-from-discord-rpc.patch "${FILESDIR}"/0050-Add-missing-include-guards.patch "${FILESDIR}"/0006-Fix-wrong-assumptions-about-actor-initialization-in-.patch "${FILESDIR}"/0034-Fix-Software-Slope-Rendering-for-non-1.2-pixel-ratio.patch "${FILESDIR}"/0035-Improve-Services.patch "${FILESDIR}"/0031-GLES-Fix-first-wipe.patch "${FILESDIR}"/0048-Fix-value-of-X-Y-when-Y-is-an-int-constant.patch "${FILESDIR}"/0003-Fix-Quicksave-Rotation.patch "${FILESDIR}"/0039-fixed-bad-character-offset.patch "${FILESDIR}"/0041-Fix-TArray-allocating-0-bytes-in-constructor.patch "${FILESDIR}"/0019-alt-HUD-use-NewSmallFont-for-drawing-player-s-coordi.patch "${FILESDIR}"/0051-Update-service.zs.patch "${FILESDIR}"/0022-Fixed-global-TerrainDef-array-not-being-exported-cor.patch ) src_prepare() { rm -rf docs/licenses || die rm -rf libraries/{bzip2,jpeg,zlib} || die if ! use non-free ; then rm -rf wadsrc_bm wadsrc_extra wadsrc_widepix || die fi cmake_src_prepare } src_configure() { # https://bugs.gentoo.org/858749 filter-lto append-flags -fno-strict-aliasing local mycmakeargs=( -DBUILD_SHARED_LIBS=OFF -DINSTALL_DOCS_PATH="${EPREFIX}/usr/share/doc/${PF}" -DINSTALL_PK3_PATH="${EPREFIX}/usr/share/doom" -DINSTALL_SOUNDFONT_PATH="${EPREFIX}/usr/share/doom" -DDYN_OPENAL=OFF -DNO_GTK="$(usex !gtk)" -DNO_OPENAL=OFF -DHAVE_VULKAN="$(usex vulkan)" -DHAVE_GLES2="$(usex gles2)" -DNO_OPENMP="$(usex !openmp)" -DZDOOM_ENABLE_SWR="$(usex swr)" -DBUILD_NONFREE="$(usex non-free)" ) use debug || append-cppflags -DNDEBUG use telemetry || append-cppflags -DNO_SEND_STATS cmake_src_configure } src_install() { newicon src/posix/zdoom.xpm "${PN}.xpm" make_desktop_entry "${PN}" "GZDoom" "${PN}" "Game;ActionGame" cmake_src_install } pkg_postinst() { xdg_pkg_postinst if ! use non-free ; then ewarn ewarn "GZDoom installed without non-free components." ewarn "Note: The non-free game_support.pk3 file is needed to play" ewarn " games natively supported by GZDoom." ewarn "A list of games natively supported by GZDoom is available" ewarn "on the ZDoom wiki: https://zdoom.org/wiki/IWAD" ewarn fi }