2022-10-30 15:09:59 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, autoPatchelfHook
|
|
|
|
, pkg-config
|
|
|
|
, scons
|
|
|
|
, vulkan-loader
|
|
|
|
, libX11
|
|
|
|
, libXcursor
|
|
|
|
, libXinerama
|
|
|
|
, libXext
|
2023-01-11 07:51:40 +00:00
|
|
|
, libXrandr
|
|
|
|
, libXrender
|
|
|
|
, libXi
|
2022-10-30 15:09:59 +00:00
|
|
|
, libXfixes
|
|
|
|
, freetype
|
|
|
|
, alsa-lib
|
|
|
|
, libpulseaudio
|
|
|
|
, dbus
|
|
|
|
, speechd
|
|
|
|
, fontconfig
|
|
|
|
, udev
|
2023-01-11 07:51:40 +00:00
|
|
|
, withPlatform ? "linuxbsd"
|
|
|
|
, withTarget ? "editor"
|
|
|
|
, withPrecision ? "single"
|
2022-10-30 15:09:59 +00:00
|
|
|
, withPulseaudio ? false
|
|
|
|
, withDbus ? true
|
|
|
|
, withSpeechd ? false
|
|
|
|
, withFontconfig ? true
|
|
|
|
, withUdev ? true
|
|
|
|
, withTouch ? true
|
|
|
|
}:
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
assert lib.asserts.assertOneOf "withPrecision" withPrecision [ "single" "double" ];
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
let
|
|
|
|
options = {
|
2023-01-11 07:51:40 +00:00
|
|
|
# Options from 'godot/SConstruct'
|
|
|
|
platform = withPlatform;
|
|
|
|
target = withTarget;
|
|
|
|
precision = withPrecision; # Floating-point precision level
|
|
|
|
|
|
|
|
# Options from 'godot/platform/linuxbsd/detect.py'
|
2022-10-30 15:09:59 +00:00
|
|
|
pulseaudio = withPulseaudio;
|
|
|
|
dbus = withDbus; # Use D-Bus to handle screensaver and portal desktop settings
|
|
|
|
speechd = withSpeechd; # Use Speech Dispatcher for Text-to-Speech support
|
|
|
|
fontconfig = withFontconfig; # Use fontconfig for system fonts support
|
|
|
|
udev = withUdev; # Use udev for gamepad connection callbacks
|
|
|
|
touch = withTouch; # Enable touch events
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "godot";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "4.0-beta10";
|
2022-10-30 15:09:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "godotengine";
|
|
|
|
repo = "godot";
|
2023-01-11 07:51:40 +00:00
|
|
|
rev = "d0398f62f08ce0cfba80990b21c6af4181f93fe9";
|
|
|
|
sha256 = "sha256-h4DpK7YC7/qMc6GAD2nvNVmrlGjKT5d7OK+1NcuZCMg=";
|
2022-10-30 15:09:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
autoPatchelfHook
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
scons
|
2023-01-11 07:51:40 +00:00
|
|
|
]
|
|
|
|
++ runtimeDependencies;
|
|
|
|
|
|
|
|
runtimeDependencies = [
|
2022-10-30 15:09:59 +00:00
|
|
|
libX11
|
|
|
|
libXcursor
|
|
|
|
libXinerama
|
|
|
|
libXext
|
2023-01-11 07:51:40 +00:00
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
libXi
|
2022-10-30 15:09:59 +00:00
|
|
|
libXfixes
|
|
|
|
alsa-lib
|
2023-01-11 07:51:40 +00:00
|
|
|
vulkan-loader
|
2022-10-30 15:09:59 +00:00
|
|
|
]
|
|
|
|
++ lib.optional withPulseaudio libpulseaudio
|
2023-01-11 07:51:40 +00:00
|
|
|
++ lib.optional withDbus dbus
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optional withDbus dbus.lib
|
|
|
|
++ lib.optional withSpeechd speechd
|
2023-01-11 07:51:40 +00:00
|
|
|
++ lib.optional withFontconfig fontconfig
|
2022-10-30 15:09:59 +00:00
|
|
|
++ lib.optional withFontconfig fontconfig.lib
|
|
|
|
++ lib.optional withUdev udev;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Godot expects to find xfixes inside xi, but nix's pkg-config only
|
|
|
|
# gives the libs for the requested package (ignoring the propagated-build-inputs)
|
|
|
|
./xfixes.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# Options from 'godot/SConstruct' and 'godot/platform/linuxbsd/detect.py'
|
|
|
|
sconsFlags = [ "production=true" ];
|
2022-10-30 15:09:59 +00:00
|
|
|
preConfigure = ''
|
|
|
|
sconsFlags+=" ${
|
|
|
|
lib.concatStringsSep " "
|
|
|
|
(lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)
|
|
|
|
}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp bin/godot.* $out/bin/godot
|
|
|
|
|
|
|
|
installManPage misc/dist/linux/godot.6
|
|
|
|
|
|
|
|
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
|
|
|
|
cp misc/dist/linux/org.godotengine.Godot.desktop "$out/share/applications/"
|
|
|
|
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
|
|
|
|
--replace "Exec=godot" "Exec=$out/bin/godot"
|
|
|
|
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
|
|
|
|
cp icon.png "$out/share/icons/godot.png"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://godotengine.org";
|
|
|
|
description = "Free and Open Source 2D and 3D game engine";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ twey shiryel ];
|
|
|
|
};
|
|
|
|
}
|