summaryrefslogtreecommitdiff
path: root/kernels/xen/PKGBUILD
blob: 0518ce19cf29c8aa0215213d812e5078dc834791 (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
# Maintainer (Arch): David Sutton <kantras - gmail.com>
# Contributor (Arch): Shanmu Thiagaraja <sthiagaraja+AUR@prshanmu.com>
# Contributor (Arch): Limao Luo
# Contributor (Arch): Luceo
# Contributor (Arch): Revellion
# Maintainer: André Silva <emulatorman@parabola.nu>

pkgname=xen
pkgver=4.5.0
pkgrel=1.parabola1
pkgdesc="Virtual Machine Hypervisor & Tools (Parabola rebranded)"
arch=(i686 x86_64)
url="http://www.xenproject.org/"
license=(GPL2)
depends=(bridge-utils curl gnutls iproute2 libaio libcap-ng libiscsi libjpeg-turbo libpng libseccomp lzo2 nss pixman pciutils python python2 sdl yajl spice usbredir)
[[ "$CARCH" == "x86_64" ]] && depends+=(lib32-glibc)
makedepends=(bin86 cmake dev86 git iasl markdown ocaml-findlib figlet wget spice-protocol)
optdepends=('xen-docs: Official Xen Documentation' 'openvswitch: Optional Networking support')
conflicts=(xen-4.2{,-testing-hg} xen-{gdbsx,hg-unstable,rc,git} xen-4.3{,-testing-hg})
backup=(etc/modules-load.d/$pkgname.conf etc/$pkgname/xl.conf etc/conf.d/xen{stored,consoled,domains,commons} etc/$pkgname/grub.conf)
options=(!buildflags !strip)
install=$pkgname.install
changelog=ChangeLog
source=(http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.gz
    http://xenbits.xen.org/xen-extfiles/ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz
    http://xenbits.xen.org/xen-extfiles/lwip-1.3.0.tar.gz
    http://xenbits.xen.org/xen-extfiles/zlib-1.2.3.tar.gz
    http://xenbits.xen.org/xen-extfiles/newlib-1.16.0.tar.gz
    http://xenbits.xen.org/xen-extfiles/pciutils-2.2.9.tar.bz2
    http://xenbits.xen.org/xen-extfiles/polarssl-1.1.4-gpl.tgz
    http://xenbits.xen.org/xen-extfiles/grub-0.97.tar.gz
    http://xenbits.xen.org/xen-extfiles/tpm_emulator-0.7.4.tar.gz
    http://xenbits.xen.org/xen-extfiles/gmp-4.3.2.tar.bz2
    http://repo.parabola.nu/other/$pkgname/$pkgname-$pkgver.gz
    xen.install
    tmpfiles.d-$pkgname.conf
    09_xen
    ati-passthrough.patch
    ovmf.patch
    ovmf-gcc4.9-basetools.patch
    ovmf-gcc4.9-ovmfpkg.patch
    efi-xen.cfg
    grub.conf
    $pkgname.conf)
noextract=(lwip-1.3.0.tar.gz
    zlib-1.2.3.tar.gz
    newlib-1.16.0.tar.gz
    pciutils-2.2.9.tar.bz2
    polarssl-1.1.4-gpl.tgz
    grub-0.97.tar.gz
    tpm_emulator-0.7.4.tar.gz
    gmp-4.3.2.tar.bz2
    ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz
    $pkgname-$pkgver.gz)

sha256sums=('5bdb40e2b28d2eeb541bd71a9777f40cbe2ae444b987521d33f099541a006f3b'
            '632ce8c193ccacc3012bd354bdb733a4be126f7c098e111930aa41dad537405c'
            '772e4d550e07826665ed0528c071dd5404ef7dbe1825a38c8adbc2a00bca948f'
            '1795c7d067a43174113fdf03447532f373e1c6c57c08d61d9e4e9be5e244b05e'
            'db426394965c48c1d29023e1cc6d965ea6b9a9035d8a849be2750ca4659a3d07'
            'f60ae61cfbd5da1d849d0beaa21f593c38dac9359f0b3ddc612f447408265b24'
            '2d29fd04a0d0ba29dae6bd29fb418944c08d3916665dcca74afb297ef37584b6'
            '4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b'
            '4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459'
            '936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775'
            'bf636b3cbe01a3a8f348656c64ca08bdcbe6be602b53826952de22b90747f5e3'
            'bfee0c85c88fe331ad76cdc07b93b18da24c6c1ff2ea3f6f28ee727f8e3ee121'
            '40e0760810a49f925f2ae9f986940b40eba477dc6d3e83a78baaae096513b3cf'
            'b0a3cfe2d524371ee04a26a29ad04cd9f3dae8c5d4a18b6b41576c6c7547f946'
            'd93c2d5bcdf0c3e4c6e8efb357cb4b9d618209025361f5ccd9d03651a8acd7a3'
            '1c44b9dc848bb6c3ef2ab76e4807a0b3ed360aea6b13b5b86d2bf5301d14247b'
            '45aae7a1d48357e5f981c12870b5bcac0dd0f630f84e398160d8c9adb42a6674'
            '8e16638d0cc366d1eaae7ccbcf43215853b4444a625478ec8f6e0a2c655370d9'
            '592f9ed540adbe94095071e4c327aefe85ee5ca057a086a9935847f36aca3be8'
            '3f0af16958c3e057b9baa5afc47050d9adf7dd553274dd97ae4f35938fefb568'
            '50a9b7fd19e8beb1dea09755f07318f36be0b7ec53d3c9e74f3266a63e682c0c')

prepare() {
    cd $pkgname-$pkgver/

    ### Patching 

    # Security Patches

    # Compile Patches

    # OVMF Compile support (Pulls from GIT repo, so patching to patch after pull request)
    echo "Patching OVMF..."
    patch -Np1 -i $srcdir/ovmf.patch
    cp $srcdir/ovmf-gcc4.9-basetools.patch tools/firmware/
    cp $srcdir/ovmf-gcc4.9-ovmfpkg.patch tools/firmware/

    # Uncomment line below if you want to enable ATI Passthrough support (some reported successes, untested with 4.4)
    #patch -Np1 -i ../ati-passthrough.patch

    # Fix Install Paths
    sed -i 's:\$localstatedir/run/xen:/run/xen:' m4/paths.m4
    sed -i 's:/var/run:/run:' tools/ocaml/xenstored/define.ml
    sed -i 's:/var/run:/run:' tools/ocaml/xenstored/systemd_stubs.c

    # Copy supporting tarballs into place
    cp $srcdir/lwip-1.3.0.tar.gz stubdom/
    cp $srcdir/zlib-1.2.3.tar.gz stubdom/
    cp $srcdir/newlib-1.16.0.tar.gz stubdom/
    cp $srcdir/pciutils-2.2.9.tar.bz2 stubdom/
    cp $srcdir/polarssl-1.1.4-gpl.tgz stubdom/
    cp $srcdir/grub-0.97.tar.gz stubdom/
    cp $srcdir/tpm_emulator-0.7.4.tar.gz stubdom/
    cp $srcdir/gmp-4.3.2.tar.bz2 stubdom/
    cp $srcdir/ipxe-git-9a93db3f0947484e30e753bbd61a10b17336e20e.tar.gz tools/firmware/etherboot/ipxe.tar.gz

}

build() {
    cd $pkgname-$pkgver/
    ./autogen.sh
    ./configure PYTHON=/usr/bin/python2 --prefix=/usr --sbindir=/usr/bin --with-sysconfig-leaf-dir=conf.d --with-initddir=/etc/init.d \
		--enable-systemd --disable-docs --enable-stubdom --enable-qemu-traditional --enable-rombios \
		--with-extra-qemuu-configure-args="--disable-bluez --disable-gtk --enable-spice --enable-usb-redir" # --enable-ovmf
    unset CFLAGS
    make LANG=C PYTHON=python2 
}

package() {
    cd $pkgname-$pkgver/

    make DESTDIR="$pkgdir" LANG=C PYTHON=python2 install

    cd "$pkgdir"

    # Install files from Parabola package
    install -Dm644 $srcdir/tmpfiles.d-$pkgname.conf usr/lib/tmpfiles.d/$pkgname.conf
    #install -Dm644 $srcdir/conf.d-xenstored etc/conf.d/xenstored
    #install -Dm644 $srcdir/conf.d-xenconsoled etc/conf.d/xenconsoled
    install -Dm644 $srcdir/grub.conf etc/xen/grub.conf
    install -Dm755 $srcdir/09_xen etc/grub.d/09_xen
    install -Dm644 $srcdir/efi-xen.cfg etc/xen/efi-xen.cfg

    # Fix bug #678 -> https://labs.parabola.nu/issues/678
    if [[ $CARCH == i686 ]]; then
        mkdir boot
        cp $srcdir/$pkgname-$pkgver.gz boot
    fi

    # Fix paths in scripts, move to right locations and create missing directories
    sed -i 's:/var/run:/run:' etc/init.d/xencommons
    sed -i 's:/var/lock:/run/lock:' etc/xen/scripts/hotplugpath.sh
    sed -i 's:/var/run:/run:' etc/xen/scripts/locking.sh
    sed -i 's:/var/run:/run:' usr/lib/systemd/system/xenstored.service
    sed -i 's:/var/run:/run:' usr/lib/systemd/system/xenstored.socket
    sed -i 's:/var/run:/run:' usr/lib/systemd/system/xenstored_ro.socket

    mkdir var/log/xen/console

    # Sanitize library path (if lib64 exists)
    if [[ -d usr/lib64 ]]; then
        cd usr/
        cp -r lib64/* lib/
        rm -rf lib64
	cd ../
    fi

    # If EFI binaries build, move to /boot
    if [[ -f usr/lib/efi/xen.efi ]]; then
        mv usr/lib/efi/xen-$pkgver.efi boot/xen-$pkgver.efi
        rm -rf usr/lib/efi
    fi

    # Compress syms file and move to a share location
    if [[ $CARCH == x86_64 ]]; then
        gzip boot/$pkgname-syms-*
        mv boot/$pkgname-syms-*.gz usr/share/xen
    fi

    ##### Kill unwanted stuff #####
    # hypervisor symlinks
    if [[ $CARCH == x86_64 ]]; then
        rm -f boot/xen{,-4,-4.5,-4.5-rc}.gz
    fi

    # Documentation cleanup ( see xen-docs package )
    rm -rf usr/share/doc
    rm -rf usr/share/man

    # Unnecessary qemu support files
#    rm -rf usr/bin/qemu-*-xen
    rm usr/share/qemu-xen/qemu/{palcode,openbios}-*
    rm usr/share/xen/qemu/openbios-*

    # adhere to Static Library Packaging Guidelines
    rm -rf usr/lib/*.a

}