nes.scm 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
  2. ;;;
  3. ;;; This program is free software; you can redistribute it and/or modify it
  4. ;;; under the terms of the GNU General Public License as published by
  5. ;;; the Free Software Foundation; either version 3 of the License, or (at
  6. ;;; your option) any later version.
  7. ;;;
  8. ;;; This program is distributed in the hope that it will be useful, but
  9. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;;; GNU General Public License for more details.
  12. ;;;
  13. ;;; You should have received a copy of the GNU General Public License
  14. ;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. (define-module (nes)
  16. #:use-module (guix packages)
  17. #:use-module (gnu packages)
  18. #:use-module ((guix licenses) #:prefix license:)
  19. #:use-module (guix download)
  20. #:use-module (guix git-download)
  21. #:use-module (guix build-system gnu)
  22. #:use-module (guix build-system scons)
  23. #:use-module (guix build-system trivial)
  24. #:use-module (gnu packages bash)
  25. #:use-module (gnu packages compression)
  26. #:use-module (gnu packages fontutils)
  27. #:use-module (gnu packages gd)
  28. #:use-module (gnu packages gl)
  29. #:use-module (gnu packages gtk)
  30. #:use-module (gnu packages lua)
  31. #:use-module (gnu packages pkg-config)
  32. #:use-module (gnu packages python)
  33. #:use-module (gnu packages python-xyz)
  34. #:use-module (gnu packages sdl))
  35. (define-public cc65
  36. (package
  37. (name "cc65")
  38. (version "2.17")
  39. (source (origin
  40. (method url-fetch)
  41. (uri (string-append "https://github.com/cc65/cc65/archive/V"
  42. version ".tar.gz"))
  43. (sha256
  44. (base32 "1b1fdl8vn674hrc0837gwlp90yk5347rbf50kbpnrz2vcls9df3k"))
  45. (file-name (string-append name "-" version ".tar.gz"))))
  46. (build-system gnu-build-system)
  47. (arguments
  48. '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  49. #:tests? #f ; no check target
  50. #:phases
  51. (modify-phases %standard-phases
  52. (delete 'configure)))) ; no configure script
  53. (home-page "https://cc65.github.io/cc65/")
  54. (synopsis "C compiler for the 6502 microprocessor")
  55. (description "@code{cc65} is a complete cross development package for
  56. 65(C)02 systems, including a powerful macro assembler, a C compiler, linker,
  57. librarian and several other tools.")
  58. (license license:zlib)))
  59. (define-public fceux
  60. (package
  61. (name "fceux")
  62. (version "2.2.3")
  63. (source (origin
  64. (method url-fetch)
  65. (uri (string-append "mirror://sourceforge/fceultra/Source Code/"
  66. version " src/" name "-" version ".src.tar.gz"))
  67. (sha256
  68. (base32 "0gl2i3qdmcm7v9m5kpfz98w05d8m33990jiwka043ya7lflxvrjb"))
  69. (file-name (string-append name "-" version ".tar.gz"))))
  70. (build-system scons-build-system)
  71. (arguments
  72. `(#:tests? #f ; no tests
  73. #:scons ,scons-python2
  74. #:scons-flags
  75. (list (string-append "--prefix=" (assoc-ref %outputs "out"))
  76. ; Build with GTK+ version 2 GUI support.
  77. "GTK=1"
  78. ; Don't use the third-party bundled libraries.
  79. "SYSTEM_LUA=1"
  80. "SYSTEM_MINIZIP=1")
  81. #:phases
  82. (modify-phases %standard-phases
  83. (add-after 'unpack 'scons-propagate-environment
  84. (lambda _
  85. ;; By design, SCons does not, by default, propagate
  86. ;; environment variables to subprocesses. See:
  87. ;; <http://comments.gmane.org/gmane.linux.distributions.nixos/4969>
  88. ;; Here, we modify the SConstruct file to arrange for
  89. ;; environment variables to be propagated.
  90. (substitute* "SConstruct"
  91. (("^env = Environment\\(")
  92. "env = Environment(ENV=os.environ, "))
  93. #t)))))
  94. (native-inputs
  95. `(("pkg-config" ,pkg-config)))
  96. (inputs
  97. `(("gd" ,gd)
  98. ("glu" ,glu)
  99. ("gtk+" ,gtk+-2)
  100. ("lua" ,lua-5.1)
  101. ("minizip" ,minizip)
  102. ("sdl" ,sdl)
  103. ("zlib" ,zlib)))
  104. (home-page "http://www.fceux.com")
  105. (synopsis
  106. "Nintendo Entertainment System (NES/Famicom) emulator based on FCE Ultra")
  107. (description
  108. "FCEUX is a Nintendo Entertainment System (NES), Famicom, Famicom
  109. Disk System (FDS), and Dendy emulator. It supports NTSC (USA/JPN), PAL
  110. (European), and NTSC-PAL Hybrid modes.")
  111. (license license:gpl2+)))
  112. (define-public pilbmp2nes
  113. (let ((commit "1b75379d30e6d7cf7b6e389e402c56f27f7e57a1")
  114. (revision "1"))
  115. (package
  116. (name "pilbmp2nes")
  117. (version (git-version "0.0" revision commit))
  118. (source (origin
  119. (method git-fetch)
  120. (uri (git-reference
  121. (url "https://github.com/pinobatch/nrom-template")
  122. (commit commit)))
  123. (sha256
  124. (base32
  125. "0xqvjdsy4953rywnrnsyz5yvkqwmjv865dv5ridavl02am73mzv8"))
  126. (file-name (git-file-name name version))))
  127. (build-system trivial-build-system)
  128. (native-inputs
  129. `(("source" ,source)))
  130. (inputs
  131. `(("bash" ,bash) ; for wrap-program
  132. ("python" ,python)
  133. ("python-pillow" ,python-pillow)))
  134. (arguments
  135. '(#:modules ((guix build utils))
  136. #:builder (begin
  137. (use-modules (guix build utils))
  138. (let* ((source (assoc-ref %build-inputs "source"))
  139. (bash (assoc-ref %build-inputs "bash"))
  140. (python (string-append
  141. (assoc-ref %build-inputs "python")
  142. "/bin/python3"))
  143. (python-pillow
  144. (string-append
  145. (assoc-ref %build-inputs "python-pillow")
  146. "/lib/python3.6/site-packages"))
  147. (output (assoc-ref %outputs "out"))
  148. (bin (string-append output "/bin"))
  149. (executable (string-append bin "/pilbmp2nes")))
  150. (mkdir-p bin)
  151. (copy-file (string-append source "/tools/pilbmp2nes.py")
  152. executable)
  153. ;; Use the correct python interpreter.
  154. (substitute* executable
  155. (("#!/usr/bin/env python3")
  156. (string-append "#!" python)))
  157. ;; Ensure that bash is in PATH so wrap-program can detect
  158. ;; it.
  159. (setenv "PATH" (string-append bash "/bin"))
  160. (wrap-program executable
  161. `("PYTHONPATH" ":" prefix (,python-pillow)))
  162. #t))))
  163. (home-page "https://github.com/pinobatch/nrom-template")
  164. (synopsis "Bitmap to multi-console CHR converter using Pillow")
  165. (description
  166. "@code{pilbmp2nes} is a command-line converter from indexed BMP or PNG to
  167. multiple video game consoles' tile formats.")
  168. (license
  169. (license:non-copyleft
  170. ;; GNU All-Permissive License
  171. "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")))))