summaryrefslogtreecommitdiff
path: root/libre/virtualbox-libre/PKGBUILD
blob: 2810d1266c78eccefb49ee968008bfc7e73d9d5a (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# $Id: PKGBUILD 89632 2013-04-30 16:22:22Z foutrelis $
# Maintainer: Ionut Biru <ibiru@archlinux.org>
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Maintainer (Parabola): Nicolas Reynolds <fauno@kiwwwi.com.ar>
# Maintainer (Parabola): Jorge López <jorginho@lavabit.com>
# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>
# Maintainer (Parabola): Márcio Silva <coadde@lavabit.com>

pkgbase=virtualbox-libre
pkgname=('virtualbox-libre'
         'virtualbox-libre-host-dkms'
         'virtualbox-libre-guest-dkms'
         'virtualbox-libre-sdk'
         'virtualbox-libre-guest-utils')
pkgver=4.2.12
pkgrel=2
arch=('i686' 'x86_64')
url='http://virtualbox.org'
license=('GPL' 'custom')
makedepends=('alsa-lib'
             'bin86'
             'cdrkit'
             'curl'
             'dev86'
             'device-mapper'
             'glu'
             'gsoap'
             'iasl'
             'jdk7-openjdk'
             'libidl2'
             'libpulse'
             'libstdc++5'
             'libxcomposite'
             'libxcursor'
             'libxinerama'
             'libxml2'
             'libxmu'
             'libxrandr'
             'libxslt'
             'libxtst'
             'linux-libre-headers'
             'mesa'
             'python2'
             'qt4'
             'sdl'
             'sdl_ttf'
             'vde2'
             'xalan-c'
             'xf86driproto'
             'xorg-server-devel')
[[ $CARCH == "x86_64" ]] && makedepends=("${makedepends[@]}" 'gcc-multilib' 'lib32-glibc')
source=("http://download.virtualbox.org/virtualbox/$pkgver/VirtualBox-$pkgver.tar.bz2"
        '10-vboxdrv.rules'
        '60-vboxguest.rules'
        'LocalConfig.kmk'
        'vboxservice.service'
        'vboxweb.service'
        '001-vboxdrv-reference.patch'
        '002-change_default_driver_dir.patch'
        '003-gcc-48.patch'
        '004-system-xorg.patch'
        'os_blag_64.png'
        'os_blag.png'
        'os_dragora_64.png'
        'os_dragora.png'
        'os_dynebolic.png'
        'os_gnewsense_64.png'
        'os_gnewsense.png'
        'os_gnu_64.png'
        'os_gnu.png'
        'os_musix_64.png'
        'os_musix.png' 
        'os_parabola_64.png'
        'os_parabola.png'
        'os_trisquel_64.png'
        'os_trisquel.png'
        'os_ututo_64.png'
        'os_ututo.png'
        'os_venenux.png'
        'libre.patch'
        'free-distros.patch')
md5sums=('654e45054ae6589452508d37403dc800'
         '5f85710e0b8606de967716ded7b2d351'
         'ed1341881437455d9735875ddf455fbe'
         '58d6e5bb4b4c1c6f3f0b3daa6aaeed03'
         '07c5f6d86c4b7839d719c8ee0c53653b'
         'bc9efed88e0469cd7fc460d5a5cd7b4b'
         'f4e4c7895ede9c524109589bf16ae660'
         '97e193f050574dd272a38e5ee5ebe62b'
         '7cf8611ae5850b86323b690e430eeed7'
         '4da461f8c90caa123b47c62479f426b4'
         '8538dba8686d7449cb481c9bae9d722a'
         '545c925b46f2ac95e5f8ae407fad101a'
         'f6416f509c2e5460e4dc624e0a57f3c1'
         'bbfb59dd517c020a23701b480187a355'
         'efacfdb61918286ea9bc89866b8fd239'
         '7c3eb09995e8bafeef414374e44ad4ce'
         'a49ed3ab6bd0fb084de0ab3dd97ae93e'
         '6b432b3305ed446125eef052c38355a6'
         'a70022a468bd3e9daf01818d2d74ac3c'
         '380eb2ab6cad3da198094585853c129c'
         'a60bb9a98abcc3c34156f9051d00df9a'
         '3a908ef6952bcf987e63ef2fe4e98d24'
         '02e87c39c353634cecacf98f1707fa15'
         '0cf41a41e7a415d404d5584e047fd450'
         '449cde3b58390284b59c5d663de3edc9'
         'c7951fe6888d939f3a7d0dafe477e82b'
         '4da8eeb2ece7e475fc7a0d1003da26c6'
         '5e4187af59726d71c5be48d0cd816c34'
         '919277147baae235810f1858200038c0'
         '50387fba578646a9d29de3f917a199d2')

prepare() {
    cd "VirtualBox-$pkgver"
    # Apply patches
    for _p in "$srcdir"/*.patch; do
        [[ -e $_p ]] || continue
        msg2 "Apply patch ${_p##*/}"
        patch -Np1 -i "$_p"
    done

 ## Removing Nonfree directories and Nonfree files
    rm -rv "./include/VBox/ExtPack"
    rm -rv "./src/VBox/ExtPacks"
    rm -rv "./src/VBox/Main/src-helper-apps"
    rm -rv "./src/VBox/Main/include/ExtPackManagerImpl.h"
    rm -rv "./src/VBox/Main/include/ExtPackUtil.h"
    rm -rv "./src/VBox/Main/src-all/ExtPackManagerImpl.cpp"
    rm -rv "./src/VBox/Main/src-all/ExtPackUtil.cpp"

 ## Removing Oracle VM VirtualBox Extension Pack icons
    rm -v "./src/VBox/Resources/darwin/virtualbox-vbox-extpack.icns"
    rm -v "./src/VBox/Resources/other/virtualbox-vbox-extpack-"{16px,20px,24px,32px,40px,48px,64px,72px,80px,96px,128px,256px,512px}.png
    rm -v "./src/VBox/Resources/win/OSE/virtualbox-vbox-extpack.ico"
    rm -v "./src/VBox/Frontends/VirtualBox/images/extension_pack_"{16px,32px,disabled{_16px,_32px},install{_16px,_32px},install_disabled{_16px,_32px},uninstall{_16px,_32px},uninstall_disabled{_16px,_32px}}.png

 ## Adding free distros icons
    for i in {dynebolic,venenux,{gnu,parabola,gnewsense,blag,dragora,ututo,musix,trisquel}{,_64}}; do
      cp -v "$srcdir/os_${i}.png" "./src/VBox/Frontends/VirtualBox/images"
    done
}

build() {
    cd "VirtualBox-$pkgver"
    cp "$srcdir/LocalConfig.kmk" .
    # fake makeself binary to compile without nofatal
    ln -s /bin/echo makeself
    export PATH="$CWD:$PATH"

    ./configure --disable-docs \
        --enable-webservice \
        --enable-vde \
        --disable-kmods
    source ./env.sh
    kmk all

    # fix python2
    sed -i 's_^#!.*/usr/bin/python_#!/usr/bin/python2_' "out/linux.$BUILD_PLATFORM_ARCH/release/bin/vboxshell.py"

    # build rdesktop-vrdp (broken from LocalConfig.kmk)
    pushd src/VBox/RDP/client
    cp "$srcdir/LocalConfig.kmk" .
    # fix keymap path FS#32548
    sed -i 's:/opt/VirtualBox:/usr/share/virtualbox:' Makefile.kmk
    kmk all
    popd
}

package_virtualbox-libre() {
    pkgdesc='Powerful x86 virtualization for enterprise as well as home use (with free GNU/Linux distros presets included and nonfree Oracle VM VirtualBox Extension Pack support removed)'
    depends=('curl'
             'libpng'
             'libxcursor'
             'libxinerama'
             'libxml2'
             'libxmu'
             'sdl'
             'shared-mime-info'
             'virtualbox-libre-host-modules')
    optdepends=('qt4: VirtualBox GUI support'
                'vde2: Virtual Distributed Ethernet support'
                'virtualbox-libre-sdk: Developer kit'
                'virtualbox-libre-host-dkms: Host kernel source modules for non-stock kernels'
                'net-tools: Host-only or bridged networking support')
    backup=('etc/vbox/vbox.cfg')
    replaces=('virtualbox' 'virtualbox-ose')
    conflicts=('virtualbox' 'virtualbox-ose')
    provides=("virtualbox=$pkgver")
    install=virtualbox-libre.install

    source "VirtualBox-$pkgver/env.sh"
    cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"
    install -dm755 "$pkgdir"/usr/{bin,lib/virtualbox/components,share/virtualbox/nls,share/virtualbox/rdesktop-vrdp-keymaps}

    #Binaries and Wrapper with Launchers
    install -m 0755 VBox.sh "$pkgdir/usr/bin/VBox"

    for i in VBoxHeadless VBoxManage VBoxSDL VirtualBox vboxwebsrv VBoxBalloonCtrl; do
        ln -sf VBox "$pkgdir/usr/bin/$i"
        ln -sf VBox "$pkgdir/usr/bin/${i,,}"
    done
    install -m 0755 VBoxTunctl "$pkgdir/usr/bin"
    install -m 0755 rdesktop-vrdp "$pkgdir/usr/bin"

    #components
    install -m 0755 components/* -t "$pkgdir/usr/lib/virtualbox/components"

    #lib
    install -m 0755 *.so "$pkgdir/usr/lib/virtualbox"
    install -m 0644 *.gc *.r0  VBoxEFI*.fd "$pkgdir/usr/lib/virtualbox"

    #setuid root binaries
    install -m 4755 VBoxSDL VirtualBox VBoxHeadless VBoxNetDHCP VBoxNetAdpCtl -t "$pkgdir/usr/lib/virtualbox"
    #other binaries
    install -m 0755 VBoxManage VBoxSVC VBoxXPCOMIPCD VBoxTestOGL VBoxBalloonCtrl vboxwebsrv webtest -t "$pkgdir/usr/lib/virtualbox"

    #language
    install -m 0755 nls/*.qm -t "$pkgdir/usr/share/virtualbox/nls"

    #rdesktop keymaps
    install -m 0644 rdesktop-vrdp-keymaps/* "$pkgdir/usr/share/virtualbox/rdesktop-vrdp-keymaps"

    #useless scripts
    install -m 0755 VBoxCreateUSBNode.sh VBoxSysInfo.sh -t "$pkgdir/usr/share/virtualbox"

    #icons
    install -D -m 0644 VBox.png "$pkgdir/usr/share/pixmaps/VBox.png"

    pushd icons
    for i in *; do
        install -d "$pkgdir/usr/share/icons/hicolor/$i/mimetypes"
        cp $i/* "$pkgdir/usr/share/icons/hicolor/$i/mimetypes"
    done
    popd

    #desktop
    install -D -m 0644 virtualbox.desktop "$pkgdir/usr/share/applications/virtualbox.desktop"
    install -D -m 0644 virtualbox.xml "$pkgdir/usr/share/mime/packages/virtualbox.xml"

    #install configuration
    mkdir -p "$pkgdir/etc/vbox"
    echo 'INSTALL_DIR=/usr/lib/virtualbox' > "$pkgdir/etc/vbox/vbox.cfg"

    #udev and licence
    install -D -m 0644 "$srcdir/VirtualBox-${pkgver}/COPYING" \
        "$pkgdir/usr/share/licenses/virtualbox/LICENSE"
    install -D -m 0644 "$srcdir/10-vboxdrv.rules" \
        "$pkgdir/usr/lib/udev/rules.d/10-vboxdrv.rules"

    # install systemd service
    install -D -m644 "$srcdir/vboxweb.service" \
        "$pkgdir/usr/lib/systemd/system/vboxweb.service"
}

package_virtualbox-libre-sdk() {
    pkgdesc='VirtualBox Software Developer Kit (SDK)'
    depends=('python2')
    replaces=('virtualbox-sdk')
    conflicts=('virtualbox-sdk')
    provides=("virtualbox-sdk=$pkgver")

    install -dm755 "$pkgdir/usr/lib/virtualbox"

    source "VirtualBox-$pkgver/env.sh"
    cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"

    install -D -m 0755 vboxshell.py "$pkgdir/usr/lib/virtualbox/vboxshell.py"
    #python sdk
    pushd sdk/installer
    VBOX_INSTALL_PATH="/usr/lib/virtualbox" python2 vboxapisetup.py install --root "$pkgdir"
    popd
    rm -rf sdk/installer
    mv sdk "$pkgdir/usr/lib/virtualbox"
}

package_virtualbox-libre-host-dkms() {
    pkgdesc='VirtualBox Host kernel modules sources'
    depends=('dkms' 'gcc' 'make')
    provides=("virtualbox-host-dkms=$pkgver" 'virtualbox-libre-host-modules')
    replaces=('virtualbox-host-dkms' 'virtualbox-source' 'virtualbox-libre-source' 'virtualbox-host-source' 'virtualbox-libre-host-source')
    conflicts=('virtualbox-host-dkms' 'virtualbox-source' 'virtualbox-libre-source' 'virtualbox-host-source' 'virtualbox-libre-host-source')
    optdepends=('linux-libre-headers'
                'linux-libre-lts-headers')
    install=virtualbox-libre-host-dkms.install

    install -dm755 "$pkgdir/usr/src"
    source "VirtualBox-$pkgver/env.sh"
    cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin"
    cp -r src "$pkgdir/usr/src/vboxhost-$pkgver"
}

package_virtualbox-libre-guest-dkms() {
    pkgdesc='VirtualBox Guest kernel modules sources'
    depends=('dkms' 'gcc' 'make')
    provides=("virtualbox-guest-dkms=$pkgver" 'virtualbox-libre-guest-modules')
    replaces=('virtualbox-guest-dkms' 'virtualbox-archlinux-source' 'virtualbox-parabola-source' 'virtualbox-guest-source' 'virtualbox-libre-guest-source')
    conflicts=('virtualbox-guest-dkms' 'virtualbox-archlinux-source' 'virtualbox-parabola-source'  'virtualbox-guest-source' 'virtualbox-libre-guest-source')
    optdepends=('linux-libre-headers'
                'linux-libre-lts-headers')
    install=virtualbox-libre-guest-dkms.install

    install -dm755 "$pkgdir/usr/src"
    source "VirtualBox-$pkgver/env.sh"
    cd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
    cp -r src "$pkgdir/usr/src/vboxguest-$pkgver"
}

package_virtualbox-libre-guest-utils(){
    pkgdesc='VirtualBox Guest userspace utilities'
    depends=('virtualbox-libre-guest-modules' 'gcc-libs' 'libxmu' 'xorg-xrandr' 'libxfixes')
    optdepends=('virtualbox-libre-guest-dkms: Guest kernel source modules for non-stock kernels')
    provides=("virtualbox-guest-utils=$pkgver")
    replaces=('virtualbox-guest-utils' 'virtualbox-archlinux-additions' 'virtualbox-parabola-additions' 'virtualbox-guest-additions' 'virtualbox-libre-guest-additions')
    conflicts=('virtualbox-guest-utils' 'virtualbox-archlinux-additions' 'virtualbox-parabola-additions' 'virtualbox-guest-additions' 'virtualbox-libre-guest-additions')
    install=virtualbox-libre-guest-utils.install

    source "VirtualBox-$pkgver/env.sh"
    pushd "VirtualBox-$pkgver/out/linux.$BUILD_PLATFORM_ARCH/release/bin/additions"
    install -d "$pkgdir"/{usr/bin,sbin}
    install -m755 VBoxClient VBoxControl VBoxService "$pkgdir/usr/bin"
    install -m755 mount.vboxsf "$pkgdir/sbin"
    install -m755 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/98vboxadd-xclient \
        "$pkgdir"/usr/bin/VBoxClient-all
    install -m755 -D "$srcdir"/VirtualBox-$pkgver/src/VBox/Additions/x11/Installer/vboxclient.desktop \
        "$pkgdir"/etc/xdg/autostart/vboxclient.desktop
    install -D vboxvideo_drv.so \
        "$pkgdir/usr/lib/xorg/modules/drivers/vboxvideo.so"
    install -d "$pkgdir/usr/lib/xorg/modules/dri"
    install -m755 VBoxOGL*.so "$pkgdir/usr/lib"
    ln -s /usr/lib/VBoxOGL.so "$pkgdir/usr/lib/xorg/modules/dri/vboxvideo_dri.so"
    install -m755 -D pam_vbox.so "$pkgdir/usr/lib/security/pam_vbox.so"
    popd
    # install udev rules
    install -D -m 0644 60-vboxguest.rules \
        "$pkgdir/usr/lib/udev/rules.d/60-vboxguest.rules"
    # install systemd service file
    install -D -m644 vboxservice.service \
        "$pkgdir/usr/lib/systemd/system/vboxservice.service"
}

# vim:set ts=4 sw=4 et: