Subject: Re: [bug#34283] [PATCH]Add: mypaint

From: Yoshinori Arai <[email-masked]>
Date: Thu, 7 Feb 2019 20:13:52 +0900

On Tue, Feb 05, 2019 at 12:42:55PM +0100, Björn Höfling wrote:
> Hi,
> 
> On Sat, 2 Feb 2019 13:44:21 +0900
> Yoshinori Arai <[email-masked]> wrote:
> 
> > Hello,
> > 
> > I made mypaint package from git version.
> > libmypaint-git, mypaint-brushes-git may be conflict with gimp package.
> > 
> > >From c9d5b440a6affccd0852e8686482b64aaef06bea Mon Sep 17 00:00:00
> > >2001  
> > From: Yoshinori Arai <[email-masked]>
> > Date: Sat, 2 Feb 2019 13:23:33 +0900
> > Subject: [PATCH] Add: mypaint
> > 
> > ---
> >  gnu/packages/mypaint.scm | 132
> 
> I have two more notes (hope I'm not redundant):
> 
> We usually just add/modify one package per commit, unless really
> necessary. Could you split your contribution into several patches?
> 
> The commit message should conform to the GNU Changelog Guides, a link
> can be found here:
> 
> https://www.gnu.org/software/guix/manual/en/html_node/Submitting-Patches.html#Submitting-Patches
> 
> For examples see other commits from the git repository. Could you adapt
> your commit's log messages?
> 
> Packaging can sometimes be tricky, so please ask the questions you have.
> 
> Thank you for your contribution,
> 
> Björn

Hello,

I made patch of mypaint, libmypaint, mypaint-brushes again but I am not
accustomed to git operation. I don't know how to split patch one by one.

Also, I don't know which is better my patch is in gimp or graphics.

Please tell me how to make better separate patch or how to handle git/magit to
make patch.

Now, it's my patch as follows.

>From f1cb8c414916b777d68ed509d183bb10fb6a29f2 Mon Sep 17 00:00:00 2001
From: Yoshinori Arai <[email-masked]>
Date: Thu, 7 Feb 2019 16:30:47 +0900
Subject: [PATCH] Add: [email-masked]

---
 gnu/packages/gimp.scm | 56 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/gimp.scm b/gnu/packages/gimp.scm
index cd0deac15..7836b8e66 100644
--- a/gnu/packages/gimp.scm
+++ b/gnu/packages/gimp.scm
@@ -29,6 +29,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system scons)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -37,12 +38,15 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages photo)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages swig)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg))
 
@@ -307,6 +311,58 @@ MyPaint.")
     (home-page "https://github.com/Jehan/mypaint-brushes")
     (license license:cc0)))
 
+(define-public mypaint
+  (package
+    (name "mypaint")
+    (version "1.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/" name "/" name
+                                  "/releases/download/v" version
+                                  "/" name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1iykjvfis5y71wn9wyxpmha7vb4pgr10dbpgglymh33a5ww4j8zd"))))
+    (build-system scons-build-system)
+    (arguments
+     `(#:tests? #f  ;; need graphical environment
+       #:scons ,scons-python2
+       #:scons-flags
+       (list (string-append "numpy_include="
+                            (assoc-ref %build-inputs "python2-numpy")
+                            "/lib/python2.7/site-packages/numpy/core/include")
+             (string-append "prefix=" (assoc-ref %outputs "out")))))
+       ;; README_LINUX.md
+       ;;-If testing outside a graphical environment (anywhere Gdk refuses
+       ;; to initialize), limit the doctests to just `lib/` and `brushlib/`.
+       ;;-There are several interactive GUI tests in the `tests/` folder
+       ;; which `nosetests` does not run - quite intentionally -
+       ;; because their executable bit is set.
+       ;;#:phases
+       ;;(modify-phases %standard-phases
+       ;;  (replace 'check
+       ;;    (lambda _
+       ;;      (invoke "nosetests" "--with-doctest"))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python-2)
+       ("lcms" ,lcms)
+       ("swig" ,swig)))
+       ;;("python-nose" ,python2-nose)))   ;; for test
+    (inputs
+     `(("gettext" ,gettext-minimal)
+       ("libmypaint" ,libmypaint)
+       ("mypaint-brushes" ,mypaint-brushes)))
+    (propagated-inputs
+     `(("gtk+" ,gtk+)
+       ("python2-pygobject" ,python2-pygobject)
+       ("python2-numpy" ,python2-numpy)
+       ("python2-pycairo" ,python2-pycairo)))
+    (home-page "http://mypaint.org/")
+    (synopsis "Simple drawing and painting program")
+    (description "MyPaint is a fast and easy graphics app for digital painters.")
+    (license license:gpl2+)))
+
 (define-public gimp-resynthesizer
   ;; GIMP does not respect any plugin search path environment variable, so after
   ;; installation users have to edit their GIMP settings to include
-- 
2.20.1

>From 9dfc630a8519fe06a8157cc9e57451648e5065a8 Mon Sep 17 00:00:00 2001
From: Yoshinori Arai <[email-masked]>
Date: Thu, 7 Feb 2019 19:34:53 +0900
Subject: [PATCH] Add: libmypaint-2, mypaint-brushes-2, mypaint-2

---
 gnu/packages/gimp.scm | 122 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)

diff --git a/gnu/packages/gimp.scm b/gnu/packages/gimp.scm
index cd0deac15..be9b3fdca 100644
--- a/gnu/packages/gimp.scm
+++ b/gnu/packages/gimp.scm
@@ -29,6 +29,8 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system scons)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -37,12 +39,15 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages photo)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages swig)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xorg))
 
@@ -275,6 +280,28 @@ brushstrokes which is used by MyPaint and GIMP.")
     (home-page "http://mypaint.org")
     (license license:isc)))
 
+(define-public libmypaint-2
+  (package (inherit libmypaint)
+           (version "2.0.0-alpha")
+           (source (origin
+                     (method url-fetch)
+                     (uri (string-append "https://github.com/mypaint/libmypaint/"
+                                         "archive/v" version ".0.tar.gz"))
+                     (sha256
+                      (base32
+                       "1qbmjj7rammw4rma0jawff7q32d4gsy63f11af8dhk07bk4rkxph"))))
+           ;;MyPaint and libmypaint benefit dramatically from autovectorization
+           ;;and other compiler optimizations. from README.md
+           (arguments
+            `(#:make-flags (list "CFLAGS=-Ofast -ftree-vectorize -fopt-info-vec-optimized -march=native -mtune=native -funsafe-math-optimizations -funsafe-loop-optimizations")))
+           (native-inputs
+            `(("intltool" ,intltool)
+              ("libtool" ,libtool)
+              ("automake" ,automake)
+              ("autoconf" ,autoconf)
+              ("python-2" ,python-2)  ;need to generate headers in autogen.sh
+              ("pkg-config" ,pkg-config)))))
+
 (define-public mypaint-brushes
   (package
     (name "mypaint-brushes")
@@ -307,6 +334,101 @@ MyPaint.")
     (home-page "https://github.com/Jehan/mypaint-brushes")
     (license license:cc0)))
 
+(define-public mypaint-brushes-2
+  (package (inherit mypaint-brushes)
+           (version "2.0.1")
+           (source (origin
+                     (method url-fetch)
+                     (uri (string-append "https://github.com/mypaint/mypaint-brushes/"
+                                         "archive/v" version ".tar.gz"))
+                     (sha256
+                      (base32
+                       "0ap2b6n20lnvdm06x91qawk1k8jmxnf7zffxrqxw60fgqd4whwjm"))))))
+
+(define-public mypaint
+  (package
+    (name "mypaint")
+    (version "1.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/" name "/" name
+                                  "/releases/download/v" version
+                                  "/" name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1iykjvfis5y71wn9wyxpmha7vb4pgr10dbpgglymh33a5ww4j8zd"))))
+    (build-system scons-build-system)
+    (arguments
+     `(#:tests? #f  ;; need graphical environment
+       #:scons ,scons-python2
+       #:scons-flags
+       (list (string-append "numpy_include="
+                            (assoc-ref %build-inputs "python2-numpy")
+                            "/lib/python2.7/site-packages/numpy/core/include")
+             (string-append "prefix=" (assoc-ref %outputs "out")))))
+       ;; README_LINUX.md
+       ;;-If testing outside a graphical environment (anywhere Gdk refuses
+       ;; to initialize), limit the doctests to just `lib/` and `brushlib/`.
+       ;;-There are several interactive GUI tests in the `tests/` folder
+       ;; which `nosetests` does not run - quite intentionally -
+       ;; because their executable bit is set.
+       ;;#:phases
+       ;;(modify-phases %standard-phases
+       ;;  (replace 'check
+       ;;    (lambda _
+       ;;      (invoke "nosetests" "--with-doctest"))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python-2)
+       ("lcms" ,lcms)
+       ("swig" ,swig)))
+       ;;("python-nose" ,python2-nose)))   ;; for test
+    (inputs
+     `(("gettext" ,gettext-minimal)
+       ("libmypaint" ,libmypaint)
+       ("mypaint-brushes" ,mypaint-brushes)))
+    (propagated-inputs
+     `(("gtk+" ,gtk+)
+       ("python2-pygobject" ,python2-pygobject)
+       ("python2-numpy" ,python2-numpy)
+       ("python2-pycairo" ,python2-pycairo)))
+    (home-page "http://mypaint.org/")
+    (synopsis "Simple drawing and painting program")
+    (description "MyPaint is a fast and easy graphics app for digital painters.")
+    (license license:gpl2+)))
+
+(define-public mypaint-2
+  (package (inherit mypaint)
+    (version "2.0.0-alpha.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/mypaint/mypaint/"
+                                  "archive/v" version ".tar.gz"))
+              (sha256
+               (base32
+                "0nmcvma2vg2iqlvg8v96d3mppc5cn46591hh8jhppgibcvifc81m"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-for-buildconfig-and-test
+           (lambda _
+             (for-each make-file-writable (find-files "." ".*"))
+             ;; FATAL: Cannot create cache dir '/homeless-shelter
+             (setenv "HOME" "/tmp")))
+         (add-before 'build 'set-cflags
+           (lambda _
+             (setenv "CFLAGS" "-Ofast -ftree-vectorize -fopt-info-vec-optimized -march=native -mtune=native -funsafe-math-optimizations -funsafe-loop-optimizations")))
+         (replace 'install
+           (lambda _
+             (invoke "python" "setup.py" "managed_install"
+                     (string-append "--prefix=" (assoc-ref %outputs "out"))))))))
+    (inputs
+     `(("gettext" ,gettext-minimal)
+       ("libmypaint" ,libmypaint-2)
+       ("mypaint-brushes" ,mypaint-brushes-2)))))
+
 (define-public gimp-resynthesizer
   ;; GIMP does not respect any plugin search path environment variable, so after
   ;; installation users have to edit their GIMP settings to include
-- 
2.20.1