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