From 73164ed021c5ff29a5e7d60171fd2f92a6b55ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=91=B7=F0=9D=92=89=F0=9D=92=8A=F0=9D=92=8D?= =?UTF-8?q?=F0=9D=92=90=F0=9D=92=84=F0=9D=92=82=F0=9D=92=8D=F0=9D=92=9A?= =?UTF-8?q?=F0=9D=92=94=F0=9D=92=95?= Date: Tue, 19 May 2026 10:33:37 -0400 Subject: [PATCH] ultrastardx: now working on darwin --- pkgs/by-name/ul/ultrastardx/package.nix | 47 +++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/ul/ultrastardx/package.nix b/pkgs/by-name/ul/ultrastardx/package.nix index 62faa1801652..fbd5f1777a9c 100644 --- a/pkgs/by-name/ul/ultrastardx/package.nix +++ b/pkgs/by-name/ul/ultrastardx/package.nix @@ -36,12 +36,13 @@ let sqlite lua zlib + ffmpeg + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ libx11 libGLU libGL - ffmpeg ]; - in stdenv.mkDerivation (finalAttrs: { pname = "ultrastardx"; @@ -58,19 +59,44 @@ stdenv.mkDerivation (finalAttrs: { pkg-config autoreconfHook ]; + buildInputs = [ fpc libpng ] ++ sharedLibs; - preBuild = - let - items = lib.concatMapStringsSep " " (x: "-rpath ${lib.getLib x}/lib") sharedLibs; - in - '' - export NIX_LDFLAGS="$NIX_LDFLAGS ${items}" - ''; + env = { + NIX_LDFLAGS = lib.concatMapStringsSep " " (x: "-rpath ${lib.getLib x}/lib") sharedLibs; + } + // lib.optionalAttrs stdenv.hostPlatform.isDarwin { + MACOSX_DEPLOYMENT_TARGET = "10.13"; + }; + + # fpc's fpc.cfg hardcodes -FD/Applications/Xcode.app/.../usr/bin to find `as`/`ld`, + # which is unreachable in the build sandbox and has no sysroot. + preBuild = lib.optionalString stdenv.hostPlatform.isDarwin '' + export PFLAGS_EXTRA="-FD${lib.getBin stdenv.cc.bintools}/bin -XR$SDKROOT $PFLAGS_EXTRA" + ''; + + installPhase = '' + runHook preInstall + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + make macos-app + mkdir -p "$out/Applications" "$out/bin" + cp -R UltraStarDeluxe.app "$out/Applications/" + ln -s "$out/Applications/UltraStarDeluxe.app/Contents/MacOS/ultrastardx" \ + "$out/bin/ultrastardx" + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + make install + install -Dm644 dists/ultrastardx.desktop \ + "$out/share/applications/ultrastardx.desktop" + '' + + '' + runHook postInstall + ''; # dlopened libgcc requires the rpath not to be shrunk dontPatchELF = true; @@ -82,7 +108,8 @@ stdenv.mkDerivation (finalAttrs: { license = lib.licenses.gpl2Plus; maintainers = with lib.maintainers; [ diogotcorreia + philocalyst ]; - platforms = lib.platforms.linux; + platforms = with lib.platforms; linux ++ darwin ++ windows; }; })