Re: Trying to package GIMP Resynthesizer

2018-11-07 Thread swedebugia

On 2018-09-21 13:19, Thorsten Wilms wrote:

I somehow managed to end up with parts in
~/.guix-profile/lib/gimp/2.0/plug-ins
and the rest in
~/.guix-profile/lib/gimp/2.0/plug-ins/plug-ins

After removing, collecting garbage and installing again with 
"/plug-ins" removed from the string manipulation, things work as they 
should.

CONGRATULATIONS! :-)

--
Cheers
Swedebugia




Re: Trying to package GIMP Resynthesizer

2018-09-21 Thread Thorsten Wilms

On 20.09.2018 22:14, Thorsten Wilms wrote:

---
Calling error for procedure 'gimp-procedural-db-proc-info':
Procedure 'plug-in-resynthesizer' not found
---
Traceback (most recent call last):
   File 
"/gnu/store/2l3zsn1fliq5yw6g2wqpivqwkv602c10-gimp-2.10.6/lib/gimp/2.0/python/gimpfu.py", 
line 740, in response

     dialog.res = run_script(params)
   File 
"/gnu/store/2l3zsn1fliq5yw6g2wqpivqwkv602c10-gimp-2.10.6/lib/gimp/2.0/python/gimpfu.py", 
line 361, in run_script

     return apply(function, params)
   File 
"/home/thorwil/.guix-profile/lib/gimp/2.0/plug-ins/plugin-heal-selection.py", 
line 148, in heal_selection
     pdb.plug_in_resynthesizer(timg, tdrawable, 0,0, useBorder, 
work_drawable.ID, -1, -1, 0.0, 0.117, 16, 500)

error: procedure not found
---


I somehow managed to end up with parts in
~/.guix-profile/lib/gimp/2.0/plug-ins
and the rest in
~/.guix-profile/lib/gimp/2.0/plug-ins/plug-ins

After removing, collecting garbage and installing again with "/plug-ins" 
removed from the string manipulation, things work as they should.



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



Re: Trying to package GIMP Resynthesizer

2018-09-20 Thread Thorsten Wilms

On 20.09.2018 15:43, Thorsten Wilms wrote:

Still have to actually run it! ;)


... so in GIMP's Edit > Preferences > Folders > Plug-ins, I added:
"/home/thorwil/.guix-profile/lib/gimp/2.0/plug-ins/"
and restarted GIMP. Then I tried to use Filters > Enhance > Heal 
Selection and got:


---
Calling error for procedure 'gimp-procedural-db-proc-info':
Procedure 'plug-in-resynthesizer' not found
---
Traceback (most recent call last):
  File 
"/gnu/store/2l3zsn1fliq5yw6g2wqpivqwkv602c10-gimp-2.10.6/lib/gimp/2.0/python/gimpfu.py", 
line 740, in response

dialog.res = run_script(params)
  File 
"/gnu/store/2l3zsn1fliq5yw6g2wqpivqwkv602c10-gimp-2.10.6/lib/gimp/2.0/python/gimpfu.py", 
line 361, in run_script

return apply(function, params)
  File 
"/home/thorwil/.guix-profile/lib/gimp/2.0/plug-ins/plugin-heal-selection.py", 
line 148, in heal_selection
pdb.plug_in_resynthesizer(timg, tdrawable, 0,0, useBorder, 
work_drawable.ID, -1, -1, 0.0, 0.117, 16, 500)

error: procedure not found
---

Any ideas?


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



Re: Trying to package GIMP Resynthesizer

2018-09-20 Thread Thorsten Wilms

Case solved!

On 20.09.2018 13:11, Ludovic Courtès wrote:

Next, in phase install:

---
make[3]: Entering directory
'/tmp/guix-build-gimp-resynthesizer-2.0.3.drv-0/resynthesizer-2.0.3/src/resynthesizer'
  /gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/mkdir
-p
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'

/gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install
-c resynthesizer
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'
/gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install:
cannot create regular file
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins/resynthesizer':
Permission denied

“make install” is trying to install the plugin under GIMP’s prefix,
which is read-only.

The solution is to adjust the gimp-resynthesizer makefile variables so
that the plugin gets installed to $(libdir)/gimp/2.0/plug-ins—i.e.,
under/gnu/store/…-gimp-resnythesizer-2.0.3/lib.


I figured that's what is being done for gimp-fourier, but the Makefile 
situation here is different and I had trouble finding out that there are 
2 Makefiles that need to be patched!


This here builds:

---
(define-module (gimp-resynthesizer)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gimp)
  )

;; GIMP does not respect any plugin search path environment variable, so 
after

;; installation users have to edit their GIMP settings to include
;; “$GUIX_PROFILE/lib/gimp/2.0/plug-ins” in
;; “Edit->Preferences->Folders->Plug Ins”.

(define-public gimp-resynthesizer
  (package
   (name "gimp-resynthesizer")
   (version "2.0.3")
   (source
(origin
 (method url-fetch)
 (uri (string-append 
"https://github.com/bootchk/resynthesizer/archive/v";

 version
 ".tar.gz"))
 (sha256 (base32 
"0l3404w6rqny7h3djskxf149gzx6x4qhndgbh3403c9lbh4pi1kr"

   (build-system gnu-build-system)
   (arguments
`(;; Turn off tests to avoid:
  ;; make[1]: *** No rule to make target '../src/resynth-gui.c', 
needed by 'resynthesizer.pot'.  Stop.

  #:tests? #f
  #:phases
  (modify-phases %standard-phases
(add-after 'unpack 'set-env
  (lambda _
(setenv "CONFIG_SHELL" (which "sh"))
#t))
(add-after 'configure 'set-prefix
  ;; Attempt to install to GIMP's plugin directory will fail.
  ;; Use own store address.
  (lambda* (#:key outputs #:allow-other-keys)
(let ((target (string-append (assoc-ref outputs "out")
 "/lib/gimp/"
 (car (string-split 
,(package-version gimp) #\.))

 ".0/plug-ins")))
  (substitute* (list "src/resynthesizer/Makefile"
 "src/resynthesizer-gui/Makefile")
(("GIMP_LIBDIR = .*")
 (string-append "GIMP_LIBDIR = " target "\n")))
  (mkdir-p target))
#t))
)))
   (native-inputs
`(("autoconf" ,autoconf-wrapper)
  ("automake" ,automake)
  ("glib" ,glib "bin") ; glib-gettextize
  ("intltool" ,intltool)
  ("pkg-config" ,pkg-config)))
   (inputs
`(("gimp" ,gimp)
  ("gdk-pixbuf" ,gdk-pixbuf) ; needed by gimp-2.0.pc
  ("cairo" ,cairo)
  ("gegl" ,gegl)
  ("gtk+" ,gtk+-2) ; needed by gimpui-2.0.pc
  ("glib" ,glib)))
   (home-page "https://github.com/bootchk/resynthesizer";)
   (synopsis "GIMP plugins for texture synthesis")
   (description
"Resynthesizer plugins for GIMP. Encompasses tools for healing 
selections (content aware fill), enlarging the canvas and healing the 
border, increasing the resolution while adding detail and transfering 
the style of an image.")

   (license license:gpl3+)))

---

Still have to actually run it! ;)


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



Re: Trying to package GIMP Resynthesizer

2018-09-20 Thread Ludovic Courtès
Hello Thorsten,

Thorsten Wilms  skribis:

> Next, in phase install:
>
> ---
> make[3]: Entering directory
> '/tmp/guix-build-gimp-resynthesizer-2.0.3.drv-0/resynthesizer-2.0.3/src/resynthesizer'
>  /gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/mkdir
> -p 
> '/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'
>
> /gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install
> -c resynthesizer
> '/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'
> /gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install:
> cannot create regular file
> '/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins/resynthesizer':
> Permission denied

“make install” is trying to install the plugin under GIMP’s prefix,
which is read-only.

The solution is to adjust the gimp-resynthesizer makefile variables so
that the plugin gets installed to $(libdir)/gimp/2.0/plug-ins—i.e.,
under /gnu/store/…-gimp-resnythesizer-2.0.3/lib.

HTH!

Ludo’.



Re: Trying to package GIMP Resynthesizer

2018-09-20 Thread Thorsten Wilms

On 20.09.2018 04:55, Maxim Cournoyer wrote:


./configure: line 9047: /bin/sh: No such file or directory



I've had this before, and the way I could work around it was by setting the SHELL 
environment variable. Grep for 'setenv "SHELL"' in the package sources and I'm 
sure you'll find instances of that.


Great suggestion, thanks!

`guix/gnu/packages: grep -B 10 -A 5 'setenv "SHELL' *`
made for a nice list of examples.

This addition makes configure pass:
---
(arguments
  `(#:phases
 (modify-phases %standard-phases
   (add-after 'unpack 'set-env
  (lambda _
(setenv "CONFIG_SHELL" (which "sh"))
#t)
---

Then, in phase check:

---
make[1]: Entering directory 
'/tmp/guix-build-gimp-resynthesizer-2.0.3.drv-0/resynthesizer-2.0.3/po'
make[1]: *** No rule to make target '../src/resynth-gui.c', needed by 
'resynthesizer.pot'.  Stop.
make[1]: Leaving directory 
'/tmp/guix-build-gimp-resynthesizer-2.0.3.drv-0/resynthesizer-2.0.3/po'

make: *** [Makefile:403: check-recursive] Error 1
---

I found no trace of this being a known issue, or a solution by grep-ing 
sources for .pot, so I just added `#:tests? #f` to arguments.



Next, in phase install:

---
make[3]: Entering directory 
'/tmp/guix-build-gimp-resynthesizer-2.0.3.drv-0/resynthesizer-2.0.3/src/resynthesizer'
 /gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/mkdir 
-p 
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'


/gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install 
-c resynthesizer 
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins'
/gnu/store/63gkgnixg6xj3m9cgl25ib2zxl51ngw0-coreutils-8.29/bin/install: 
cannot create regular file 
'/gnu/store/kc1s39xl3wzkb5cfsavvbrgri4751zmk-gimp-2.10.6/lib/gimp/2.0/plug-ins/resynthesizer': 
Permission denied

---


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



Re: Trying to package GIMP Resynthesizer

2018-09-19 Thread Maxim Cournoyer
Hi Thorsten,


On September 19, 2018 12:25:23 PM UTC, Thorsten Wilms  wrote:
>Hi!
>
>I'm trying to package https://github.com/bootchk/resynthesizer
>
>Unfortunately, this happens:
>
>---
>$: guix build --keep-failed gimp-resynthesizer
>checking that generated files are newer than configure... done
>configure: creating ./config.status
>./configure: line 9047: /bin/sh: No such file or directory
>---

I've had this before, and the way I could work around it was by setting the 
SHELL environment variable. Grep for 'setenv "SHELL"' in the package sources 
and I'm sure you'll find instances of that.

I'm not sure of the root cause, probably there are some hard-coded paths 
somewhere that should be patched in one of our packages?

HTH!

Maxim




Trying to package GIMP Resynthesizer

2018-09-19 Thread Thorsten Wilms

Hi!

I'm trying to package https://github.com/bootchk/resynthesizer

Unfortunately, this happens:

---
$: guix build --keep-failed gimp-resynthesizer
checking that generated files are newer than configure... done
configure: creating ./config.status
./configure: line 9047: /bin/sh: No such file or directory
---

What I have so far:

---

(define-module (gimp-resynthesizer)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gimp))

;; GIMP does not respect any plugin search path environment variable, so 
after

;; installation users have to edit their GIMP settings to include
;; “$GUIX_PROFILE/lib/gimp/2.0/plug-ins” in
;; “Edit->Preferences->Folders->Plug Ins”.


(define-public gimp-resynthesizer
  (package
   (name "gimp-resynthesizer")
   (version "2.0.3")
   (source
(origin
 (method url-fetch)
 (uri (string-append 
"https://github.com/bootchk/resynthesizer/archive/v";

 version
 ".tar.gz"))
 (sha256 (base32 
"0l3404w6rqny7h3djskxf149gzx6x4qhndgbh3403c9lbh4pi1kr"

   (build-system gnu-build-system)
   (native-inputs
`(("autoconf" ,autoconf-wrapper)
  ("automake" ,automake)
  ("glib" ,glib "bin") ; glib-gettextize
  ("intltool" ,intltool)
  ("pkg-config" ,pkg-config)))
   (inputs
`(("gimp" ,gimp)
  ("gdk-pixbuf" ,gdk-pixbuf) ; needed by gimp-2.0.pc
  ("cairo" ,cairo)
  ("gegl" ,gegl)
  ("gtk+" ,gtk+-2) ; needed by gimpui-2.0.pc
  ("glib" ,glib)))
   (home-page "https://github.com/bootchk/resynthesizer";)
   (synopsis "GIMP plugins for texture synthesis")
   (description
"Resynthesizer plugins for GIMP. Encompasses tools for healing 
selections (content aware fill), enlarging the canvas and healing the 
border, increasing the resolution while adding detail and transfering 
the style of an image.")

   (license license:gpl3+)))

---

Since I hardly know what I'm doing, I have been bothering people in 
#guix and using gimp-fourier from gimp.scm as reference:


---

(define-public gimp-fourier
  (package
(name "gimp-fourier")
(version "0.4.3-2")
(source (origin
  (method url-fetch)
  (uri (string-append "http://registry.gimp.org/files/fourier-";
  version ".tar.gz"))
  (sha256
   (base32
"1rpacyad678lqgxa3hh2n0zpg4azs8dpa8q079bqsl12812k9184"
(build-system gnu-build-system)
(arguments
 `(#:tests? #f ;no tests
   #:phases
   (modify-phases %standard-phases
 ;; FIXME: The gegl package only installs "gegl-0.4.pc", but
 ;; "gimp-2.0.pc" requires "gegl-0.3.pc", so we just copy it.
 (replace 'configure
   (lambda* (#:key inputs #:allow-other-keys)
 (mkdir-p "tmppkgconfig")
 (copy-file (string-append (assoc-ref inputs "gegl")
   "/lib/pkgconfig/gegl-0.4.pc")
"tmppkgconfig/gegl-0.3.pc")
 (setenv "PKG_CONFIG_PATH"
 (string-append "tmppkgconfig:"
(or (getenv "PKG_CONFIG_PATH") "")))
 #t))
 (add-after 'unpack 'set-prefix
   (lambda* (#:key outputs #:allow-other-keys)
 ;; gimptool-2.0 does not allow us to install to any target
 ;; directory.
 (let ((target (string-append (assoc-ref outputs "out")
  "/lib/gimp/"
  (car (string-split 
,(package-version gimp) #\.))

  ".0/plug-ins")))
   (substitute* "Makefile"
 (("\\$\\(PLUGIN_INSTALL\\) fourier")
  (string-append "cp fourier " target)))
   (mkdir-p target))
 #t)
(inputs
 `(("fftw" ,fftw)
   ("gimp" ,gimp)
   ;; needed by gimp-2.0.pc
   ("gdk-pixbuf" ,gdk-pixbuf)
   ("gegl" ,gegl)
   ("cairo" ,cairo)
   ("glib" ,glib)
   ;; needed by gimpui-2.0.pc
   ("gtk+" ,gtk+-2)))
(native-inputs
 `(("pkg-config" ,pkg-config)))
(home-page "http://registry.gimp.org/node/19596";)
(synopsis "GIMP plug-in to edit image in fourier space")
(description
 "This package provides a simple plug-in to apply the fourier 
transform on

an image, allowing you to work with the transformed image inside GIMP.  You
can draw or apply filters in fourier space and get the modified image 
with an

inverse fourier transform.")
(license license:gpl3+)))

---

I suspect I will need the (add-after 'unpack 'set-prefix ...) form, too, 
but ... one step at a time and no cargo-culting :)


I've been to