lego.scm 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016, 2017, 2019 Eric Bavier <bavier@posteo.net>
  3. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  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 lego)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix download)
  22. #:use-module (guix git-download)
  23. #:use-module (guix packages)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages bison)
  27. #:use-module (gnu packages compression)
  28. #:use-module (gnu packages flex)
  29. #:use-module (gnu packages gl)
  30. #:use-module (gnu packages qt))
  31. (define-public nqc
  32. (package
  33. (name "nqc")
  34. (version "3.1.r6")
  35. (source (origin
  36. ;; XXX Using url-fetch/tarbomb results in failure:
  37. ;; Error: could not create compiler/rcx1_nqh.h
  38. (method url-fetch)
  39. (uri (string-append "http://bricxcc.sourceforge.net/nqc/release/"
  40. "nqc-" version ".tgz"))
  41. (sha256
  42. (base32
  43. "0rp7pzr8xrdxpv75c2mi8zszzz2ypli4vvzxiic7mbrryrafdmdz"))))
  44. (build-system gnu-build-system)
  45. (native-inputs
  46. `(("bison" ,bison)
  47. ("flex" ,flex)
  48. ("add-usb-tcp-support.patch"
  49. ,(origin
  50. (method url-fetch)
  51. (uri (string-append "https://sourceforge.net/p/bricxcc/patches/"
  52. "_discuss/thread/00b427dc/b84b/attachment/"
  53. "nqc-01-Linux_usb_and_tcp.diff"))
  54. (sha256
  55. (base32 "0z5gx55ra1kamhhqxz08lvvwslfl36pbmwdd566rhmbgmyhlykbr"))))
  56. ("debian-writable-swap-inst-len.patch"
  57. ,(origin
  58. (method url-fetch)
  59. (uri (string-append "https://sources.debian.org/data/main/n/nqc/"
  60. "3.1.r6-7/debian/patches/"
  61. "writable-swap-inst-len.patch"))
  62. (sha256
  63. (base32 "1kr7j057aa5i0kxmlfpbfcsif5yq2lrmjw4sljn400ijaq4mys3v"))))))
  64. (arguments
  65. '(#:tests? #f ;no tests
  66. #:make-flags (list (string-append "PREFIX=" %output))
  67. #:phases
  68. (modify-phases %standard-phases
  69. (delete 'configure)
  70. (add-before 'build 'rm-generated
  71. ;; Regenerating compiler/lexer.cpp avoids an 'undefined
  72. ;; reference to `isatty(int)'' error.
  73. (lambda _
  74. (for-each delete-file
  75. '("compiler/lexer.cpp"
  76. "compiler/parse.cpp"))
  77. #t))
  78. (add-after 'unpack 'deal-with-tarbomb
  79. (lambda _
  80. (chdir "..") ;tarbomb
  81. #t))
  82. (add-after 'deal-with-tarbomb 'patch
  83. (lambda* (#:key inputs #:allow-other-keys)
  84. (for-each (lambda (patch)
  85. (invoke "patch" "-Np1" "-i"
  86. (assoc-ref inputs patch)))
  87. (list "add-usb-tcp-support.patch"
  88. "debian-writable-swap-inst-len.patch")))))))
  89. (home-page "http://bricxcc.sourceforge.net/nqc/")
  90. (synopsis "C-like language for Lego's MINDSTORMS")
  91. (description
  92. "Not Quite C (NQC) is a simple language for programming several Lego
  93. MINDSTORMS products. The preprocessor and control structures of NQC are very
  94. similar to C. NQC is not a general purpose language -- there are many
  95. restrictions that stem from limitations of the standard RCX firmware.")
  96. (license license:mpl1.0)))
  97. (define-public leocad
  98. (package
  99. (name "leocad")
  100. (version "19.07.1")
  101. (source (origin
  102. (method git-fetch)
  103. (uri (git-reference
  104. (url "https://github.com/leozide/leocad")
  105. (commit (string-append "v" version))))
  106. (file-name (git-file-name name version))
  107. (sha256
  108. (base32
  109. "02kv1m18g6s4dady9jv4sjivfkrp192bmdw2a3d9lzlp60zks0p2"))))
  110. (build-system gnu-build-system)
  111. (native-inputs
  112. `(("qttools" ,qttools))) ; for lrelease
  113. (inputs
  114. `(("mesa" ,mesa)
  115. ("qtbase" ,qtbase-5)
  116. ("zlib" ,zlib)))
  117. (arguments
  118. '(#:tests? #f
  119. #:phases
  120. (modify-phases %standard-phases
  121. (replace 'configure
  122. (lambda* (#:key outputs inputs #:allow-other-keys)
  123. (let ((out (assoc-ref outputs "out")))
  124. (invoke "qmake"
  125. (string-append "INSTALL_PREFIX=" out)
  126. ;; Otherwise looks for lrelease-qt4.
  127. "QMAKE_LRELEASE=lrelease"
  128. ;; Don't pester users about updates.
  129. "DISABLE_UPDATE_CHECK=1")
  130. #t)))
  131. (add-after 'configure 'reset-resource-timestamps
  132. (lambda _
  133. ;; The contents of build/release/.qrc/qrc_leocad.cpp generated by
  134. ;; qt's rcc tool depends on the timestamps in resources/*, in
  135. ;; particular the leocad_*.qm files that are created by qmake
  136. ;; above. So reset those timestamps for a reproducible build.
  137. (with-directory-excursion "resources"
  138. (for-each (lambda (file)
  139. (let* ((base (basename file ".qm"))
  140. (src (string-append base ".ts"))
  141. (st (stat src)))
  142. (set-file-time file st)))
  143. (find-files "." "leocad_.*\\.qm")))
  144. #t)))))
  145. (home-page "https://www.leocad.org")
  146. (synopsis "Create virtual Lego models")
  147. (description
  148. "LeoCAD is a program for creating virtual LEGO models. It has an
  149. intuitive interface, designed to allow new users to start creating new models
  150. without having to spend too much time learning the application. LeoCAD is
  151. fully compatible with the LDraw Standard and related tools.")
  152. (license license:gpl2+)))