arcan.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019 L p R n d n <guix@lprndn.info>
  3. ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu packages arcan)
  20. #:use-module (guix build-system cmake)
  21. #:use-module (guix build-system gnu)
  22. #:use-module (guix git-download)
  23. #:use-module ((guix licenses) #:prefix license:)
  24. #:use-module (guix packages)
  25. #:use-module (guix utils)
  26. #:use-module (gnu packages apr)
  27. #:use-module (gnu packages audio)
  28. #:use-module (gnu packages autotools)
  29. #:use-module (gnu packages compression)
  30. #:use-module (gnu packages databases)
  31. #:use-module (gnu packages fontutils)
  32. #:use-module (gnu packages freedesktop)
  33. #:use-module (gnu packages gl)
  34. #:use-module (gnu packages glib)
  35. #:use-module (gnu packages gtk)
  36. #:use-module (gnu packages image)
  37. #:use-module (gnu packages libusb)
  38. #:use-module (gnu packages linux)
  39. #:use-module (gnu packages lua)
  40. #:use-module (gnu packages ocr)
  41. #:use-module (gnu packages pcre)
  42. #:use-module (gnu packages pkg-config)
  43. #:use-module (gnu packages ruby)
  44. #:use-module (gnu packages sdl)
  45. #:use-module (gnu packages sqlite)
  46. #:use-module (gnu packages tls)
  47. #:use-module (gnu packages video)
  48. #:use-module (gnu packages xdisorg)
  49. #:use-module (gnu packages xorg)
  50. #:use-module (srfi srfi-1))
  51. (define-public arcan
  52. (let ((commit "b4dd1fbd1938492ff4b269189d3c8524be7450a9")
  53. (revision "1"))
  54. (package
  55. (name "arcan")
  56. (version (git-version "0.5.5.2" revision commit))
  57. (source (origin
  58. (method git-fetch)
  59. (file-name (git-file-name name version))
  60. (uri (git-reference
  61. (url "https://github.com/letoram/arcan")
  62. (commit commit)))
  63. (sha256
  64. (base32 "1pd0avlzc2rig1hd37zbhc7r2s6fjzdhshfg9l9cfzibl7caclyw"))))
  65. (build-system cmake-build-system)
  66. (arguments
  67. `(#:configure-flags '("-DCMAKE_C_FLAGS=-fcommon"
  68. "-DVIDEO_PLATFORM=egl-dri" "-DBUILTIN_LUA=off"
  69. "-DSTATIC_OPENAL=off""-DENABLE_LWA=on"
  70. "-DSTATIC_SQLITE3=off" "-DSTATIC_FREETYPE=off"
  71. "-DSHMIF_TUI_ACCEL=on")
  72. #:phases
  73. (modify-phases %standard-phases
  74. (add-after 'unpack 'fix-cmake-paths
  75. (lambda* (#:key inputs #:allow-other-keys)
  76. (substitute* "src/platform/cmake/modules/FindGBMKMS.cmake"
  77. (("/usr/local/include/libdrm")
  78. (search-input-directory inputs "include/libdrm")))
  79. (substitute* "src/platform/cmake/modules/FindAPR.cmake"
  80. (("/usr/local/apr/include/apr-1")
  81. (search-input-directory inputs "include/apr-1")))
  82. #t))
  83. ;; Normally, it tries to fetch patched openal with git
  84. ;; but copying files manually in the right place seems to work too.
  85. (add-after 'unpack 'prepare-static-openal
  86. (lambda* (#:key inputs #:allow-other-keys)
  87. (let ((arcan-openal (assoc-ref inputs "arcan-openal")))
  88. (copy-recursively arcan-openal "external/git/openal"))
  89. #t))
  90. (add-after 'prepare-static-openal 'generate-man
  91. (lambda _
  92. (with-directory-excursion "doc"
  93. (invoke "ruby" "docgen.rb" "mangen"))
  94. #t))
  95. (add-before 'configure 'chdir
  96. (lambda _
  97. (chdir "src")
  98. #t))
  99. (add-after 'install 'wrap-program
  100. (lambda* (#:key outputs #:allow-other-keys)
  101. (let ((out (assoc-ref outputs "out")))
  102. (wrap-program (string-append out "/bin/arcan")
  103. `("ARCAN_RESOURCEPATH" ":" suffix
  104. (,(string-append out "/share/arcan/resources")))
  105. `("ARCAN_STATEBASEPATH" ":" =
  106. ("$HOME/.arcan/resources/savestates"))
  107. `("ARCAN_STATEPATH" ":" =
  108. ("$HOME/.arcan/resources/savestates"))
  109. `("ARCAN_BINPATH" ":" =
  110. (,(string-append out "/bin/arcan_frameserver")))))
  111. #t)))
  112. #:tests? #f))
  113. (native-search-paths
  114. (list (search-path-specification
  115. (variable "ARCAN_APPLBASEPATH")
  116. (separator #f)
  117. (files '("share/arcan/appl")))
  118. (search-path-specification
  119. (variable "ARCAN_SCRIPTPATH")
  120. (separator #f)
  121. (files '("share/arcan/scripts")))))
  122. (inputs
  123. `(("apr" ,apr)
  124. ("ffmpeg" ,ffmpeg)
  125. ("freetype" ,freetype)
  126. ("glib" ,glib)
  127. ("glu" ,glu)
  128. ("harfbuzz" ,harfbuzz)
  129. ("libdrm" ,libdrm)
  130. ("libusb" ,libusb)
  131. ("libxkbcommon" ,libxkbcommon)
  132. ("lua" ,luajit)
  133. ("lzip" ,lzip)
  134. ("openal" ,openal)
  135. ("pcre" ,pcre)
  136. ("sqlite" ,sqlite)
  137. ("tesseract-ocr" ,tesseract-ocr)
  138. ("leptonica" ,leptonica)
  139. ("vlc" ,vlc)
  140. ;; To build arcan_lwa, we need a patched version of openal.
  141. ;; https://github.com/letoram/arcan/wiki/packaging
  142. ("arcan-openal" ,(origin
  143. (method git-fetch)
  144. (file-name "arcan-openal-0.5.4")
  145. (uri (git-reference
  146. (url "https://github.com/letoram/openal")
  147. (commit "1c7302c580964fee9ee9e1d89ff56d24f934bdef")))
  148. (sha256
  149. (base32
  150. "0dcxcnqjkyyqdr2yk84mprvkncy5g172kfs6vc4zrkklsbkr8yi2"))))))
  151. (native-inputs
  152. `(("pkg-config" ,pkg-config)
  153. ("ruby" ,ruby))) ; For documentation and testing
  154. (home-page "https://arcan-fe.com")
  155. (synopsis "Display server, multimedia framework and game engine (egl-dri)")
  156. (description "Arcan is a development framework for creating virtually
  157. anything from user interfaces for specialized embedded applications
  158. all the way to full-blown desktop environments. At its heart lies a multimedia
  159. engine programmable using Lua.")
  160. ;; https://github.com/letoram/arcan/blob/master/COPYING
  161. (license (list license:gpl2+
  162. license:lgpl2.0
  163. license:lgpl2.0+
  164. license:public-domain
  165. license:bsd-3)))))
  166. (define-public arcan-sdl
  167. (package
  168. (inherit arcan)
  169. (name "arcan-sdl")
  170. (inputs
  171. `(("sdl" ,sdl)
  172. ,@(fold alist-delete (package-inputs arcan)
  173. '("libdrm"))))
  174. (arguments
  175. `(,@(ensure-keyword-arguments
  176. (package-arguments arcan)
  177. '(#:configure-flags
  178. '("-DCMAKE_C_FLAGS=-fcommon"
  179. "-DVIDEO_PLATFORM=sdl" "-DBUILTIN_LUA=off"
  180. "-DSTATIC_OPENAL=off" "-DDISABLE_JIT=off"
  181. "-DENABLE_LWA=on" "-DSTATIC_SQLITE3=off"
  182. "-DSTATIC_FREETYPE=off" "-DSHMIF_TUI_ACCEL=on")))))
  183. (synopsis "Combined display server, multimedia framework and game engine (SDL)")))
  184. (define-public xarcan
  185. (let ((commit "8e6ee029388326cfe5cddeffe482eb3702e9b7f3")
  186. (revision "1" ))
  187. (package
  188. (name "xarcan")
  189. (version (git-version "0.5.4" revision commit))
  190. (source
  191. (origin
  192. (method git-fetch)
  193. (file-name (git-file-name name version))
  194. (uri (git-reference
  195. (url "https://github.com/letoram/xarcan")
  196. (commit commit)))
  197. (sha256
  198. (base32 "0zng7cs6733mnf0p6g5wv02981f2sf567n56csax6cmzb8fpamym"))))
  199. (build-system gnu-build-system)
  200. (arguments
  201. `(#:configure-flags
  202. `("--enable-kdrive" "--enable-xarcan"
  203. "--disable-xorg" "--disable-xwayland"
  204. "--disable-xnest" "--disable-xvfb"
  205. "--enable-glamor" "--enable-glx"
  206. "--disable-int10-module" "--enable-ipv6"
  207. "--enable-record" "--without-systemd-daemon"
  208. "--enable-xcsecurity" "--disable-static"
  209. ,(string-append "--with-xkb-path="
  210. (assoc-ref %build-inputs "xkeyboard-config")
  211. "/share/X11/xkb")
  212. ,(string-append "--with-xkb-bin-directory="
  213. (assoc-ref %build-inputs "xkbcomp")
  214. "/bin")
  215. ,(string-append "--with-xkb-output="
  216. "/tmp")))) ; FIXME: Copied from xorg
  217. (native-inputs
  218. `(("pkg-config" ,pkg-config)
  219. ("autoconf" ,autoconf)
  220. ("automake" ,automake)
  221. ("libtool" ,libtool)
  222. ("util-macros" ,util-macros)))
  223. (inputs
  224. `(("arcan" ,arcan)
  225. ("font-util" ,font-util)
  226. ("libdrm" ,libdrm)
  227. ("libepoxy" ,libepoxy)
  228. ("libkbfile" ,libxkbfile)
  229. ("libressl" ,libressl)
  230. ("libx11" ,libx11)
  231. ("libxfont2" ,libxfont2)
  232. ("mesa" ,mesa)
  233. ("pixman" ,pixman)
  234. ("xkeyboard-config" ,xkeyboard-config)
  235. ("xkbcomp" ,xkbcomp)
  236. ("xorgproto" ,xorgproto)
  237. ("xtrans" ,xtrans)))
  238. (home-page "https://arcan-fe.com")
  239. (synopsis "Patched Xserver that bridges connections to Arcan")
  240. (description "Patched Xserver with a KDrive backend that uses the arcan-shmif
  241. to map Xlib/Xcb/X clients to a running arcan instance. It allows running an X session
  242. as a window under Arcan.")
  243. (license license:expat))))
  244. (define-public arcan-wayland
  245. (package
  246. (inherit arcan)
  247. (name "arcan-wayland")
  248. (native-inputs
  249. `(("pkg-config" ,pkg-config)))
  250. (inputs
  251. `(("arcan" ,arcan)
  252. ("libseccomp" ,libseccomp)
  253. ("libxkbcommon" ,libxkbcommon)
  254. ("mesa" ,mesa)
  255. ("wayland" ,wayland)
  256. ("wayland-protocols" ,wayland-protocols)))
  257. (arguments
  258. `(#:tests? #f
  259. #:phases
  260. (modify-phases %standard-phases
  261. (add-before 'configure 'chdir
  262. (lambda _
  263. (chdir "src/tools/waybridge")
  264. #t))
  265. (add-after 'unpack 'fix-cmake-find-shmif
  266. (lambda* (#:key inputs #:allow-other-keys)
  267. (substitute* "src/platform/cmake/modules/Findarcan_shmif.cmake"
  268. (("/usr/local") (assoc-ref inputs "arcan")))
  269. #t)))))
  270. (synopsis "Wayland protocol service for Arcan")
  271. (description "Arcan-wayland (waybridge) bridges Wayland connections
  272. with an Arcan connection point. It allows Wayland compatible clients
  273. to connect and render using Arcan.")
  274. (license license:bsd-3)))