gnu: Use 'modify-phases' syntax.
[jackhill/guix/guix.git] / gnu / packages / fltk.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages fltk)
23 #:use-module ((guix licenses) #:select (lgpl2.0 lgpl2.0+))
24 #:use-module (gnu packages)
25 #:use-module (gnu packages compression)
26 #:use-module (gnu packages image)
27 #:use-module (gnu packages xorg)
28 #:use-module (gnu packages gl)
29 #:use-module (gnu packages gtk) ;for "cairo"
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages python)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system waf))
37
38 (define-public fltk
39 (package
40 (name "fltk")
41 (version "1.3.3")
42 (source
43 (origin
44 (method url-fetch)
45 (uri (string-append "http://fltk.org/pub/fltk/" version
46 "/fltk-" version "-source.tar.gz"))
47 (sha256
48 (base32
49 "15qd7lkz5d5ynz70xhxhigpz3wns39v9xcf7ggkl0792syc8sfgq"))
50 (patches (search-patches "fltk-shared-lib-defines.patch"
51 "fltk-xfont-on-demand.patch"))))
52 (build-system gnu-build-system)
53 (inputs
54 `(("libjpeg" ,libjpeg-8) ;jpeg_read_header argument error in libjpeg-9
55 ("libpng" ,libpng)
56 ("libx11" ,libx11)
57 ("libxft" ,libxft)
58 ("mesa" ,mesa)
59 ("zlib" ,zlib)))
60 (arguments
61 `(#:tests? #f ;TODO: compile programs in "test" dir
62 #:configure-flags
63 (list "--enable-shared"
64 (string-append "DSOFLAGS=-Wl,-rpath=" %output "/lib"))
65 #:phases
66 (modify-phases %standard-phases
67 (add-before 'configure 'patch-makeinclude
68 (lambda _
69 (substitute* "makeinclude.in"
70 (("/bin/sh") (which "sh")))
71 #t))
72 (add-after 'install 'patch-config
73 ;; Provide -L flags for image libraries when querying fltk-config to
74 ;; avoid propagating inputs.
75 (lambda* (#:key inputs outputs #:allow-other-keys)
76 (use-modules (srfi srfi-26))
77 (let* ((conf (string-append (assoc-ref outputs "out")
78 "/bin/fltk-config"))
79 (jpeg (assoc-ref inputs "libjpeg"))
80 (png (assoc-ref inputs "libpng"))
81 (zlib (assoc-ref inputs "zlib")))
82 (substitute* conf
83 (("-ljpeg") (string-append "-L" jpeg "/lib -ljpeg"))
84 (("-lpng") (string-append "-L" png "/lib -lpng"))
85 (("-lz") (string-append "-L" zlib "/lib -lz"))))
86 #t)))))
87 (home-page "http://www.fltk.org")
88 (synopsis "3D C++ GUI library")
89 (description "FLTK is a C++ GUI toolkit providing modern GUI functionality
90 without the bloat. It supports 3D graphics via OpenGL and its built-in GLUT
91 emulation. FLTK is designed to be small and modular enough to be statically
92 linked, but works fine as a shared library. FLTK also includes an excellent
93 UI builder called FLUID that can be used to create applications in minutes.")
94 (license lgpl2.0))) ; plus certain additional permissions
95
96 (define-public ntk
97 (package
98 (name "ntk")
99 (version "1.3.0")
100 (source (origin
101 (method git-fetch)
102 (uri (git-reference
103 (url "git://git.tuxfamily.org/gitroot/non/fltk.git")
104 (commit (string-append "v" version))))
105 (sha256
106 (base32
107 "0ggrh6rihf676z1vfgpgcl6kpqwyh39ih0hskcgzklh7fphfik39"))
108 (file-name (string-append name "-" version "-checkout"))))
109 (build-system waf-build-system)
110 (arguments
111 `(#:tests? #f ;no "check" target
112 #:python ,python-2
113 #:configure-flags '("--enable-gl")
114 #:phases
115 (modify-phases %standard-phases
116 (add-before
117 'configure 'set-ldflags
118 (lambda* (#:key outputs #:allow-other-keys)
119 (setenv "LDFLAGS"
120 (string-append "-Wl,-rpath="
121 (assoc-ref outputs "out") "/lib")))))))
122 (inputs
123 `(("libjpeg" ,libjpeg)
124 ("glu" ,glu)))
125 ;; ntk.pc lists "x11" and "xft" in Requires.private, and "cairo" in
126 ;; Requires.
127 (propagated-inputs
128 `(("cairo" ,cairo)
129 ("libxft" ,libxft)
130 ("libx11" ,libx11)))
131 (native-inputs
132 `(("pkg-config" ,pkg-config)))
133 (home-page "http://non.tuxfamily.org/ntk/")
134 (synopsis "Fork of FLTK with graphics rendering via Cairo")
135 (description "The Non Tool Kit (NTK) is a fork of the Fast Light ToolKit
136 library, adding improved graphics rendering via Cairo, a streamlined and
137 enhanced widget set, and other features designed to improve the appearance and
138 performance of the Non applications.")
139 (license lgpl2.0+))) ; plus certain additional permissions