# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit desktop xdg DESCRIPTION="A free-to-win rhythm game (Upstream binary builds, unstable version)" HOMEPAGE="https://osu.ppy.sh/ https://github.com/ppy/osu/" # 2 conditions must be true before this can be uncommented: # - this is the tachyon ebuild # - there is a tachyon release newer than the latest stable (lazer) release # # uncommenting this will use tachyon tagged stuff #tachyon_release="true" if [ -n "$tachyon_release" ]; then # use ${PV} with manual ${PN} for consistency with below SRC_URI=" https://github.com/ppy/osu/releases/download/${PV}-tachyon/osu.AppImage -> osu-lazer-tachyon-bin-${PV}.AppImage " else # match filename with lazer ebuild to reduce duplication SRC_URI=" https://github.com/ppy/osu/releases/download/${PV}-lazer/osu.AppImage -> osu-lazer-bin-${PV}.AppImage " fi # "all-rights-reserved" - ships a copy of proprietary BASS lib - https://www.un4seen.com LICENSE="Apache-2.0 BSD-2 LGPL-2.1 LGPL-3+ MIT all-rights-reserved" # https://github.com/ppy/osu-resources # CC BY-NC 4.0 + fonts # https://github.com/ppy/osu-resources/blob/master/osu.Game.Resources/Fonts/Inter/OFL.txt # https://github.com/ppy/osu-resources/blob/master/osu.Game.Resources/Fonts/Noto/LICENSE.txt - Apache 2.0 # requires commercial license for distribution # https://github.com/ppy/osu-resources/blob/master/osu.Game.Resources/Fonts/Torus-Alternate/LICENCE # https://github.com/ppy/osu-resources/blob/master/osu.Game.Resources/Fonts/Torus/LICENCE # https://github.com/ppy/osu-resources/blob/master/osu.Game.Resources/Fonts/Venera/LICENCE LICENSE+=" CC-BY-NC-4.0 OFL-1.1 Apache-2.0 all-rights-reserved" SLOT="0" KEYWORDS="-* ~amd64" # it would be neat to make this a USE_EXPAND but i could not figure it out # also, both enable and disable is here to allow defaults to go through IUSE="force-wayland osu-sdl3-enable osu-sdl3-disable +telemetry" REQUIRED_USE=" ?? ( osu-sdl3-enable osu-sdl3-disable ) " # from ebuildtester RDEPEND="dev-libs/icu" # do not allow simultaneous installation of non-tachyon and tachyon # releases. while it's possible to have both, usage flow hasn't been thought # out, and constantly switching versions by accident (via desktop # environment search picking things differently sometimes) could cause # issues. RDEPEND="${RDEPEND} !games-arcade/osu-lazer-bin" # because redistribution is not allowed without a commercial license, binary # packages should not exist either RESTRICT="bindist" # also it's an upstream binary we don't have control over, so don't bother RESTRICT+=" binchecks" # let's also not touch the binaries RESTRICT+=" strip" # not source code-based ebuild RESTRICT+=" test" # non-redistributable things too, also no mirrors exist for this repo RESTRICT+=" mirror" # TODO: mimetype icons # TODO: mimetype translation # TODO: fix mimetypes for .osr and .osk not registering(???) unsupported_warning() { elog "AppImages provided by osu!lazer developers can be found at" if [ -n "$tachyon_release" ]; then elog "https://github.com/ppy/osu/releases" # github has no pre-release static direct link AFAIK else elog "https://github.com/ppy/osu/releases/latest" fi elog "" elog "If you're sure or unsure whether an issue is caused by this ebuild, please" elog "report it to https://todo.sr.ht/~jacksonchen666/gentoo-overlay or" elog "https://codeberg.org/jacksonchen666/gentoo-overlay/issues." elog "Namely, any issues related to file associations MUST be reported to" elog "jacksonchen666's ebuilds." if use force-wayland; then elog "" ewarn "You are forcing osu!lazer to use Wayland instead of X11. If you have issues with" ewarn "input handling, window sizing, or more, it's highly recommended to test with" ewarn "the force-wayland USE flag disabled (or using upstream AppImages with no" ewarn "modifications), or note that SDL_VIDEODRIVER='wayland' was used when" ewarn "bug reporting." fi if [ -n "$tachyon_release" ]; then elog "" ewarn "A Tachyon release is being installed. This can potentially be unstable." fi } pkg_pretend() { unsupported_warning } src_unpack() { if [ -n "$tachyon_release" ]; then cp "${DISTDIR}/${P}.AppImage" "${WORKDIR}" || \ die "can't copy sources" else # has lazer distfile name compatibility (to reduce duplication) cp "${DISTDIR}/osu-lazer-bin-${PV}.AppImage" "${WORKDIR}/${P}.AppImage" || \ die "can't copy sources" fi chmod +x "${WORKDIR}/${P}.AppImage" || die "couldn't make appimage executable" "${WORKDIR}/${P}.AppImage" --appimage-extract || die "couldn't extract appimage" mv squashfs-root "${S}" || die "couldn't rename extracted" } src_compile() { #cd "${S}" || die mkdir opt/ || die mv "usr/bin" "opt/${P}" || die # rename for clarity sed -i 's~^Name=.*~Name=osu!(lazer)~' osu\!.desktop || die "sed for .desktop name failed" # wrapper # probably not supported by devs cp "${FILESDIR}/allcommented-osu-lazer-bin" "./osu-lazer-bin" || die "cp failed" if use force-wayland; then # essentially uncomment sed -i -E -e 's/^#(.*)(SDL_VIDEODRIVER)/\1\2/' "./osu-lazer-bin" || die "sed for wrapper failed" fi # enable and disable exists to allow not specifying anything to allow # defaults if use osu-sdl3-enable || use osu-sdl3-disable; then sed -i -E -e 's/^#(.*)(OSU_SDL3)/\1\2/' "./osu-lazer-bin" || die "sed for wrapper failed" fi if use osu-sdl3-enable; then sed -i -E -e 's/%SDL3_VALUE%/1/' "./osu-lazer-bin" || die "sed for wrapper failed" elif use osu-sdl3-disable; then sed -i -E -e 's/%SDL3_VALUE%/0/' "./osu-lazer-bin" || die "sed for wrapper failed" fi # disabling telemetry if ! use telemetry; then sed -i -E -e 's/^#(.*)(OSU_DISABLE_ERROR_REPORTING)/\1\2/' "./osu-lazer-bin" || die "sed for wrapper failed" fi sed -i -e "s/%P%/${P}/" "osu-lazer-bin" || die "sed for wrapper failed" chmod +x osu-lazer-bin || die "chmod failed" sed -i "s~^Exec=.*~Exec=/usr/bin/osu-lazer-bin %u~" osu\!.desktop || die "sed for .desktop exec failed" } src_install() { # wrapper dobin osu-lazer-bin # actual binaries and libraries and etc. insinto /usr/share/icons/ doins -r "usr/share/icons/hicolor/" insinto /opt/ doins -r "opt/${P}/" # (custom in-house) file extension association insinto /usr/share/mime/packages/ doins "${FILESDIR}/osu-lazer.xml" # does not match upstream with a bunch of executable .dll files (some # excluded), which is probably done by dotnet fperms 0755 "/opt/${P}/osu!" domenu osu\!.desktop } pkg_postinst() { xdg_pkg_postinst unsupported_warning }