summaryrefslogtreecommitdiff
path: root/pcr/qemu-user-static-riscv-git/PKGBUILD
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2018-02-12 12:25:28 +0100
committerAndreas Grapentin <andreas@grapentin.org>2018-02-12 12:25:28 +0100
commit22e7c24afdc090e291f8ad11f59eeb10d1d44ed8 (patch)
tree47c1aee63ed4bfd1812fdf283cd8be2b9d2e3c0c /pcr/qemu-user-static-riscv-git/PKGBUILD
parentc572218c3ebf39b3a27df9aed75c5f00aef14786 (diff)
downloadabslibre-22e7c24afdc090e291f8ad11f59eeb10d1d44ed8.tar.gz
abslibre-22e7c24afdc090e291f8ad11f59eeb10d1d44ed8.tar.bz2
abslibre-22e7c24afdc090e291f8ad11f59eeb10d1d44ed8.zip
pcr/qemu-user-static-riscv-git: added
Diffstat (limited to 'pcr/qemu-user-static-riscv-git/PKGBUILD')
-rw-r--r--pcr/qemu-user-static-riscv-git/PKGBUILD182
1 files changed, 182 insertions, 0 deletions
diff --git a/pcr/qemu-user-static-riscv-git/PKGBUILD b/pcr/qemu-user-static-riscv-git/PKGBUILD
new file mode 100644
index 000000000..6b3c85804
--- /dev/null
+++ b/pcr/qemu-user-static-riscv-git/PKGBUILD
@@ -0,0 +1,182 @@
+# Maintainer (Arch:qemu): Tobias Powalowski <tpowa@archlinux.org>
+# Contributor (Arch:qemu): Sébastien "Seblu" Luttringer <seblu@seblu.net>
+# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
+# Contributor: Márcio Silva <coadde@hyperbola.info>
+
+# parabola changes and rationale:
+# - apdapted from ribre/qemu-user-static
+# - changed to build riscv/riscv-qemu on github
+# - checking out submodules in prepare
+
+_pkgbase=qemu
+_gitname=riscv-qemu
+pkgname=(qemu-user-static-riscv-git qemu-user-static-binfmt-riscv-git)
+pkgdesc="A generic and open source machine emulator and virtualizer. Git version with riscv support."
+pkgver=2.11.50.r57991.713f2c1164
+pkgrel=1
+arch=(x86_64)
+license=(GPL2 LGPL2.1)
+url="https://github.com/riscv/riscv-qemu"
+makedepends=(git pixman-static glib2-static pcre-static python2)
+source=(git+https://github.com/riscv/riscv-qemu.git
+ 0001-linux-user-Use-if-to-only-call-validate_guest_space-.patch
+ 0002-linux-user-Rename-validate_guest_space-init_guest_co.patch
+ 0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch
+ 0004-linux-user-init_guest_space-Correctly-handle-guest_s.patch
+ 0005-linux-user-init_guest_space-Clarify-page-alignment-l.patch
+ 0006-linux-user-init_guest_commpage-Add-a-comment-about-s.patch
+ 0007-linux-user-init_guest_space-Clean-up-control-flow-a-.patch
+ 0008-linux-user-init_guest_space-Don-t-try-to-align-if-we.patch
+ 0009-linux-user-init_guest_space-Add-a-comment-about-sear.patch
+ 0010-linux-user-init_guest_space-Try-to-make-ARM-space-co.patch
+ allow_elf64.patch)
+sha256sums=('SKIP'
+ '9953a8debd9456adb4f5968817fa89da4d4542e44980a5533ccf86371d819845'
+ 'a977e9295daa14a9c73258cf16399eb5af66382217f8a4e69951ec044131a7ce'
+ 'dba2cfeb24841d45936091319957ee6f65e481da3c761791d410d3b8e6799998'
+ '75b3bda6752c4bf17488489f898767b6772b10ecc5d1f0a5bc1bd831e99a31e3'
+ '731895a8ed6f6d322bb60764b01cf09e0ea762d7d53fc01e91c2d2aecfdc8844'
+ '69b37040f52ef86b86c7c2952eb3f85f3c67d7adf289c43fdac8c71827c6e5b9'
+ '76f88850b0f52450eecb80029ffe16db6f418cec3b58231aca354cc20bbfb16a'
+ '76944d84990cc76e47c381849c683a346c5234bcebbe4c24334d0fd8368482db'
+ '7845867348fd380def28c7fe023e54cee8ff88cd6754aae3ab3472149cfbde51'
+ '1953e7cac58c23526d007d8559410e0042d4a7c1b8cbd5f4c0543f7f876436dd'
+ '13a6d9e678bdc9e1f051006cfd0555f5a80582368f54c8a1bb5a78ece3832ac4')
+validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')
+
+case $CARCH in
+ i?86) _corearch=i386 ;;
+ x86_64) _corearch=x86_64 ;;
+esac
+
+pkgver() {
+ cd "${srcdir}/${_gitname}"
+
+ printf "%s.r%s.%s" "$(cat VERSION)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+prepare() {
+ mkdir build-static
+ mkdir -p extra-arch-static/usr/{bin,share/qemu}
+
+ cd "${srcdir}/${_gitname}"
+ sed -i 's/vte-2\.90/vte-2.91/g' configure
+
+ # update git submodules
+ scripts/git-submodule.sh update ui/keycodemapdb dtc capstone
+
+ # https://bugs.launchpad.net/qemu/+bug/1740219
+ # https://lists.nongnu.org/archive/html/qemu-devel/2017-12/msg05237.html
+ local patchfile
+ for patchfile in ../????-linux-user-*.patch; do
+ patch -p1 < "$patchfile"
+ done
+
+ patch -p1 < ../allow_elf64.patch
+}
+
+build() {
+ local flags=(
+ --static
+ --disable-system # disable building qemu-system-$CPU, we only want qemu-$CPU
+ --disable-guest-agent # disable building qemu-ga
+ --disable-tools # disable building the qemu-{io,nbd,img} tools
+ --disable-blobs # disable installing firmware files used by system
+ --disable-docs
+ --disable-modules # modules imply dynamic linking
+
+ # jemalloc-static isn't packaged
+ --disable-jemalloc
+
+ # These libraries are only used for system or tools, but even
+ # though that's disabled, libqemuutil.a still tries to link
+ # against them unless we specifically tell it not to (the linkage
+ # would be removed at the final linker's tree-shaking).
+ --disable-gcrypt
+ --disable-nettle
+ )
+ _build static "${flags[@]}" \
+ --audio-drv-list= \
+ --disable-bluez \
+ --disable-sdl \
+ --disable-gtk \
+ --disable-vte \
+ --disable-opengl \
+ --disable-virglrenderer
+}
+
+_build() (
+ cd build-$1
+
+ # qemu vs. make 4 == bad
+ export ARFLAGS=rv
+
+ # http://permalink.gmane.org/gmane.comp.emulators.qemu/238740
+ export CFLAGS+=" -fPIC"
+
+ ../${_gitname}/configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --libexecdir=/usr/lib/qemu \
+ --python=/usr/bin/python2 \
+ --smbd=/usr/bin/smbd \
+ --with-gtkabi=3.0 \
+ --with-sdlabi=2.0 \
+ --enable-modules \
+ --enable-jemalloc \
+ --disable-git-update \
+ "${@:2}"
+
+ make
+)
+
+package_qemu-user-static-riscv-git() {
+ pkgdesc="QEMU user-mode emulation (static binaries) - Git version with riscv support."
+
+ provides=("qemu-static=$pkgver")
+ conflicts=(qemu-static qemu-user-static)
+
+ _package static
+
+ rm -vr -- \
+ "$pkgdir"/usr/lib/ \
+ "$pkgdir"/usr/share/
+
+ local prog
+ for prog in "$pkgdir"/usr/bin/*; do
+ mv -nT -- "$prog" "${prog%-static}-static"
+ done
+}
+
+_package() {
+ options=(!strip)
+
+ make -C build-$1 DESTDIR="$pkgdir" install "${@:2}"
+
+ cd "$pkgdir"/usr/bin
+ tidy_strip
+}
+
+package_qemu-user-static-binfmt-riscv-git() {
+ pkgdesc="binfmt registration for QEMU user-mode emulation - Git version with riscv support."
+ depends=("qemu-user-static-riscv-git=$pkgver")
+
+ provides=("binfmt-qemu-static=$pkgver")
+ conflicts=('binfmt-qemu-static' 'qemu-user-static-binfmt')
+
+ cd ${_gitname}
+
+ install -d "$pkgdir"/usr/lib/binfmt.d
+
+ < scripts/qemu-binfmt-conf.sh \
+ sed -e 's/^CHECK=.*/CHECK=qemu_check_systemd/' \
+ -e 's/^BINFMT_SET=.*/BINFMT_SET=qemu_generate_systemd/' \
+ | sh /dev/stdin \
+ --qemu-path /usr/bin \
+ --exportdir "$pkgdir"/usr/lib/binfmt.d \
+ --credential yes
+
+ # add the "-static" suffix
+ sed -i 's/:[^:]*$/-static&/' -- "$pkgdir"/usr/lib/binfmt.d/*.conf
+}