gentoo-overlay/app-emulation/em400/em400-1.0.1.ebuild

95 lines
2.4 KiB
Shell

# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake desktop flag-o-matic xdg
DESCRIPTION="Emulator of the Polish MERA-400 minicomputer"
HOMEPAGE="
https://em400.pl/
https://github.com/jakubfi/em400
"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/jakubfi/em400.git"
else
SRC_URI="https://github.com/jakubfi/em400/archive/refs/tags/release-${PV}.tar.gz
-> ${P}.tar.gz"
S="${WORKDIR}/${PN}-release-${PV}"
KEYWORDS="~amd64"
fi
# GPL-2+ for em400 itself, MIT for the bundled iniparser, public domain or
# MIT-0 for the bundled miniaudio.
LICENSE="GPL-2+ MIT || ( public-domain MIT-0 )"
SLOT="0"
IUSE="+qt6"
# emcrk 0.2 added a mode argument to r40_to_ascii(), which the Qt debugger
# views still call the old way. Lift the bound once upstream catches up.
# Sound goes through the bundled miniaudio, which loads the PulseAudio, ALSA
# or JACK library at run time.
RDEPEND="
>=dev-libs/emawp-3.0:=
<dev-libs/emcrk-0.2:=
dev-libs/emdas:=
dev-libs/libuv:=
qt6? (
dev-qt/qtbase:6[gui,network,widgets]
dev-qt/qtmultimedia:6
)
"
DEPEND="${RDEPEND}"
# The expression parser needs bison's "parse.error custom", new in 3.6.
BDEPEND="
>=sys-devel/bison-3.6
sys-devel/flex
virtual/pkgconfig
qt6? ( dev-qt/qttools:6[linguist] )
"
src_prepare() {
# Upstream turns LTO on whenever the compiler supports it; leave that to
# the user's flags.
sed -i -e 's/^check_ipo_supported(.*/set(IPO_SUPPORTED OFF)/' \
CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
# Upstream silences qDebug() in the Release configuration only.
use qt6 && append-cppflags -DQT_NO_DEBUG_OUTPUT
# Qt is looked for without REQUIRED; without it only the command line
# interface (-u cmd) is built.
local mycmakeargs=(
-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=$(usex !qt6 ON OFF)
)
cmake_src_configure
}
# The menu entry and the icons are only packaged into the AppImage upstream.
src_install() {
cmake_src_install
if use qt6; then
domenu packaging/em400.desktop
local size
for size in 16 22 32 48 64 96 128 256 512; do
newicon -s ${size} src/ui/qt6/icons/em400/em400_${size}.png \
em400.png
done
fi
}
pkg_postinst() {
use qt6 && xdg_pkg_postinst
elog "On its first run em400 writes the default configuration to"
elog "\${XDG_CONFIG_HOME:-~/.config}/em400/em400.ini, importing the machine"
elog "setup from an old ~/.em400/em400.ini if there is one."
}