about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-07-17 02:59:32 +0200
committeraszlig <aszlig@nix.build>2018-07-19 06:35:11 +0200
commit3917a5e3c4b7784bf535eafb25e0a47662c0978a (patch)
treea30922367149a0e6932b416d2d4dcb0e806852dc /pkgs/games
parentcf54036a6adf6977300c611c50f7daf2445a0589 (diff)
monogame-patcher: Switch to MSBuild
I really would have preferred a simple Makefile, but with that we can't
use buildDotnetPackage and we also need to take care of butchering the
dependencies manually.

So I moved everything to src/ and added a csproj file to clean up most
of the cruft and just use buildDotnetPackage with minimal attributes.

In addition to that I also added assembly info, so that the command line
help will show the proper author name, copyright, yaddayadda...

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/build-support/monogame-patcher/default.nix47
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/assembly-info.cs6
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/patcher.cs (renamed from pkgs/games/build-support/monogame-patcher/patcher.cs)0
-rw-r--r--pkgs/games/build-support/monogame-patcher/src/patcher.csproj39
4 files changed, 65 insertions, 27 deletions
diff --git a/pkgs/games/build-support/monogame-patcher/default.nix b/pkgs/games/build-support/monogame-patcher/default.nix
index fffa6825..1a06425e 100644
--- a/pkgs/games/build-support/monogame-patcher/default.nix
+++ b/pkgs/games/build-support/monogame-patcher/default.nix
@@ -1,31 +1,24 @@
-{ lib, runCommand, makeWrapper, fetchNuGet, mono, dotnetPackages }:
+{ buildDotnetPackage, fetchNuGet }:
 
-runCommand "monogame-patcher" {
-  nativeBuildInputs = [ mono makeWrapper ];
+buildDotnetPackage {
+  baseName = "monogame-patcher";
+  version = "0.1.0";
 
-  src = ./patcher.cs;
+  src = ./src;
 
-  cecil = "${fetchNuGet {
-    baseName = "Mono.Cecil";
-    version = "0.10-beta7";
-    sha256 = "03bina3llcnylrfrvp5psnwrfn757j7zch5r360rpdn7gmcjjcpl";
-    outputFiles = [ "lib/net40/*" ];
-  }}/lib/dotnet/Mono.Cecil";
+  buildInputs = [
+    (fetchNuGet {
+      baseName = "Mono.Cecil";
+      version = "0.10-beta7";
+      sha256 = "03bina3llcnylrfrvp5psnwrfn757j7zch5r360rpdn7gmcjjcpl";
+      outputFiles = [ "lib/net40/*" ];
+    })
 
-  cliparser = "${fetchNuGet {
-    baseName = "CommandLineParser";
-    version = "2.2.1";
-    sha256 = "0wf8mzr16d2ni008m60rrk738v8ypk74llk6g8mlyx7rrlchnxaf";
-    outputFiles = [ "lib/net45/*" ];
-  }}/lib/dotnet/CommandLineParser";
-
-} ''
-  mkdir -p "$out/bin" "$out/libexec/monogame-patcher"
-  mcs "$src" -out:"$out/libexec/monogame-patcher/patcher.exe" \
-    -lib:"$cecil" -lib:"$cliparser" \
-    -r:Mono.Cecil -r:Mono.Cecil.Rocks -r:CommandLine
-
-  makeWrapper ${lib.escapeShellArg "${mono}/bin/mono"} "$out/bin/$name" \
-    --set MONO_PATH "$cecil:$cliparser" \
-    --add-flags "$out/libexec/monogame-patcher/patcher.exe"
-''
+    (fetchNuGet {
+      baseName = "CommandLineParser";
+      version = "2.2.1";
+      sha256 = "0wf8mzr16d2ni008m60rrk738v8ypk74llk6g8mlyx7rrlchnxaf";
+      outputFiles = [ "lib/net45/*" ];
+    })
+  ];
+}
diff --git a/pkgs/games/build-support/monogame-patcher/src/assembly-info.cs b/pkgs/games/build-support/monogame-patcher/src/assembly-info.cs
new file mode 100644
index 00000000..55c4c4d3
--- /dev/null
+++ b/pkgs/games/build-support/monogame-patcher/src/assembly-info.cs
@@ -0,0 +1,6 @@
+using System.Reflection;
+
+[assembly: AssemblyTitle("monogame-patcher")]
+[assembly: AssemblyVersion("0.1.0")]
+[assembly: AssemblyDescription("Patches common annoyances in Mono Assemblies")]
+[assembly: AssemblyCopyright("(c) 2018 aszlig")]
diff --git a/pkgs/games/build-support/monogame-patcher/patcher.cs b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
index c1502ba1..c1502ba1 100644
--- a/pkgs/games/build-support/monogame-patcher/patcher.cs
+++ b/pkgs/games/build-support/monogame-patcher/src/patcher.cs
diff --git a/pkgs/games/build-support/monogame-patcher/src/patcher.csproj b/pkgs/games/build-support/monogame-patcher/src/patcher.csproj
new file mode 100644
index 00000000..cd8f1c19
--- /dev/null
+++ b/pkgs/games/build-support/monogame-patcher/src/patcher.csproj
@@ -0,0 +1,39 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
+         DefaultTargets="Build">
+
+  <Import Project="$(MSBuildToolsPath)/Microsoft.CSharp.targets" />
+
+  <ItemGroup>
+    <Compile Include="patcher.cs"/>
+    <Compile Include="assembly-info.cs"/>
+  </ItemGroup>
+
+  <PropertyGroup>
+    <!-- I *hate* those long lines with a passion, so let's concat them -->
+    <Blurb>, Culture=neutral, PublicKeyToken=</Blurb>
+
+    <CecilInfo>Version=0.10.0.0$(Blurb)50cebf1cceb9d05e</CecilInfo>
+    <CmdLineInfo>Version=2.2.1.0$(Blurb)de6f01bd326f8c32</CmdLineInfo>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Reference Include="Mono.Cecil, $(CecilInfo)">
+      <SpecificVersion>False</SpecificVersion>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Mono.Cecil.Rocks"/>
+    <Reference Include="CommandLine, $(CmdLineInfo)">
+      <SpecificVersion>False</SpecificVersion>
+      <Private>True</Private>
+    </Reference>
+  </ItemGroup>
+
+  <PropertyGroup>
+    <AssemblyName>monogame-patcher</AssemblyName>
+    <OutputType>Exe</OutputType>
+    <OutDir>bin/Release/</OutDir>
+    <OutputPath>bin/Release</OutputPath>
+    <WarningLevel>4</WarningLevel>
+    <Optimize>true</Optimize>
+  </PropertyGroup>
+</Project>