add configureation

This commit is contained in:
nek0 2019-12-02 05:48:22 +01:00
parent 449151a35b
commit f7ede512b5
3 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,109 @@
{ stdenv, lib, fetchFromGitHub, scons, pkgconfig, libX11, libXcursor
, libXinerama, libXrandr, libXrender, libpulseaudio ? null
, libXi ? null, libXext, libXfixes, freetype, openssl
, alsaLib, libGLU, zlib, yasm ? null
, pkg-config
, mono, msbuild, dotnet-sdk, dotnetPackages, fetchNuGet
}:
let
options = {
touch = libXi != null;
pulseaudio = false;
};
monoprefix = if builtins.currentSystem == "x86_64-linux"
then "MONO64_PREFIX=${mono}"
else "MONO32_PREFIX=${mono}";
bits = if builtins.currentSystem == "x86_64-linux"
then "64"
else "32";
glob = fetchNuGet {
baseName = "DotNet.Glob";
version = "2.1.1";
sha256 = "06pwz1r0sf506l7bhxi8mx6lfhn95v6ns8h3905bgi5950cip84g";
outputFiles = [ "*" ];
dllFiles = [ "DotNet.Glob.dll" ];
};
in stdenv.mkDerivation rec {
pname = "godot";
version = "3.1.1";
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
rev = "${version}-stable";
sha256 = "0lplkwgshh0x7r1daai9gflzwjnp3yfx4724h1myvidaz234v2wh";
};
nativeBuildInputs = [ pkgconfig mono msbuild dotnet-sdk ];
buildInputs = [
scons libX11 libXcursor libXinerama libXrandr libXrender
libXi libXext libXfixes freetype openssl alsaLib libpulseaudio
libGLU zlib yasm
pkgconfig
msbuild dotnetPackages.Nuget glob
];
patches = [
./pkg_config_additions.patch
./dont_clobber_environment.patch
];
enableParallelBuilding = true;
sconsFlags = "target=release_debug platform=x11 tools=yes module_mono_enabled=yes";
preConfigure = ''
sconsFlags+=" ${lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)}"
'';
buildPhase = ''
#cd ${src}/godot-mono
echo $NIX_BUILD_CORES
export ${monoprefix}
# Build Mono glue
export HOME=$(pwd)
scons -j "$NIX_BUILD_CORES" platform=x11 tools=yes module_mono_enabled=yes mono_glue=no bits=${bits}
bin/godot.x11.tools.${bits}.mono --generate-mono-glue modules/mono/glue
# Build editor binary
scons -j "$NIX_BUILD_CORES" platform=x11 tools=yes target=release_debug module_mono_enabled=yes pulseaudio=no touch=${builtins.toJSON (libXi != null)} bits=${bits}
scons -j "$NIX_BUILD_CORES" platform=x11 tools=no target=release module_mono_enabled=yes pulseausio=no touch=${builtins.toJSON (libXi != null)} bits=${bits}
'';
outputs = [ "out" "dev" "man" ];
installPhase = ''
mkdir -p "$out/bin"
cp bin/godot.* $out/bin/godot
cp bin/data.mono.* $out/bin
mkdir "$dev"
cp -r modules/gdnative/include $dev
mkdir -p "$man/share/man/man6"
cp misc/dist/linux/godot.6 "$man/share/man/man6/"
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
cp misc/dist/linux/org.godotengine.Godot.desktop "$out/share/applications/"
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp icon.png "$out/share/icons/godot.png"
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
'';
meta = {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine";
license = stdenv.lib.licenses.mit;
platforms = [ "i686-linux" "x86_64-linux" ];
maintainers = with stdenv.lib.maintainers; [ nek0 ];
priority = 4; # Prioritize Mono-enabled version over default Godot
};
}

View File

@ -0,0 +1,17 @@
+++ build/SConstruct
@@ -63,10 +63,10 @@ elif platform_arg == 'javascript':
custom_tools = ['cc', 'c++', 'ar', 'link', 'textfile', 'zip']
env_base = Environment(tools=custom_tools)
-if 'TERM' in os.environ:
- env_base['ENV']['TERM'] = os.environ['TERM']
-env_base.AppendENVPath('PATH', os.getenv('PATH'))
-env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
+for k in ("TERM", "PATH", "PKG_CONFIG_PATH"):
+ if (k in os.environ):
+ env_base["ENV"][k] = os.environ[k]
+
env_base.android_maven_repos = []
env_base.android_flat_dirs = []
env_base.android_dependencies = []

View File

@ -0,0 +1,22 @@
+++ b/platform/x11/detect.py
@@ -175,6 +175,11 @@ def configure(env):
env.ParseConfig('pkg-config xrender --cflags --libs')
env.ParseConfig('pkg-config xi --cflags --libs')
+ env.ParseConfig('pkg-config xext --cflags --libs')
+ env.ParseConfig('pkg-config xfixes --cflags --libs')
+ env.ParseConfig('pkg-config glu --cflags --libs')
+ env.ParseConfig('pkg-config zlib --cflags --libs')
+
if (env['touch']):
env.Append(CPPFLAGS=['-DTOUCH_ENABLED'])
@@ -264,7 +269,7 @@ def configure(env):
print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED", "-DALSAMIDI_ENABLED"])
# Don't parse --cflags, we don't need to add /usr/include/alsa to include path
- env.ParseConfig('pkg-config alsa --libs')
+ env.ParseConfig('pkg-config alsa --cflags --libs')
else:
print("ALSA libraries not found, disabling driver")