discord-rpc: fix build with CMake 4; various: disable discord-rpc (#449212)

This commit is contained in:
Vladimír Čunát
2025-10-09 16:35:40 +00:00
committed by GitHub
5 changed files with 31 additions and 15 deletions

View File

@@ -41,6 +41,12 @@ stdenv.mkDerivation rec {
}) })
]; ];
postPatch = ''
substituteInPlace CMakeLists.txt --replace-fail \
"cmake_minimum_required (VERSION 3.2.0)" \
"cmake_minimum_required (VERSION 3.10.0)"
'';
meta = with lib; { meta = with lib; {
description = "Official library to interface with the Discord client"; description = "Official library to interface with the Discord client";
homepage = "https://github.com/discordapp/discord-rpc"; homepage = "https://github.com/discordapp/discord-rpc";

View File

@@ -30,6 +30,7 @@
pkg-config, pkg-config,
speexdsp, speexdsp,
zlib, zlib,
withDiscordRpc ? false,
}: }:
let let
@@ -79,7 +80,6 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [ buildInputs = [
SDL2 SDL2
curl curl
discord-rpc
duktape duktape
expat expat
flac flac
@@ -100,13 +100,15 @@ stdenv.mkDerivation (finalAttrs: {
openssl openssl
speexdsp speexdsp
zlib zlib
]; ]
++ lib.optional withDiscordRpc discord-rpc;
cmakeFlags = [ cmakeFlags = [
(lib.cmakeBool "DOWNLOAD_OBJECTS" false) (lib.cmakeBool "DOWNLOAD_OBJECTS" false)
(lib.cmakeBool "DOWNLOAD_OPENMSX" false) (lib.cmakeBool "DOWNLOAD_OPENMSX" false)
(lib.cmakeBool "DOWNLOAD_OPENSFX" false) (lib.cmakeBool "DOWNLOAD_OPENSFX" false)
(lib.cmakeBool "DOWNLOAD_TITLE_SEQUENCES" false) (lib.cmakeBool "DOWNLOAD_TITLE_SEQUENCES" false)
(lib.cmakeBool "DISABLE_DISCORD_RPC" (!withDiscordRpc))
]; ];
postUnpack = '' postUnpack = ''

View File

@@ -20,6 +20,7 @@
# Allow overrides for the RetroArch core and declarative settings # Allow overrides for the RetroArch core and declarative settings
parallel-n64-core ? parallel-launcher.passthru.parallel-n64-core, parallel-n64-core ? parallel-launcher.passthru.parallel-n64-core,
extraRetroArchSettings ? { }, extraRetroArchSettings ? { },
withDiscordRpc ? false,
}: }:
let let
# Converts a version string like x.y.z to vx.y-z # Converts a version string like x.y.z to vx.y-z
@@ -88,12 +89,12 @@ stdenv.mkDerivation (
buildInputs = [ buildInputs = [
SDL2 SDL2
discord-rpc
libgcrypt libgcrypt
sqlite sqlite
qt5.qtbase qt5.qtbase
qt5.qtsvg qt5.qtsvg
]; ]
++ lib.optional withDiscordRpc discord-rpc;
qtWrapperArgs = [ qtWrapperArgs = [
"--prefix PATH : ${ "--prefix PATH : ${

View File

@@ -25,6 +25,7 @@
withWayland ? false, withWayland ? false,
# Affects final license # Affects final license
withAngrylionRdpPlus ? false, withAngrylionRdpPlus ? false,
withDiscordRpc ? false,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@@ -48,7 +49,6 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [ buildInputs = [
boost boost
discord-rpc
freetype freetype
hidapi hidapi
libpng libpng
@@ -62,6 +62,7 @@ stdenv.mkDerivation (finalAttrs: {
xdg-user-dirs xdg-user-dirs
zlib zlib
] ]
++ lib.optional withDiscordRpc discord-rpc
++ ( ++ (
with qt6Packages; with qt6Packages;
[ [
@@ -78,6 +79,7 @@ stdenv.mkDerivation (finalAttrs: {
# everything else. # everything else.
(lib.cmakeBool "NO_RUST" true) (lib.cmakeBool "NO_RUST" true)
(lib.cmakeBool "USE_ANGRYLION" withAngrylionRdpPlus) (lib.cmakeBool "USE_ANGRYLION" withAngrylionRdpPlus)
(lib.cmakeBool "DISCORD_RPC" withDiscordRpc) # Remove with 0.8.4 update
]; ];
qtWrapperArgs = qtWrapperArgs =

View File

@@ -22,6 +22,7 @@
qtmultimedia, qtmultimedia,
discord-rpc, discord-rpc,
yajl, yajl,
withDiscordRpc ? false,
}: }:
let let
@@ -98,8 +99,8 @@ stdenv.mkDerivation rec {
qtbase qtbase
qtmultimedia qtmultimedia
yajl yajl
discord-rpc ]
]; ++ lib.optional withDiscordRpc discord-rpc;
cmakeFlags = [ cmakeFlags = [
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/ # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
@@ -131,10 +132,12 @@ stdenv.mkDerivation rec {
--set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \ --set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \
--prefix LUA_PATH : "$NIX_LUA_PATH" \ --prefix LUA_PATH : "$NIX_LUA_PATH" \
--prefix DYLD_LIBRARY_PATH : "${ --prefix DYLD_LIBRARY_PATH : "${
lib.makeLibraryPath [ lib.makeLibraryPath (
[
libsForQt5.qtkeychain libsForQt5.qtkeychain
discord-rpc
] ]
++ lib.optional withDiscordRpc discord-rpc
)
}:$out/lib" \ }:$out/lib" \
--chdir "$out"; --chdir "$out";
@@ -146,10 +149,12 @@ stdenv.mkDerivation rec {
--set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \ --set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \
--prefix LUA_PATH : "$NIX_LUA_PATH" \ --prefix LUA_PATH : "$NIX_LUA_PATH" \
--prefix LD_LIBRARY_PATH : "${ --prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [ lib.makeLibraryPath (
[
libsForQt5.qtkeychain libsForQt5.qtkeychain
discord-rpc
] ]
++ lib.optional withDiscordRpc discord-rpc
)
}" \ }" \
--chdir "$out"; --chdir "$out";