# Contributor: knuxify # Contributor: Dominika Liberda # Maintainer: knuxify pkgname=osu pkgver=2022.405.0 pkgrel=0 _runtime_ver=3.16 _realmver=10.11.1 # https://github.com/realm/realm-dotnet/releases _realmcorever=11.13.0 # https://github.com/realm/realm-core/tags # Taken from dotnet6-build APKBUILD _get_arch() { case $1 in x86_64) local arch=x64;; aarch64) local arch=arm64;; armv7|armhf) local arch=arm;; esac echo $arch } _dotnet_arch=$(_get_arch $CARCH) pkgdesc="rhythm is just a *click* away!" url="https://osu.ppy.sh" arch="x86_64" # others blocked by badly linked libraries or missing dotnet6 license="MIT AND CC-BY-NC-4.0 AND proprietary" depends=" dotnet6-apphost-pack dotnet6-runtime alsa-lib-dev sdl2 stbi-sharp $pkgname-data " makedepends="dotnet6-sdk bash cmake flex-dev libuv-dev lld openssl-dev zlib-dev " install="$pkgname.pre-install" source="osu-lazer-$pkgver.tar.gz::https://github.com/ppy/osu/archive/refs/tags/$pkgver.tar.gz realm-dotnet-$_realmver.tar.gz::https://github.com/realm/realm-dotnet/archive/refs/tags/$_realmver.tar.gz realm-core-$_realmcorever.tar.gz::https://github.com/realm/realm-core/archive/refs/tags/v$_realmcorever.tar.gz osu-launcher osu-lazer.desktop x-osu-lazer.xml " subpackages="$pkgname-lang $pkgname-data::noarch" builddir="$srcdir/osu-$pkgver" options="!check" # requires the game to be build in debug mode? todo build() { # Build realm-dotnet wrapper lib cd "$srcdir"/realm-dotnet-$_realmver/wrappers rm -r realm-core mv "$srcdir"/realm-core-$_realmcorever realm-core # Apply build hacks; these would probably be better off as a patch but I'm lazy sed -i 's/dev_t/uint_fast64_t/g' realm-core/src/realm/util/file.hpp sed -i 's/dev_t/uint_fast64_t/g' realm-core/src/realm/util/file_mapper.cpp sed -i 's/dev_t/uint_fast64_t/g' realm-core/src/realm/util/file.cpp sed -i 's/#if REALM_PLATFORM_APPLE || (defined(__linux__) && \!REALM_ANDROID)/\#if 0/' realm-core/src/realm/util/backtrace.cpp sed -i 's/\#if (defined _GNU_SOURCE && !REALM_ANDROID) || REALM_PLATFORM_APPLE/\#if 0/' realm-core/src/realm/util/thread.cpp sed -i 's/\#elif !REALM_ANDROID && _GNU_SOURCE/\#elif 0/' realm-core/src/realm/util/basic_system_errors.cpp sed -i 's/#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L/\#if 1/' realm-core/src/realm/util/file.cpp ./build.sh \ -DREALM_USE_SYSTEM_OPENSSL=true \ -DOPENSSL_INCLUDE_DIR=/usr/include \ -DOPENSSL_SSL_LIBRARY=/usr/lib/libssl.so \ -DOPENSSL_CRYPTO_LIBRARY=/usr/lib/libcrypto.so # Build osu-lazer cd "$builddir" output="./osu.Desktop/bin/Release/net6.0/alpine.$_runtime_ver-$_dotnet_arch" DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet publish osu.Desktop \ --framework net6.0 \ --configuration Release \ --runtime alpine.$_runtime_ver-$_dotnet_arch \ --output $output \ --no-self-contained \ /property:Version=$pkgver } check() { dotnet test ./*.Tests/bin/Release/*/*.Tests.dll } package() { # Compiled binaries, localization files, debug info and rulesets mkdir -p "$pkgdir"/usr/lib/$pkgname cd "$builddir"/osu.Desktop/bin/Release/net6.0 cp -r "alpine.$_runtime_ver-$_dotnet_arch"/* "$pkgdir"/usr/lib/$pkgname/ # Remove some precompiled binaries, replace incompatible ones for lib in libSDL2.so libstbi.so; do if [ -e "$pkgdir"/usr/lib/$pkgname/$lib ]; then rm "$pkgdir"/usr/lib/$pkgname/$lib fi done # Replace librealm-wrappers mv "$srcdir"/realm-dotnet-$_realmver/wrappers/cmake/Linux/src/librealm-wrappers.so \ "$pkgdir"/usr/lib/$pkgname/librealm-wrappers.so # Wrapper script install -Dm755 "$srcdir"/osu-launcher \ "$pkgdir"/usr/bin/osu-lazer # Icon, desktop file and mime types install -Dm644 "$builddir"/assets/lazer.png \ "$pkgdir"/usr/share/pixmaps/osu-lazer.png install -Dm644 "$srcdir"/osu-lazer.desktop \ "$pkgdir"/usr/share/applications/osu-lazer.desktop install -Dm644 "$srcdir"/x-osu-lazer.xml \ "$pkgdir"/usr/share/mime/packages/x-osu-lazer.xml } lang() { for dir in "$pkgdir"/usr/lib/osu/*; do if [ ! -d $dir ]; then continue; fi lang=$(basename $dir) case $lang in 'osu'|'ref'|'linux-'*|'alpine-'*|'en') continue;; *) amove /usr/lib/osu/$lang;; esac done } data() { pkgdesc="$pkgdesc (data files)" amove /usr/lib/osu/osu.Game.Resources.dll amove /usr/lib/osu/osu.Game.Rulesets.* } sha512sums=" e107f5c159f272bb91c73c7686b176067281ac145ab88b4ebd687234f47ffee72f1eee3148df54300a00d184670f6b7c26fabc0b32db88b65219737e896ea0e2 osu-lazer-2022.405.0.tar.gz 9565d2ff6447f889a67596fbb38602fb43e90c6f15b1da1624804e59c167b397fbe40ddb017f8b908797f33f64751e9e7ee8f4ba1f5d7ab807743fdfcf6f889b realm-dotnet-10.11.1.tar.gz 76cde6fa4e7f8b35d01b86f3e6b8824944c8033c66b17b0180c9608a4c2a67c7157d15d85a7fc3cfd2b8d2491b8cca278d418c04c99188811e4a7784d8be61c5 realm-core-11.13.0.tar.gz faaaa02570578690f328906a4a6bbf8885374f4ffab40f333df35cfd22bf57a472b65b9dc904d69decfbe1867bf0221a1dcdc6d780254ae332f07eb3dead6643 osu-launcher 64020ebec01220cd7f4fa777c3b64ba149e8df8cc0c86613e3ad8d5c1fc0d3d88582bc460e0a581e62d58b91ecc8ac33b5712f27b3bfa1b75caa3be578468be5 osu-lazer.desktop 0f5e702f8d52425eca4eea45b40b60dc0d6a8a1c11624a2ddfd647b908e1c5e0c9c988b68dcbbf0841fedd05a35b2c7c53cc1edd5f2c509e1c527f228bf768f5 x-osu-lazer.xml "