summaryrefslogtreecommitdiff
path: root/iup.scm
blob: ee761ba224b40c0015dda69b0dd45d580af3b69e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
(define-module (iup)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (gnu packages)
  #:use-module ((gnu packages base) #:prefix base:)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages commencement)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages image)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages xorg)
  #:use-module (guix download)
  #:use-module (guix build utils)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses) #:prefix license:))

(define-public im
  (package
    (name "im")
    (version "3.15")
    (source (origin
              (method url-fetch)
              (uri (string-append
                     "https://sourceforge.net/projects/imtoolkit/files/"
                     version "/Docs%20and%20Sources/im-" version
                     "_Sources.tar.gz"))
              (sha256
                (base32 "1c5p8j7sw3r7kmkd4qa49zmh3dlp5zszp2sagi71aqjq84pngp40"))))

    (inputs (list base:which
                  libpng
                  fftw
                  fftwf))
    (build-system gnu-build-system)
    (arguments
      (list
        #:tests? #f
        #:phases
        #~(modify-phases %standard-phases
            (add-before 'configure 'set-ldflags
              (lambda _
                (substitute*
                  "tecmake.mak"
                  (("STDLDFLAGS := -shared" all)
                   (string-append all " -Wl,-rpath="#$output "/lib")))))
            (delete 'configure)
            ;; Left lua-related libs out of the mix for the moment as they
            ;; have some build errors and I don't need them yet.
            (add-before 'build 'cd
                        (lambda _
                          (chdir "src")))
            (add-before 'build 'build-im
                        (lambda _
                          (invoke "make" "im")))
            (add-before 'build 'build-im-jp2
                        (lambda _
                          (invoke "make" "im_jp2")))
            (add-before 'build 'build-im-process
                        (lambda _
                          (invoke "make" "im_process")))
            (add-before 'build 'build-im-process-omp
                        (lambda _
                          (invoke "make" "im_process_omp")))
            (add-before 'build 'build-im-fftw3
                        (lambda _
                          (invoke "make" "im_fftw3")))
            (delete 'build)
            (replace 'install
              (lambda* (#:key outputs #:allow-other-keys)
                (let* ((include (string-append #$output "/include"))
                       (lib (string-append #$output "/lib")))
                  (mkdir-p include)
                  (mkdir-p lib)
                  (copy-recursively "../include" include)
                  (invoke "find" "../lib" "-exec" "cp" "{}" lib ";")))))))
    (home-page "https://www.tecgraf.puc-rio.br/im")
    (synopsis "IM is a toolkit for image representation, storage, capture and
processing")
    (description "The main goal of the library is to provide a simple API and
abstraction of imaging for scientific applications. The most popular file
formats are supported: TIFF, BMP, PNG, JPEG, GIF and AVI. Image representation
includes scientific data types, and about a hundred Image Processing operations
are available.")
    (license license:expat)))