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>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
38 ;; XXX Using url-fetch/tarbomb results in failure:
39 ;; Error: could not create compiler/rcx1_nqh.h
41 (uri (string-append "http://bricxcc.sourceforge.net/nqc/release/"
42 "nqc-" version ".tgz"))
45 "0rp7pzr8xrdxpv75c2mi8zszzz2ypli4vvzxiic7mbrryrafdmdz"))))
46 (build-system gnu-build-system)
50 ("add-usb-tcp-support.patch"
53 (uri (string-append "https://sourceforge.net/p/bricxcc/patches/"
54 "_discuss/thread/00b427dc/b84b/attachment/"
55 "nqc-01-Linux_usb_and_tcp.diff"))
57 (base32 "0z5gx55ra1kamhhqxz08lvvwslfl36pbmwdd566rhmbgmyhlykbr"))))
58 ("debian-writable-swap-inst-len.patch"
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"))
65 (base32 "1kr7j057aa5i0kxmlfpbfcsif5yq2lrmjw4sljn400ijaq4mys3v"))))))
67 '(#:tests? #f ;no tests
68 #:make-flags (list (string-append "PREFIX=" %output))
70 (modify-phases %standard-phases
72 (add-before 'build 'rm-generated
73 ;; Regenerating compiler/lexer.cpp avoids an 'undefined
74 ;; reference to `isatty(int)'' error.
77 '("compiler/lexer.cpp"
78 "compiler/parse.cpp"))
80 (add-after 'unpack 'deal-with-tarbomb
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")
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)))
100 (define-public leocad
107 (url "https://github.com/leozide/leocad")
108 (commit (string-append "v" version))))
109 (file-name (git-file-name name version))
112 "02kv1m18g6s4dady9jv4sjivfkrp192bmdw2a3d9lzlp60zks0p2"))))
113 (build-system gnu-build-system)
115 `(("qttools" ,qttools))) ; for lrelease
123 (modify-phases %standard-phases
125 (lambda* (#:key outputs inputs #:allow-other-keys)
126 (let ((out (assoc-ref outputs "out")))
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")
134 (add-after 'configure 'reset-resource-timestamps
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"))
145 (set-file-time file st)))
146 (find-files "." "leocad_.*\\.qm")))
148 (home-page "https://www.leocad.org")
149 (synopsis "Create virtual Lego models")
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+)))