pinta: 1.4 -> 1.6

This commit is contained in:
Demin Dmitriy 2015-10-29 05:59:32 +03:00
parent dc70fcd94b
commit 0ec62e0759

View File

@ -1,44 +1,63 @@
{stdenv, fetchurl, mono, gtksharp, pkgconfig}: { stdenv, fetchFromGitHub, buildDotnetPackage, dotnetPackages, gtksharp }:
stdenv.mkDerivation { let
name = "pinta-1.4"; mono-addins = dotnetPackages.MonoAddins;
in
buildDotnetPackage rec {
name = "pinta-1.6";
src = fetchurl { baseName = "Pinta";
url = "https://github.com/PintaProject/Pinta/tarball/3f7ccfa93d"; version = "1.6";
name = "pinta-1.4.tar.gz"; outputFiles = [ "bin/*" ];
sha256 = "1kgb4gy5l6bd0akniwhiqqkvqayr5jgdsvn2pgg1038q9raafnpn"; buildInputs = [ gtksharp mono-addins ];
xBuildFiles = [ "Pinta.sln" ];
src = fetchFromGitHub {
owner = "PintaProject";
repo = "Pinta";
rev = version;
sha256 = "0vgswy981c7ys4q7js5k85sky7bz8v32wsfq3br4j41vg92pw97d";
}; };
buildInputs = [mono gtksharp pkgconfig]; # Remove version information from nodes <Reference Include="... Version=... ">
postPatch = with stdenv.lib; let
csprojFiles = [
"Pinta/Pinta.csproj"
"Pinta.Core/Pinta.Core.csproj"
"Pinta.Effects/Pinta.Effects.csproj"
"Pinta.Gui.Widgets/Pinta.Gui.Widgets.csproj"
"Pinta.Resources/Pinta.Resources.csproj"
"Pinta.Tools/Pinta.Tools.csproj"
];
versionedNames = [
"Mono\\.Addins"
"Mono\\.Posix"
"Mono\\.Addins\\.Gui"
"Mono\\.Addins\\.Setup"
];
buildPhase = '' stripVersion = name: file: let
# xbuild understands pkgconfig, but gtksharp does not give .pc for gdk-sharp match = ''<Reference Include="${name}([ ,][^"]*)?"'';
# So we have to go the GAC-way replace = ''<Reference Include="${name}"'';
export MONO_GAC_PREFIX=${gtksharp} in "sed -i -re 's/${match}/${replace}/g' ${file}\n";
xbuild Pinta.sln
'';
# Very ugly - I don't know enough Mono to improve this. Isn't there any rpath in binaries? # Map all possible pairs of two lists
installPhase = '' map2 = f: listA: listB: concatMap (a: map (f a) listB) listA;
mkdir -p $out/lib/pinta $out/bin concatMap2Strings = f: listA: listB: concatStrings (map2 f listA listB);
cp bin/*.{dll,exe} $out/lib/pinta in
cat > $out/bin/pinta << EOF concatMap2Strings stripVersion versionedNames csprojFiles;
#!/bin/sh
export MONO_GAC_PREFIX=${gtksharp}:\$MONO_GAC_PREFIX
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${gtksharp}/lib:${gtksharp.gtk}/lib:${mono}/lib
exec ${mono}/bin/mono $out/lib/pinta/Pinta.exe
EOF
chmod +x $out/bin/pinta
'';
# Always needed on Mono, otherwise nothing runs makeWrapperArgs = [
dontStrip = true; ''--prefix MONO_GAC_PREFIX ':' "${gtksharp}"''
''--prefix LD_LIBRARY_PATH ':' "${gtksharp}/lib"''
''--prefix LD_LIBRARY_PATH ':' "${gtksharp.gtk}/lib"''
];
meta = { meta = {
homepage = http://www.pinta-project.com/; homepage = http://www.pinta-project.com/;
description = "Drawing/editing program modeled after Paint.NET"; description = "Drawing/editing program modeled after Paint.NET";
license = stdenv.lib.licenses.mit; license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [viric]; maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; linux; platforms = with stdenv.lib.platforms; linux;
}; };
} }