lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

godot3: add mono builds

rotaerk e555a7b3 e138e656

+346
+7
pkgs/development/tools/godot/3/mono/debug-server.nix
··· 1 + { godot3-mono-headless }: 2 + 3 + godot3-mono-headless.overrideAttrs (self: base: { 4 + pname = "godot3-mono-debug-server"; 5 + godotBuildDescription = "mono debug server"; 6 + shouldBuildTools = false; 7 + })
+65
pkgs/development/tools/godot/3/mono/default.nix
··· 1 + { godot3 2 + , callPackage 3 + , mkNugetDeps 4 + , mkNugetSource 5 + , mono 6 + , dotnet-sdk 7 + , writeText 8 + }: 9 + 10 + godot3.overrideAttrs (self: base: { 11 + pname = "godot3-mono"; 12 + 13 + godotBuildDescription = "mono build"; 14 + 15 + nativeBuildInputs = base.nativeBuildInputs ++ [ mono dotnet-sdk ]; 16 + 17 + glue = callPackage ./glue.nix {}; 18 + 19 + nugetDeps = mkNugetDeps { name = "deps"; nugetDeps = import ./deps.nix; }; 20 + 21 + nugetSource = 22 + mkNugetSource { 23 + name = "${self.pname}-nuget-source"; 24 + description = "A Nuget source with dependencies for ${self.pname}"; 25 + deps = [ self.nugetDeps ]; 26 + }; 27 + 28 + nugetConfig = writeText "NuGet.Config" '' 29 + <?xml version="1.0" encoding="utf-8"?> 30 + <configuration> 31 + <packageSources> 32 + <add key="${self.pname}-deps" value="${self.nugetSource}/lib" /> 33 + </packageSources> 34 + </configuration> 35 + ''; 36 + 37 + sconsFlags = base.sconsFlags ++ [ 38 + "module_mono_enabled=true" 39 + "mono_prefix=${mono}" 40 + ]; 41 + 42 + shouldConfigureNuget = true; 43 + 44 + postConfigure = '' 45 + echo "Setting up buildhome." 46 + mkdir buildhome 47 + export HOME="$PWD"/buildhome 48 + 49 + echo "Overlaying godot glue." 50 + cp -R --no-preserve=mode "$glue"/. . 51 + 52 + if [ -n "$shouldConfigureNuget" ]; then 53 + echo "Configuring NuGet." 54 + mkdir -p ~/.nuget/NuGet 55 + ln -s "$nugetConfig" ~/.nuget/NuGet/NuGet.Config 56 + fi 57 + ''; 58 + 59 + installedGodotShortcutFileName = "org.godotengine.GodotMono3.desktop"; 60 + installedGodotShortcutDisplayName = "Godot Engine (Mono) 3"; 61 + 62 + passthru = { 63 + make-deps = callPackage ./make-deps.nix {}; 64 + }; 65 + })
+34
pkgs/development/tools/godot/3/mono/deps.nix
··· 1 + { fetchNuGet }: [ 2 + (fetchNuGet { pname = "EnvDTE"; version = "8.0.2"; sha256 = "1wdvjzdmqbqyqlaijpjc959vvdic12vqr3c5sffhbxi7m1si5k63"; }) 3 + (fetchNuGet { pname = "GodotTools.IdeMessaging"; version = "1.1.1"; sha256 = "0v70acpw2yq9mx05jy2gmkqqdbpgj8rb29ny2f3bgvmw9g5qmq94"; }) 4 + (fetchNuGet { pname = "JetBrains.Annotations"; version = "2019.1.3"; sha256 = "188b0qw6lih0k3ddnmimadzr3y1y6vh6ramgkjnyskqd43prjzc2"; }) 5 + (fetchNuGet { pname = "Microsoft.Build"; version = "16.5.0"; sha256 = "0baihvnzanqhk125g0ass9hhsqgp55h770pjjmsxdvprv0aqq22i"; }) 6 + (fetchNuGet { pname = "Microsoft.Build.Framework"; version = "16.5.0"; sha256 = "1xgr02r7s9i6s70n237hss4yi9zicssia3zd2ny6s8vyxb7jpdyb"; }) 7 + (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.0.1"; sha256 = "01al6cfxp68dscl15z7rxfw9zvhm64dncsw09a1vmdkacsa2v6lr"; }) 8 + (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.0"; sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; }) 9 + (fetchNuGet { pname = "Microsoft.NETCore.Targets"; version = "1.0.1"; sha256 = "0ppdkwy6s9p7x9jix3v4402wb171cdiibq7js7i13nxpdky7074p"; }) 10 + (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies"; version = "1.0.0"; sha256 = "0na724xhvqm63vq9y18fl9jw9q2v99bdwr353378s5fsi11qzxp9"; }) 11 + (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies.net472"; version = "1.0.0"; sha256 = "1bqinq2nxnpqxziypg1sqy3ly0nymxxjpn8fwkn3rl4vl6gdg3rc"; }) 12 + (fetchNuGet { pname = "Microsoft.VisualStudio.Setup.Configuration.Interop"; version = "1.16.30"; sha256 = "14022lx03vdcqlvbbdmbsxg5pqfx1rfq2jywxlyaz9v68cvsb0g4"; }) 13 + (fetchNuGet { pname = "Mono.Cecil"; version = "0.11.3"; sha256 = "0xcx7pk9y2n1hr15c0l1balzi69kw5gy8dk7sb8jwqyyvm35q4j3"; }) 14 + (fetchNuGet { pname = "NETStandard.Library"; version = "2.0.3"; sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"; }) 15 + (fetchNuGet { pname = "Newtonsoft.Json"; version = "13.0.1"; sha256 = "0fijg0w6iwap8gvzyjnndds0q4b8anwxxvik7y8vgq97dram4srb"; }) 16 + (fetchNuGet { pname = "Semver"; version = "2.0.6"; sha256 = "136sd6d3ys49dipvc1h3ivmp8ryd4p7fdmdrr28521cqpvkw5f1k"; }) 17 + (fetchNuGet { pname = "stdole"; version = "7.0.3302"; sha256 = "1n8vbzlgyklazriwvb6kjyw5w0m9a1b3xsa0f0v29j03z23fx69p"; }) 18 + (fetchNuGet { pname = "System.Buffers"; version = "4.4.0"; sha256 = "183f8063w8zqn99pv0ni0nnwh7fgx46qzxamwnans55hhs2l0g19"; }) 19 + (fetchNuGet { pname = "System.Collections.Immutable"; version = "1.5.0"; sha256 = "1d5gjn5afnrf461jlxzawcvihz195gayqpcfbv6dd7pxa9ialn06"; }) 20 + (fetchNuGet { pname = "System.Globalization"; version = "4.0.11"; sha256 = "070c5jbas2v7smm660zaf1gh0489xanjqymkvafcs4f8cdrs1d5d"; }) 21 + (fetchNuGet { pname = "System.IO"; version = "4.1.0"; sha256 = "1g0yb8p11vfd0kbkyzlfsbsp5z44lwsvyc0h3dpw6vqnbi035ajp"; }) 22 + (fetchNuGet { pname = "System.Memory"; version = "4.5.3"; sha256 = "0naqahm3wljxb5a911d37mwjqjdxv9l0b49p5dmfyijvni2ppy8a"; }) 23 + (fetchNuGet { pname = "System.Numerics.Vectors"; version = "4.4.0"; sha256 = "0rdvma399070b0i46c4qq1h2yvjj3k013sqzkilz4bz5cwmx1rba"; }) 24 + (fetchNuGet { pname = "System.Reflection"; version = "4.1.0"; sha256 = "1js89429pfw79mxvbzp8p3q93il6rdff332hddhzi5wqglc4gml9"; }) 25 + (fetchNuGet { pname = "System.Reflection.Primitives"; version = "4.0.1"; sha256 = "1bangaabhsl4k9fg8khn83wm6yial8ik1sza7401621jc6jrym28"; }) 26 + (fetchNuGet { pname = "System.Resources.ResourceManager"; version = "4.0.1"; sha256 = "0b4i7mncaf8cnai85jv3wnw6hps140cxz8vylv2bik6wyzgvz7bi"; }) 27 + (fetchNuGet { pname = "System.Runtime"; version = "4.1.0"; sha256 = "02hdkgk13rvsd6r9yafbwzss8kr55wnj8d5c7xjnp8gqrwc8sn0m"; }) 28 + (fetchNuGet { pname = "System.Runtime.CompilerServices.Unsafe"; version = "4.5.2"; sha256 = "1vz4275fjij8inf31np78hw50al8nqkngk04p3xv5n4fcmf1grgi"; }) 29 + (fetchNuGet { pname = "System.Runtime.Serialization.Primitives"; version = "4.1.1"; sha256 = "042rfjixknlr6r10vx2pgf56yming8lkjikamg3g4v29ikk78h7k"; }) 30 + (fetchNuGet { pname = "System.Text.Encoding"; version = "4.0.11"; sha256 = "1dyqv0hijg265dwxg6l7aiv74102d6xjiwplh2ar1ly6xfaa4iiw"; }) 31 + (fetchNuGet { pname = "System.Threading.Tasks"; version = "4.0.11"; sha256 = "0nr1r41rak82qfa5m0lhk9mp0k93bvfd7bbd9sdzwx9mb36g28p5"; }) 32 + (fetchNuGet { pname = "System.Threading.Tasks.Dataflow"; version = "4.9.0"; sha256 = "1g6s9pjg4z8iy98df60y9a01imdqy59zd767vz74rrng78jl2dk5"; }) 33 + (fetchNuGet { pname = "System.Threading.Thread"; version = "4.0.0"; sha256 = "1gxxm5fl36pjjpnx1k688dcw8m9l7nmf802nxis6swdaw8k54jzc"; }) 34 + ]
+28
pkgs/development/tools/godot/3/mono/export-templates.nix
··· 1 + { godot3-mono }: 2 + 3 + godot3-mono.overrideAttrs (self: base: { 4 + pname = "godot3-mono-export-templates"; 5 + godotBuildDescription = "nix mono export templates"; 6 + 7 + # As described in default.nix, adding the link flags to pulseaudio in detect.py was necessary to 8 + # allow the dlopen calls to succeed in Nix builds of godot. However, it seems that this *breaks* 9 + # the export templates, resulting in programs exported from godot using these export templates to 10 + # be unable to load this library. 11 + shouldAddLinkFlagsToPulse = false; 12 + 13 + shouldBuildTools = false; 14 + godotBuildTarget = "release"; 15 + godotBinInstallPath = "share/godot/templates/${self.version}.stable.mono"; 16 + installedGodotBinName = "linux_${self.godotBuildPlatform}_64_${self.godotBuildTarget}"; 17 + 18 + # https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html 19 + # Stripping reduces the template size from around 500MB to 40MB for Linux. 20 + # This also impacts the size of the exported games. 21 + # This is added explicitly here because mkDerivation does not automatically 22 + # strip binaries in the template directory. 23 + stripAllList = (base.stripAllList or []) ++ [ "share/godot/templates" ]; 24 + 25 + meta = base.meta // { 26 + homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html#export-templates"; 27 + }; 28 + })
+66
pkgs/development/tools/godot/3/mono/glue.nix
··· 1 + { godot3, mono }: 2 + 3 + godot3.overrideAttrs (self: base: { 4 + pname = "godot3-mono-glue"; 5 + godotBuildDescription = "mono glue"; 6 + godotBuildPlatform = "server"; 7 + 8 + sconsFlags = base.sconsFlags ++ [ 9 + "module_mono_enabled=true" 10 + "mono_glue=false" # Indicates not to expect already existing glue. 11 + "mono_prefix=${mono}" 12 + ]; 13 + 14 + nativeBuildInputs = base.nativeBuildInputs ++ [ mono ]; 15 + 16 + patches = 17 + base.patches ++ 18 + map (rp: ./patches + rp) ( 19 + [ 20 + # When building godot mono, a "glue version" gets baked into it, and into the mono glue code 21 + # generated by it. Godot mono export templates are also get a glue version baked in. If you 22 + # export a godot mono project using an export template for which the glue version doesn't 23 + # match that of the godot mono tool itself, then the resulting game will fail with an error 24 + # saying "The assembly 'GodotSharp' is out of sync." Thus, if we want our build of godot mono 25 + # to be compatible with the official export templates, we need to ensure it is built with the 26 + # same glue version as the official build. 27 + # 28 + # A python script in the godot source, i.e. modules/mono/build_scripts/gen_cs_glue_version.py, 29 + # is used by the build process to generate the glue version number. The official version of it 30 + # does so based on the latest modified time of all the C# files in the GodotSharp solution. This 31 + # is problematic because it is difficult to reproduce the exact timestamps that the files had 32 + # when the official build was created. This is further complicated by the fact that nix clears 33 + # the timestamps on the source files when they're unpacked. Thus, we can't simply regenerate the 34 + # official glue version by building from the official source. 35 + # 36 + # To address this, we are patching the python script with a hard-coded glue version number. This 37 + # patch file needs to be updated for every new version of godot, so to enforce this, the godot 38 + # version is baked in to the file name, causing the build to fail until the patch is updated. 39 + # 40 + # The correct glue version number for a given godot version is obtained by running the official 41 + # build of that version of godot with the --generate-mono-glue flag. This generates the mono 42 + # glue files. One of those files, mono_glue.gen.cpp, has a function called get_cs_glue_version() 43 + # which contains a hard-coded number. This is the glue version to put in the patch file. 44 + # 45 + # For convenience, the accompanying update-glue-version.sh script automates this work. Run it by 46 + # passing the godot version as an argument, e.g. "3.5.2". 47 + "/gen_cs_glue_version.py/hardcodeGlueVersion_${self.version}.patch" 48 + ] 49 + ); 50 + 51 + outputs = [ "out" ]; 52 + 53 + installPhase = '' 54 + runHook preInstall 55 + 56 + glue="$out"/modules/mono/glue 57 + mkdir -p "$glue" 58 + bin/godot_server.x11.opt.tools.*.mono --generate-mono-glue "$glue" 59 + 60 + runHook postInstall 61 + ''; 62 + 63 + meta = base.meta // { 64 + homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html#generate-the-glue"; 65 + }; 66 + })
+7
pkgs/development/tools/godot/3/mono/headless.nix
··· 1 + { godot3-mono }: 2 + 3 + godot3-mono.overrideAttrs (self: base: { 4 + pname = "godot3-mono-headless"; 5 + godotBuildDescription = "mono headless"; 6 + godotBuildPlatform = "server"; 7 + })
+59
pkgs/development/tools/godot/3/mono/make-deps.nix
··· 1 + { godot3-mono, nuget-to-nix }: 2 + 3 + godot3-mono.overrideAttrs (self: base: { 4 + pname = "godot3-mono-make-deps"; 5 + 6 + nativeBuildInputs = base.nativeBuildInputs ++ [ nuget-to-nix ]; 7 + 8 + nugetDeps = null; 9 + nugetSource = null; 10 + nugetConfig = null; 11 + 12 + shouldConfigureNuget = false; 13 + 14 + outputs = [ "out" ]; 15 + buildPhase = " "; 16 + installPhase = ''echo "No output intended. Run make-deps.sh instead." > $out''; 17 + 18 + # This script is used to update the accompanying deps.nix file, a nix expression listing the 19 + # nuget packages that the godot-mono code depends on, along with their sha256 hashes. This 20 + # file is referenced by the godot-mono derivation and needs to be updated every time the 21 + # godot version is updated. The way it works is: 22 + # 23 + # 1) Creates and navigates to a temporary directory and then explicitly runs the unpack, 24 + # patch, and configure phases from the godot-mono derivation. 25 + # 2) Instead of building at this point, a nuget restore is performed, downloading all the 26 + # nuget dependencies of godot-mono into a local folder. 27 + # 3) Once these have been downloaded, the nuget-to-nix tool is used to generate a nix 28 + # expression listing the locally obtained nuget packages, along with their sha256 hashes. 29 + # 4) This nix expression is saved as deps.nix in the PWD. 30 + # 31 + # This process is impure, because it entails downloading files with unknown hashes, so it 32 + # is run manually by the maintainer within a nix-shell environment. Running the accompanying 33 + # make-deps.sh instead simplifies this. 34 + makeDeps = '' 35 + set -e 36 + outdir="$(pwd)" 37 + wrkdir="$(mktemp -d)" 38 + trap 'rm -rf -- "$wrkdir"' EXIT 39 + pushd "$wrkdir" > /dev/null 40 + unpackPhase 41 + cd source 42 + patchPhase 43 + configurePhase 44 + 45 + # Without RestorePackagesPath set, it restores packages to a temp directory. Specifying 46 + # a path ensures we have a place to run nuget-to-nix. 47 + nugetRestore() { dotnet msbuild -t:Restore -p:RestorePackagesPath=nugetPackages $1; } 48 + 49 + nugetRestore modules/mono/glue/GodotSharp/GodotSharp.sln 50 + nugetRestore modules/mono/editor/GodotTools/GodotTools.sln 51 + 52 + nuget-to-nix nugetPackages > "$outdir"/deps.nix 53 + popd > /dev/null 54 + ''; 55 + 56 + meta = base.meta // { 57 + description = "Derivation with no output that exists to provide an environment for make-deps.sh"; 58 + }; 59 + })
+2
pkgs/development/tools/godot/3/mono/make-deps.sh
··· 1 + #!/usr/bin/env bash 2 + nix-shell "$(git rev-parse --show-toplevel)" -A godot3-mono.make-deps --run 'eval "$makeDeps"'
+22
pkgs/development/tools/godot/3/mono/patches/gen_cs_glue_version.py/hardcodeGlueVersion_3.5.2.patch
··· 1 + diff --git a/modules/mono/build_scripts/gen_cs_glue_version.py b/modules/mono/build_scripts/gen_cs_glue_version.py 2 + index 98bbb4d9be..5189f2551b 100644 3 + --- a/modules/mono/build_scripts/gen_cs_glue_version.py 4 + +++ b/modules/mono/build_scripts/gen_cs_glue_version.py 5 + @@ -1,16 +1,5 @@ 6 + def generate_header(solution_dir, version_header_dst): 7 + - import os 8 + - 9 + - latest_mtime = 0 10 + - for root, dirs, files in os.walk(solution_dir, topdown=True): 11 + - dirs[:] = [d for d in dirs if d not in ["Generated"]] # Ignored generated files 12 + - files = [f for f in files if f.endswith(".cs")] 13 + - for file in files: 14 + - filepath = os.path.join(root, file) 15 + - mtime = os.path.getmtime(filepath) 16 + - latest_mtime = mtime if mtime > latest_mtime else latest_mtime 17 + - 18 + - glue_version = int(latest_mtime) # The latest modified time will do for now 19 + + glue_version = 1678112021 20 + 21 + with open(version_header_dst, "w") as version_header: 22 + version_header.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+7
pkgs/development/tools/godot/3/mono/server.nix
··· 1 + { godot3-mono-debug-server }: 2 + 3 + godot3-mono-debug-server.overrideAttrs (self: base: { 4 + pname = "godot3-mono-server"; 5 + godotBuildDescription = "mono server"; 6 + godotBuildTarget = "release"; 7 + })
+39
pkgs/development/tools/godot/3/mono/update-glue-version.sh
··· 1 + #! /usr/bin/env nix-shell 2 + #! nix-shell -i bash -p steam-run unzip wget 3 + 4 + # This script updates the hard-coded glue_version in: 5 + # 6 + # patches/gen_cs_glue_version.py/hardcodeGlueVersionFor{version}.patch 7 + # 8 + # It does so by pulling it from the official build. 9 + 10 + set -e 11 + 12 + [ -z "$1" ] && echo "Godot version not specified. Exiting." && exit 1 13 + 14 + gdversion=$1 15 + 16 + # Download and extract the official stable 64-bit X11 mono build of Godot. 17 + gddir="$(mktemp -d)" 18 + trap 'rm -rf -- "$gddir"' EXIT 19 + wget -P "$gddir" https://downloads.tuxfamily.org/godotengine/$gdversion/mono/Godot_v$gdversion-stable_mono_x11_64.zip 20 + unzip "$gddir"/Godot_v$gdversion-stable_mono_x11_64.zip -d "$gddir" 21 + 22 + # Generate the mono glue from the official build. 23 + gluedir="$(mktemp -d)" 24 + trap 'rm -rf -- "$gluedir"' EXIT 25 + steam-run "$gddir"/Godot_v$gdversion-stable_mono_x11_64/Godot_v$gdversion-stable_mono_x11.64 --generate-mono-glue "$gluedir" 26 + 27 + # Extract the glue version. 28 + glueversion=$(grep -Po '(?<=get_cs_glue_version\(\) \{ return )[0-9]+(?=; \})' "$gluedir"/mono_glue.gen.cpp) 29 + 30 + patchdir=./patches/gen_cs_glue_version.py/ 31 + patchprefix=hardcodeGlueVersion_ 32 + newpatchname=$patchprefix$gdversion.patch 33 + 34 + # Update the patch with the obtained glue version. 35 + sed -i "s/^+ glue_version = [0-9]\+$/+ glue_version = $glueversion/" $patchdir/$patchprefix*.patch 36 + 37 + mv $patchdir/$patchprefix*.patch $patchdir/$patchprefix$gdversion.patch 38 + 39 + echo "Updated $patchdir/$patchprefix$gdversion.patch with glue_version: $glueversion"
+10
pkgs/top-level/all-packages.nix
··· 8236 8236 8237 8237 godot3-server = callPackage ../development/tools/godot/3/server.nix { }; 8238 8238 8239 + godot3-mono = callPackage ../development/tools/godot/3/mono {}; 8240 + 8241 + godot3-mono-export-templates = callPackage ../development/tools/godot/3/mono/export-templates.nix { }; 8242 + 8243 + godot3-mono-headless = callPackage ../development/tools/godot/3/mono/headless.nix { }; 8244 + 8245 + godot3-mono-debug-server = callPackage ../development/tools/godot/3/mono/debug-server.nix { }; 8246 + 8247 + godot3-mono-server = callPackage ../development/tools/godot/3/mono/server.nix { }; 8248 + 8239 8249 goeland = callPackage ../applications/networking/feedreaders/goeland { }; 8240 8250 8241 8251 go-mtpfs = callPackage ../tools/filesystems/go-mtpfs { };