guix-more/more/packages/virtualbox.scm

virtualbox.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages virtualbox)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (guix packages)
22
  #:use-module (guix download)
23
  #:use-module (guix svn-download)
24
  #:use-module (guix git-download)
25
  #:use-module (guix build-system gnu)
26
  #:use-module (gnu packages)
27
  #:use-module (gnu packages admin)
28
  #:use-module (gnu packages autotools)
29
  #:use-module (gnu packages base)
30
  #:use-module (gnu packages bison)
31
  #:use-module (more packages cdrom)
32
  #:use-module (gnu packages curl)
33
  #:use-module (gnu packages flex)
34
  #:use-module (gnu packages gettext)
35
  #:use-module (gnu packages gl)
36
  #:use-module (gnu packages gnome)
37
  #:use-module (gnu packages image)
38
  #:use-module (gnu packages linux)
39
  #:use-module (gnu packages m4)
40
  #:use-module (gnu packages perl)
41
  #:use-module (gnu packages pkg-config)
42
  #:use-module (gnu packages python)
43
  #:use-module (gnu packages qt)
44
  #:use-module (gnu packages sdl)
45
  #:use-module (gnu packages texinfo)
46
  #:use-module (gnu packages tls)
47
  #:use-module (gnu packages video)
48
  #:use-module (gnu packages xml)
49
  #:use-module (gnu packages xorg))
50
51
(define-public kbuild
52
  (package
53
    (name "kbuild")
54
    (version "0.1.9998")
55
    ;(version "0.1.5-p2")
56
    (source (origin
57
              ;(method url-fetch)
58
              ;(uri (string-append "ftp://ftp.netlabs.org/pub/kbuild/kBuild-"
59
              ;                    version "-src.tar.gz"))
60
              ;(sha256
61
              ; (base32
62
              ;  "19j2sswdqqjzjzmg0xam8nmwmxg422iii0fl9cwzcznjfigdn1c2"))))
63
              ;(method svn-fetch)
64
              ;(uri (svn-reference
65
              ;       (url "http://svn.netlabs.org/repos/kbuild/trunk")
66
              ;       (revision 3224)))
67
              ;(file-name (string-append name "-" version))
68
              ;(sha256
69
              ; (base32
70
              ;  "0dvp6j61v92afhkz392zbk0myx27mzqpqcfqr7yyaj3kigbnmal8"))))
71
              (method git-fetch)
72
              (uri (git-reference
73
                     (url "https://framagit.org/tyreunom/kbuild-snapshot.git")
74
                     (commit "f3a865c4671242524860097c819152447a03a7f7")))
75
              (file-name (string-append name "-" version))
76
              (sha256
77
               (base32
78
                "1xkirw4xdwpgcrvnwdqdr7d3fyg6yg2dzgyi83vxmvib6k4xwvxr"))))
79
    (build-system gnu-build-system)
80
    (native-inputs
81
     `(("autoconf" ,autoconf)
82
       ("automake" ,automake)
83
       ("bison" ,bison)
84
       ("flex" ,flex)
85
       ("gettext-minimal" ,gettext-minimal)
86
       ("perl" ,perl)
87
       ("pkg-config" ,pkg-config)
88
       ("texinfo" ,texinfo)))
89
    (arguments
90
     `(#:tests? #f
91
       #:phases
92
       (modify-phases %standard-phases
93
         (delete 'configure)
94
         (add-before 'patch-generated-file-shebangs 'reconfigure
95
           (lambda _
96
             (chdir "src/kmk")
97
             (substitute* "Makefile.am"
98
               (("AM_CPPFLAGS =") "AM_CPPFLAGS = -I$(srcdir)/../lib//kStuff/include")
99
               (("kmkbuiltin\\.c")
100
                "kmkbuiltin.c kmkbuiltin/getopt_r.c kmkbuiltin/getopt1_r.c")
101
               (("kmk_redirect_SOURCES =")
102
                "kmk_redirect_SOURCES = output.c"))
103
             (system* "autoreconf" "-fiv")
104
             (chdir "../..")))
105
         (add-before 'build 'fix-binaries
106
           (lambda _
107
             (substitute* "Config.kmk"
108
               (("\\+= rt") "+= rt pthread"))
109
             (substitute* "src/kash/output.h"
110
               (("dprintf") "debugprintf"))
111
             (substitute* "src/kash/output.c"
112
               (("dprintf") "debugprintf"))
113
             (substitute* "bootstrap.gmk"
114
               ((" /bin/sh") (string-append " " (which "sh")))
115
               ((" /bin/echo") (string-append " " (which "echo"))))
116
             (substitute* "kBuild/env.sh"
117
               (("/bin/pwd") (which "pwd")))))
118
         (add-before 'build 'fix-errors
119
           (lambda _
120
             (copy-file "src/sed/po/Makefile.in.in" "src/kmk/po/Makefile.in.in")
121
             (substitute* "src/kmk/kmkbuiltin.c"
122
               (("int kmk_builtin_dircache.*")
123
                "int kmk_builtin_dircache(int argc, char **argv, char **envp, PKMKBUILTINCTX pCtx)"))
124
             (substitute* "src/kmk/kmkbuiltin.h"
125
               (("#include <fcntl.h>")
126
                "#include <fcntl.h>\n#include <stdint.h>"))
127
             (substitute* "src/kmk/output.h"
128
               (("#define INCLUDED_MAKE_OUTPUT_H")
129
                "#define INCLUDED_MAKE_OUTPUT_H\n#include <stdio.h>"))
130
             (substitute* "src/kmk/kmkbuiltin/install.c"
131
               (("\tuid") "\tThis.uid")
132
               (("\tgid") "\tThis.gid"))
133
             (substitute* "src/kmk/kmkbuiltin/rm.c"
134
               (("\\(vflag\\)") "(pThis->vflag)"))
135
             (substitute* "src/kmk/kmkbuiltin/getopt_r.h"
136
               (("typedef struct") "#include <stddef.h>\ntypedef struct"))
137
             (substitute* "src/kmk/output.c"
138
               (("unsigned int stdio_traced = 0;")
139
                "unsigned int stdio_traced = 0;\nssize_t output_write_text (struct output *out, int is_err, const char *src, size_t len){return len;}"))
140
             ;  (("/\\* write/fwrite like function, text mode. \\*/") "#endif")
141
             ;  (("return output_write_bin \\(out, is_err, src, len\\);")
142
             ;   "return output_write_bin (out, is_err, src, len);\n#if 1"))
143
             #t))
144
         (replace 'build
145
           (lambda _
146
             (zero? (system* "kBuild/env.sh" "--full" "make" "-f" "bootstrap.gmk"
147
                             "AUTORECONF=true"
148
                             (string-append "CONFIG_SHELL=" (which "sh"))
149
                             (string-append "AR=" (which "ar"))))))
150
         (replace 'install
151
           (lambda* (#:key outputs #:allow-other-keys)
152
             (zero? (system* "kBuild/env.sh" "kmk" "PATH_INS=/"
153
                             (string-append "NIX_INSTALL_DIR="
154
                                            (assoc-ref outputs "out")))))))))
155
    (home-page "http://trac.netlabs.org/kbuild/wiki")
156
    (synopsis "Makefile framework")
157
    (description "kBuild is a makefile framework for writing simple makefiles
158
for complex tasks.")
159
    (license license:gpl3+)))
160
161
(define-public acpica-unix
162
  (package
163
    (name "acpica-unix")
164
    (version "20170303")
165
    (home-page "https://www.acpica.org")
166
    (source (origin
167
              (method url-fetch)
168
              (uri (string-append
169
                     "https://acpica.org/sites/acpica/files/acpica-unix-"
170
                     version ".tar.gz"))
171
              (sha256
172
               (base32
173
                "1dc933rr11gv1nlaf5j8ih1chdakbjbjkn34jgbm330zppmck4y0"))))
174
    (build-system gnu-build-system)
175
    (native-inputs
176
     `(("m4" ,m4)
177
       ("bison" ,bison)
178
       ("flex" ,flex)))
179
    (arguments
180
     `(#:tests? #f; no check target
181
       #:make-flags
182
       (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
183
       #:phases
184
       (modify-phases %standard-phases
185
         (delete 'configure)
186
         (add-before 'build 'goto-dir
187
           (lambda _
188
             (chdir "generate/unix")
189
             (zero? (system* "make" "clean")))))))
190
    (synopsis "")
191
    (description "")
192
    (license license:gpl2+)))
193
194
(define-public virtualbox
195
  (package
196
    (name "virtualbox")
197
    (version "5.2.8")
198
    (source (origin
199
              (method url-fetch)
200
              (uri (string-append
201
                    "http://download.virtualbox.org/virtualbox/" version
202
                    "/VirtualBox-" version ".tar.bz2"))
203
              (file-name (string-append name "-" version ".tar.bz2"))
204
              (sha256
205
               (base32
206
                "1s44h0d2khclkgkfgcwpq09dpckzr22r8737icdwhjhbgga5j9zf"))
207
              (modules '((guix build utils)))
208
              (snippet
209
                `(begin
210
                   ;; TODO: frmts contains a lot more bundled code.
211
                   (for-each delete-file-recursively
212
                     '("src/libs/libpng-1.2.54"
213
                       "src/libs/libxml2-2.9.4"
214
                       "src/libs/zlib-1.2.8"))))))
215
    (build-system gnu-build-system)
216
    (native-inputs
217
     `(;("kbuild" ,kbuild)
218
       ("pkg-config" ,pkg-config)
219
       ("which" ,which)))
220
    (inputs
221
     `(("acpica" ,acpica); for iasl
222
       ("alsa" ,alsa-lib)
223
       ("curl" ,curl)
224
       ("cdrtools" ,cdrtools)
225
       ("glu" ,glu)
226
       ("libidl" ,libidl)
227
       ("libpng" ,libpng)
228
       ("libvpx" ,libvpx)
229
       ("libxcursor" ,libxcursor)
230
       ("libxext" ,libxext)
231
       ("libxinerama" ,libxinerama)
232
       ("libxml2" ,libxml2)
233
       ("libxmu" ,libxmu)
234
       ("libxrandr" ,libxrandr)
235
       ("libxslt" ,libxslt)
236
       ("lvm2" ,lvm2)
237
       ("mesa" ,mesa)
238
       ("python" ,python-2)
239
       ("qt" ,qtbase)
240
       ("openssl" ,openssl)
241
       ("sdl" ,sdl)))
242
    (arguments
243
     `(#:phases
244
       (modify-phases %standard-phases
245
         (add-before 'configure 'fix-paths
246
           (lambda* (#:key inputs #:allow-other-keys)
247
             (substitute* "configure"
248
               (("CXX=.*") "CXX=\"g++ -std=c++11\"\n")
249
               (("PYTHONDIR=.*")
250
                (string-append "PYTHONDIR=" (assoc-ref inputs "python") "\n"))
251
               (("QT5DIR=.*")
252
                (string-append "QT5DIR=" (assoc-ref inputs "qt") "\n")))))
253
         ;(add-before 'configure 'remove-binaries
254
           ;(lambda* _
255
             ;(substitute* "configure"
256
             ;  (("bin/\\$OS.\\$BUILD_MACHINE") "bin"))
257
             ;(delete-file-recursively "tools")
258
             ;(delete-file-recursively "kBuild/bin")))
259
         (replace 'configure
260
           (lambda* (#:key outputs inputs #:allow-other-keys)
261
             (setenv "I_INCXML2" (string-append "-I" (assoc-ref inputs "libxml2")
262
                                                "/include/libxml2"))
263
             (setenv "I_INCSDL" (string-append "-I" (assoc-ref inputs "sdl")
264
                                               "/include/SDL"))
265
             (invoke "./configure" "--disable-java" "--disable-pulse"
266
                     "--disable-vmmraw"
267
                     (string-append "--with-makeself=" (which "echo")))
268
                     ;(string-append "--with-kbuild="
269
                     ;               (assoc-ref inputs "kbuild"))))
270
             #t))
271
         (replace 'build
272
           (lambda* _
273
             (invoke "kmk")
274
             #t)))))
275
    (home-page "https://www.virtualbox.org")
276
    (synopsis "Virtual Machine manager")
277
    (description
278
     "VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for
279
enterprise as well as home use.")
280
    (license license:gpl2+)))
281