# Copyright 2021-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit autotools toolchain-funcs xdg DESCRIPTION="Cross-platform DOS emulation package." HOMEPAGE="https://dosbox-x.com/" SRC_URI="https://github.com/joncampbell123/dosbox-x/archive/refs/tags/${PN}-v${PV}.tar.gz" S="${WORKDIR}/${PN}-${PN}-v${PV}" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~ppc64 ~x86" IUSE="X debug +dynrec ffmpeg +fluidsynth +freetype +fpu midi mt-32 +opengl printer screenshots slirp unaligned +xbrz" COMMON_DEPEND=" debug? ( sys-libs/ncurses:= ) ffmpeg? ( media-video/ffmpeg ) freetype? ( media-libs/freetype ) fluidsynth? ( media-sound/fluid-soundfont media-sound/fluidsynth:= ) mt-32? ( media-libs/munt-mt32emu ) screenshots? ( media-libs/libpng:= ) X? ( x11-libs/libX11 x11-libs/libXrandr x11-libs/libxkbfile ) media-libs/alsa-lib opengl? ( media-libs/libglvnd[X] ) media-libs/alsa-lib media-libs/libsdl2[X,alsa,opengl?,sound,threads(+),video] media-libs/sdl2-net net-libs/libpcap sys-libs/zlib " DEPEND="${COMMON_DEPEND}" RDEPEND="${COMMON_DEPEND}" BDEPEND=" dev-lang/nasm sys-libs/libcap " pkg_pretend() { if use ffmpeg && use !png; then ewarn "Setting the 'ffmpeg' USE flag when the 'png' USE flag is" ewarn "unset does not have any effect. Unsetting the 'png' USE" ewarn "flag disables the video capture feature, so additional" ewarn "video capture formats enabled by the 'ffmpeg' USE flag" ewarn "will end up being unused." fi } src_prepare() { default # https://bugs.gentoo.org/887669 # Mask lines touching '-O*', and avoid creating an empty command # list as a result to not break 'if', 'for', or functions sed -i -E -e 's/((C|CXX)FLAGS=.*-O)/: \1/' configure.ac || die "Failed to stop configure.ac from touching '-O*' compiler flags" eautoreconf } src_configure() { local fpu_arg='fpu-x86 fpu-x64' if use fpu; then if use x86; then fpu_arg=fpu-x86 elif use amd64; then fpu_arg=fpu-x64 fi fi local myconf=( $(use_enable X x11) $(use_enable debug) $(use_enable dynrec) $(use_enable ffmpeg avcodec) $(use_enable fluidsynth libfluidsynth) $(use_enable fpu "${fpu_arg}") $(use_enable freetype) $(use_enable midi alsa-midi) $(use_enable mt-32 mt32) $(use_enable opengl) $(use_enable printer) $(use_enable screenshots) $(use_enable slirp libslirp) $(use_enable unaligned unaligned-memory) $(use_enable xbrz) --enable-sdl2 ) econf "${myconf[@]}" } src_compile() { # https://bugs.gentoo.org/856352 emake AR="$(tc-getAR)" } pkg_preinst() { xdg_pkg_preinst } pkg_postinst() { xdg_pkg_postinst }