summaryrefslogtreecommitdiff
path: root/kernels/xen/PKGBUILD
blob: 7761893c4a6b918adb04a0e9889c8acb3b2d3729 (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
# 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.4.1
pkgrel=1.parabola1
pkgdesc="Virtual Machine Hypervisor & Tools (Parabola rebranded)"
arch=(i686 x86_64)
url="http://www.xenproject.org/"
license=(GPL2)
depends=(bin86 bridge-utils curl gnutls iproute2 libaio libcap-ng libiscsi libjpeg-turbo libpng libseccomp lzo2 nss pixman pciutils python python2 sdl wget vde2 yajl)
[[ "$CARCH" == "x86_64" ]] && depends+=(lib32-glibc)
makedepends=(cmake dev86 git iasl markdown ocaml-findlib)
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
    xen.install
    09_xen
    ati-passthrough.patch
    disable-bluez.patch
    proc-xen.mount
    var-lib-xenstored.mount
    xenconsoled.service
    conf.d-xenconsoled
    xendomains.service
    xendomU@.service
    xenstored.service
    conf.d-xenstored
    tmpfiles.d-$pkgname.conf
    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)

sha256sums=('55b49d3c4575d7791275125ff87c0f86f1d1e0f7f2718b6fd1c4f88a9bc7ea25'
            '632ce8c193ccacc3012bd354bdb733a4be126f7c098e111930aa41dad537405c'
            '772e4d550e07826665ed0528c071dd5404ef7dbe1825a38c8adbc2a00bca948f'
            '1795c7d067a43174113fdf03447532f373e1c6c57c08d61d9e4e9be5e244b05e'
            'db426394965c48c1d29023e1cc6d965ea6b9a9035d8a849be2750ca4659a3d07'
            'f60ae61cfbd5da1d849d0beaa21f593c38dac9359f0b3ddc612f447408265b24'
            '2d29fd04a0d0ba29dae6bd29fb418944c08d3916665dcca74afb297ef37584b6'
            '4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b'
            '4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459'
            '936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775'
            'b29b6529c84348bfaf86ff52fac3b3b49c8259741820a0edf056809bd7e65532'
            'b0a3cfe2d524371ee04a26a29ad04cd9f3dae8c5d4a18b6b41576c6c7547f946'
            'd93c2d5bcdf0c3e4c6e8efb357cb4b9d618209025361f5ccd9d03651a8acd7a3'
            '0ba03980b4d300fea3f8bbe47b188a491ddf871246e5bd214b1ed15e971324d2'
            '139eed988bfaf8edc8ccdfd0b668382bd63db48ce17be91776182a7e28e9d88c'
            'c19146931c6ab8e53092bd9b2ebbfda5c76fd22ad3b1d42dcda3dd1b61f123ff'
            'e4af7891e816b9549ebeff766a78036626c0e278734e5625b8e7d68729530ded'
            '48d76cc6f25caa79b3f527c96a0883b1decb9012f6616f61336c8d43791bf007'
            '0bd45d9de6456c4f9adf32e726f2db3a3cd0423c1d161b442e8a1666d2e68e3f'
            '012cc60ffdcb0e061d04d404eb9232734554aef4dc4b551f66adf82a655e6e41'
            '633d334c55395fac3f16dbe56dd7b7524d560b513d1895b53c89943033a45f39'
            '0e1ad0a6a72b0c22025a556c23235a8f663427f1e769c45fe39d1c525bf82eff'
            '40e0760810a49f925f2ae9f986940b40eba477dc6d3e83a78baaae096513b3cf'
            '3f0af16958c3e057b9baa5afc47050d9adf7dd553274dd97ae4f35938fefb568'
            '50a9b7fd19e8beb1dea09755f07318f36be0b7ec53d3c9e74f3266a63e682c0c')

prepare() {
    cd $pkgname-$pkgver/

    ### Patching 

    # Security Patches

    # Compile Patches
    patch -Np1 -i $srcdir/disable-bluez.patch

    # 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:/sbin:/bin:' config/StdGNU.mk
    sed -i 's:/var/lock:/run/lock:' config/StdGNU.mk
    sed -i 's:/var/run:/run:' config/StdGNU.mk

    # 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() {
    export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs -Wno-sizeof-pointer-memaccess'
    cd $pkgname-$pkgver/
    ./autogen.sh
    ./configure PYTHON=/usr/bin/python2 --prefix=/usr --localstatedir=/run --enable-xend
    make LANG=C PYTHON=python2 dist-{xen,tools,kernels}
    unset CFLAGS
    make LANG=C PYTHON=python2 dist-stubdom
}

package() {
    cd $pkgname-$pkgver/

    make DESTDIR="$pkgdir" LANG=C PYTHON=python2 install-{xen,tools,kernels,stubdom}

    # Install files
    cd ../
    for f in ${source[@]}; do
        [[ $f =~ .mount || $f =~ .service ]] && install -Dm644 $f "$pkgdir"/usr/lib/systemd/system/$f
    done
    install -Dm644 tmpfiles.d-$pkgname.conf "$pkgdir"/usr/lib/tmpfiles.d/$pkgname.conf
    install -Dm644 $pkgname.conf "$pkgdir"/etc/modules-load.d/$pkgname.conf
    install -Dm644 conf.d-xenstored "$pkgdir"/etc/conf.d/xenstored
    install -Dm644 conf.d-xenconsoled "$pkgdir"/etc/conf.d/xenconsoled
    install -Dm644 grub.conf "$pkgdir"/etc/xen/grub.conf
    install -Dm755 09_xen "$pkgdir"/etc/grub.d/09_xen

    cd "$pkgdir"

    # Fix paths in scripts, move to right locations and create missing directories
    sed -i 's:/etc/sysconfig:/etc/conf.d:' etc/init.d/xendomains
    sed -i 's:/var/lock:/run/lock:' etc/init.d/xendomains
    sed -i 's:/var/lock:/run/lock:' etc/xen/scripts/hotplugpath.sh
    sed -i 's:/var/run:/run:' etc/init.d/xencommons
    sed -i 's:/var/run:/run:' etc/xen/scripts/hotplugpath.sh
    sed -i 's:/var/run:/run:' etc/xen/scripts/locking.sh

    mv etc/init.d/xencommons etc/xen/scripts/xencommons
    mv etc/init.d/xendomains etc/xen/scripts/xendomains
    mv etc/init.d/xen-watchdog etc/xen/scripts/xen-watchdog
    mv etc/default/xencommons etc/conf.d/xencommons
    mv etc/default/xendomains etc/conf.d/xendomains
    mv var/xen/dump var/lib/xen/
    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

    # 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
    rm -f boot/xen{,-4,-4.4}.gz

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

    # Pointless helper cleanup
    rm -f usr/bin/xen-python-path

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

    # Clean up udev rules naming
    mv etc/udev/rules.d/xen-backend.rules etc/udev/rules.d/40-xen-backend.rules

    # Cleanup additional leftover files
    rm -rf usr/include/cacard 
    rm -f usr/lib/libcacard*
    rm -f usr/lib/pkgconfig/libcacard.pc

    # Clean up left over empty directories
    rm -rf var/run var/lock var/xen etc/default etc/init.d

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