fltk.scm 6.0 KB

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