root/gtkradiant.scm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
(define-module (hidamari-blue gtkradiant)
  #:use-module (guix packages)
  #:use-module (ice-9 match)
  #:use-module (guix utils)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix svn-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system scons)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses) #:renamer (symbol-prefix-proc 'license:))
  #:use-module (gnu packages)
  #:use-module (gnu packages python)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages base)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages fonts)
  #:use-module (gnu packages image)
  #:use-module (gnu packages games)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages video)
  #:use-module (gnu packages mp3)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages wxwidgets)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages perl))

(define-public gtkradiant
  (let ((commit "69972f94582f0723c9ceaabf6751a911bf1fdcc3")
        (data-packs '(("Q3Pack" 138 "1m8c1f26rrc89ad1fijwc7m3gjmzj59v4kawd7zhqqlcpvc47854")
                      ("UrTPack" 138 "08nn7l9b1zgyqkjsvn0pvl82ivnr5limpnadg4i43mhs4hvw820d")
                      ("ETPack" 138 "02dfg5xdjqnii949zh0xjb0k5yv2z86jirqy0s05xz65hwwrd9ls")
                      ("QLPack" 138 "0fa4pnb8yyl17kik5j16sag1608jfcdjmyb2f5ykky9ivlwhnxch")
                      ("Q2Pack" 138 "1xdyy86sfb0kmdpfi98nvjgqir5mdyw5628br7wrrwdnbx2ivpv9")
                      ("QuetooPack" 138 "1bivwhanm4fz8d2jbd92fndqi5pf0mbhwvwb9mmlcm0xk0yfbrj8")
                      ("JAPack" 138 "06nh5fqyg65wg7f77knff7m6q5jlcfscimihjsjw96y3qn809bvi")
                      ("STVEFPack" 138 "04hyi48il5l922a9fd4c29zqkba4yd1cgmn20r4530wz5ra75qxa")
                      ("WolfPack" 138 "1z2ax6g4s1fx5vfdlbvrxgm2yagfbw98b0aiflfi8wl8m3lf9pgb"))))
    ;; The homepage says:
    ;;   "We do not currently have Linux packages for GtkRadiant 1.6.5.
    ;;    We recommend users compile the latest version from the source code."
    ;; There are no tags in the git repository.
    ;; The source download links to the generated github master.tar.gz
    ;; https://icculus.org/gtkradiant/downloads.html
    (package
     (name "gtkradiant")
     (version "1.6.5-69972f9")
     (source (origin (method git-fetch)
                     (uri (git-reference
                           (url "https://github.com/TTimo/GtkRadiant/")
                           (commit commit)))
                     (sha256
                      (base32
                       "1psrk7kjsh15d6d4wams5nxi2h0g7ksbgi6nzcpybiqxf989dg4k"))))
     (arguments `(#:tests?
                  #f                    ;no test target, but some config tests?
                  #:scons
                  ,scons-python2
                  #:phases
                  (modify-phases
                   %standard-phases
                   (add-after
                    'unpack 'extract-subversion
                    (lambda* (#:key outputs inputs #:allow-other-keys)
                      (let ((out (assoc-ref outputs "out")))
                        (mkdir-p (string-append out "/bin"))
                        (mkdir-p (string-append out "/share/gtkradiant"))
                        (mkdir-p (string-append out "/share/gtkradiant/modules"))
                        (mkdir-p (string-append out "/share/gtkradiant/installs"))
                        (for-each
                         (lambda (name)
                           ;; (mkdir-p (string-append "install/installs/" name))
                           (copy-recursively (string-append (assoc-ref inputs name))
                                             (string-append out "/share/gtkradiant/installs/" name)))
                         (list ,@(map car data-packs)))
                        (substitute* "config.py"
                                     (("cmd = \\[ 'svn', 'update', path \\]")
                                      "cmd = [ 'echo', 'already prefeched to', path ]"))

                        (substitute* "config.py"
                                     (("self\\.install_directory = 'install'")
                                      (string-append
                                       "self.install_directory = '" out "/share/gtkradiant'")))
                        (substitute* "config.py"
                                     (("install/modules")
                                      (string-append out "/share/gtkradiant/modules")))

                        #t)))
                   (add-after
                    'install 'actually-install-stuff
                    (lambda* (#:key outputs #:allow-other-keys)
                      (let ((out (assoc-ref outputs "out")))
                        (rename-file (string-append out "/share/gtkradiant/q3data") (string-append out "/bin/q3data"))
                        (rename-file (string-append out "/share/gtkradiant/q3map2") (string-append out "/bin/q3map2"))
                        (rename-file (string-append out "/share/gtkradiant/q3map2_urt") (string-append out "/bin/q3map2_urt"))
                        ;; rename to avoid collisions with other radiants
                        (rename-file (string-append out "/share/gtkradiant/radiant.bin") (string-append out "/bin/gtkradiant"))
                        ;; ;; TODO tell the radiant.bin where these dirs are during configure
                        ;; (copy-recursively "install/modules" (string-append out "/share/gtkradiant/modules"))
                        ;; (copy-recursively "install/installs" (string-append out "/share/gtkradiant/installs"))
                        ;; (copy-recursively "install/games" (string-append out "/share/gtkradiant/games"))
                        ;; (copy-recursively "install/bitmaps" (string-append out "/share/gtkradiant/bitmaps"))
                        )
                      #t)
                    ))))
     (build-system scons-build-system)
     (inputs `(("libgtk2" ,gtk+-2)
               ("libxml2" ,libxml2)
               ("glu" ,glu)
               ("gtkglext" ,gtkglext)
               ("libjpeg" ,libjpeg)
               ;; ("libmikmod" ,libmikmod)
               ;; ("libvorbis" ,libvorbis)
               ;; ("libxmp" ,libxmp)
               ("mesa" ,mesa)
               ;; ("mpg123" ,mpg123)
               ;; ("sdl2" ,sdl2)
               ))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ,@(map
           (match-lambda
            ((name revision hash)
             (list
              name
              (origin
               (method svn-fetch)
               (uri (svn-reference
                     (url (string-append "svn://svn.icculus.org/gtkradiant-gamepacks/"
                                         name "/trunk"))
                     (revision revision)))
               (file-name (string-append name "-data.tar.gz"))
               (sha256 (base32 hash))))))
           data-packs)))
     (synopsis "map editor for quake first person shooters")
     (description "first person shooter map editor")
     (home-page "https://icculus.org/gtkradiant/")
     (license license:gpl2))))