Merge pull request #153364 from thiagokokada/pinta-2.0

pinta: 1.7.1 -> 2.0
This commit is contained in:
Thiago Kenji Okada 2022-01-04 10:24:06 -03:00 committed by GitHub
commit c0bd23b130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 66 deletions

View File

@ -1,91 +1,86 @@
{ lib { lib
, buildDotnetModule
, dotnetCorePackages
, fetchFromGitHub , fetchFromGitHub
, buildDotnetPackage , gtk3
, dotnetPackages , installShellFiles
, gtksharp , librsvg
, gettext , makeDesktopItem
, wrapGAppsHook
}: }:
let buildDotnetModule rec {
mono-addins = dotnetPackages.MonoAddins;
in
buildDotnetPackage rec {
pname = "Pinta"; pname = "Pinta";
version = "1.7.1"; version = "2.0";
outputFiles = [ "bin/*" ]; nativeBuildInputs = [
buildInputs = [ gtksharp mono-addins gettext ]; installShellFiles
xBuildFiles = [ "Pinta.sln" ]; wrapGAppsHook
];
runtimeDeps = [ gtk3 ];
dotnet-sdk = dotnetCorePackages.sdk_6_0;
dotnet-runtime = dotnetCorePackages.runtime_6_0;
# How-to update deps:
# $ nix-build -A pinta.fetch-deps
# $ ./result
# $ cp /tmp/Pinta-deps.nix ./pkgs/applications/graphics/pinta/default.nix
# TODO: create update script
nugetDeps = ./deps.nix;
projectFile = "Pinta";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "PintaProject"; owner = "PintaProject";
repo = "Pinta"; repo = "Pinta";
rev = version; rev = version;
sha256 = "sha256-yRp/dpJ9T4DieqHTj3vhyuASPGe4vjHw0rSXFrTNZVc="; sha256 = "sha256-wqqNPyy5h/hTDm2u5MDZx1ds5qWAxy1/BY/fX4PeA88=";
}; };
# Remove version information from nodes <Reference Include="... Version=... "> # FIXME: this should be propagated by wrapGAppsHook already, however for some
postPatch = with lib; let # reason it is not working. Maybe a bug in buildDotnetModule?
csprojFiles = [ preInstall = ''
"Pinta/Pinta.csproj" gappsWrapperArgs+=(
"Pinta.Core/Pinta.Core.csproj" --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}"
"Pinta.Effects/Pinta.Effects.csproj" --set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
"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"
];
stripVersion = name: file:
let
match = ''<Reference Include="${name}([ ,][^"]*)?"'';
replace = ''<Reference Include="${name}"'';
in
"sed -i -re 's/${match}/${replace}/g' ${file}\n";
# Map all possible pairs of two lists
map2 = f: listA: listB: concatMap (a: map (f a) listB) listA;
concatMap2Strings = f: listA: listB: concatStrings (map2 f listA listB);
in
concatMap2Strings stripVersion versionedNames csprojFiles
+ ''
# For some reason there is no Microsoft.Common.tasks file
# in ''${mono}/lib/mono/3.5 .
substituteInPlace Pinta.Install.proj \
--replace 'ToolsVersion="3.5"' 'ToolsVersion="4.0"' \
--replace "/usr/local" "$out"
''; '';
makeWrapperArgs = [
"--prefix MONO_GAC_PREFIX : ${gtksharp}"
"--prefix LD_LIBRARY_PATH : ${gtksharp}/lib"
"--prefix LD_LIBRARY_PATH : ${gtksharp.gtk.out}/lib"
];
postInstall = '' postInstall = ''
# Do automake's job manually # Rename the binary
substitute xdg/pinta.desktop.in xdg/pinta.desktop \ mv $out/bin/Pinta $out/bin/pinta
# Copy desktop icons
for size in 16x16 22x22 24x24 32x32 96x96 scalable; do
mkdir -p $out/share/icons/hicolor/$size/apps
cp xdg/$size/* $out/share/icons/hicolor/$size/apps/
done
# Copy runtime icons
cp -r Pinta.Resources/icons/hicolor/16x16/* $out/share/icons/hicolor/16x16/
# Install manpage
installManPage xdg/pinta.1
# Fix and copy desktop file
# TODO: fix this propely by using the autoreconf+pkg-config build system
# from upstream
mkdir -p $out/share/applications
substitute xdg/pinta.desktop.in $out/share/applications/Pinta.desktop \
--replace _Name Name \ --replace _Name Name \
--replace _Comment Comment \ --replace _Comment Comment \
--replace _GenericName GenericName \ --replace _GenericName GenericName \
--replace _X-GNOME-FullName X-GNOME-FullName --replace _X-GNOME-FullName X-GNOME-FullName \
substitute xdg/pinta.appdata.xml.in xdg/pinta.appdata.xml \ --replace _Keywords Keywords
--replace _p p
xbuild /target:CompileTranslations Pinta.Install.proj
xbuild /target:Install Pinta.Install.proj
''; '';
meta = { meta = {
homepage = "https://www.pinta-project.com/"; homepage = "https://www.pinta-project.com/";
description = "Drawing/editing program modeled after Paint.NET"; description = "Drawing/editing program modeled after Paint.NET";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = with lib.maintainers; [ ]; maintainers = with lib.maintainers; [ thiagokokada ];
platforms = with lib.platforms; linux; platforms = with lib.platforms; linux;
}; };
} }

View File

@ -0,0 +1,12 @@
{ fetchNuGet }: [
(fetchNuGet { pname = "AtkSharp"; version = "3.24.24.34"; sha256 = "1jn1vgi9xm0jp7769k6sbdi8d273kigjrsh93i6s4c03hqxv7cqs"; })
(fetchNuGet { pname = "CairoSharp"; version = "3.24.24.34"; sha256 = "0pydn1k0cam1gclg9sc1sbnmbyzh28qlc5qanyxcylwghink3kgz"; })
(fetchNuGet { pname = "GdkSharp"; version = "3.24.24.34"; sha256 = "0r0x0yib7chwsyrbpvicrfwldwqx5lyqq4p86zaxpmzd6zdaj0x5"; })
(fetchNuGet { pname = "GioSharp"; version = "3.24.24.34"; sha256 = "02hxvgjd4w9jpzbkk7qf9q9bkvyp5hfzwxfqp10vg5lpl9yl3xpx"; })
(fetchNuGet { pname = "GLibSharp"; version = "3.24.24.34"; sha256 = "0kvp033fgdwc8p2abfp5z9pzq66cvwbnjfvr4v4bkpy5s5h181kq"; })
(fetchNuGet { pname = "GtkSharp"; version = "3.24.24.34"; sha256 = "0028hzmmqyfx87qqmaf9cgb5psn7gkbmqvixcid67x1d6mzxjicb"; })
(fetchNuGet { pname = "NGettext"; version = "0.6.7"; sha256 = "1lnq1lgd80xqn80qwq5ipfjnd7nl1ghinjc3krnd546r0c7hwqky"; })
(fetchNuGet { pname = "PangoSharp"; version = "3.24.24.34"; sha256 = "1r0h14cklglfpv1lhv93cxmzi2w7d5s03gzpq3j5dmrz43flg9zw"; })
(fetchNuGet { pname = "ParagonClipper"; version = "6.4.2"; sha256 = "0pam44f7iayqjz8nh1x29gxdd4dj00i7m5883cpa64i192pgl94c"; })
(fetchNuGet { pname = "SharpZipLib"; version = "1.3.3"; sha256 = "1gij11wfj1mqm10631cjpnhzw882bnzx699jzwhdqakxm1610q8x"; })
]

View File

@ -27962,9 +27962,7 @@ with pkgs;
pinpoint = callPackage ../applications/office/pinpoint { }; pinpoint = callPackage ../applications/office/pinpoint { };
pinta = callPackage ../applications/graphics/pinta { pinta = callPackage ../applications/graphics/pinta { };
gtksharp = gtk-sharp-2_0;
};
pistol = callPackage ../tools/misc/pistol { }; pistol = callPackage ../tools/misc/pistol { };