Browse Source

Initial Setup of QEMU Build Scripts

master
Zach Spreuer 2 years ago
parent
commit
ff3ae4b902
  1. 15
      README.md
  2. 53
      qemu-3.1.0.spec
  3. 53
      qemu-4.0.0.spec
  4. 20
      qemu-centos-buildscript.sh
  5. 36
      qemu-debian-buildscript.sh

15
README.md

@ -1,3 +1,16 @@
# QEMU-Build
QEMU 3.1.0/4.0.0 Build Scripts for CentOS & Debian/Ubuntu
QEMU 3.1.0/4.0.0 Build Scripts for CentOS & Debian/Ubuntu
How To:
1. Change Maintainer Info in SPEC files if using CentOS, Change Maintainer Info in qemu-debian-buildscript.sh file if using Debian/Ubuntu
2. Follow Instructions Below Depending on Host OS
# CentOS:
Execute qemu-centos-buildscript.sh script. RPM file will be in your home directory.
# Debian/Ubuntu:
Execute qemu-debian-buildscript.sh script. When it gets to the checkinstall part, add a description for the package then a blank line then enter. Change the conflicts to be qemu-kvm then enter to build. Debian package file will be in your home directory.

53
qemu-3.1.0.spec

@ -0,0 +1,53 @@
Name: qemu
Version: 3.1.0
Release: 1%{?dist}
Summary: QEMU the FAST! processor emulator
License: GPLv2+
URL: https://www.qemu.org
Source0: https://download.qemu.org/%{name}-%{version}.tar.xz
BuildRequires: gtk2-devel, gnutls-devel, zlib-devel, glibc-devel, glib2-devel, gcc, pixman-devel, snappy-devel, lzo-devel, bzip2-devel, libcap-ng-devel, libcurl-devel, libssh2-devel, libaio-devel, libiscsi-devel, spice-server-devel, libusb-devel, libusbmuxd-devel, libusbx-devel, usbredir-devel, libnfs-devel
BuildArch: x86_64
Requires: gtk2-devel, gnutls-devel, zlib-devel, glibc-devel, glib2-devel, gcc, pixman-devel, pulseaudio-libs, centos-release-qemu-ev
Obsoletes: qemu-kvm,qemu-kvm-ev
%description
Packaging the latest (at time of writing) version of qemu that is not available from Red Hat repository
%prep
%setup -q -n %{name}-%{version}
%build
./configure --target-list=x86_64-softmmu --enable-gnutls --enable-spice --enable-tools --enable-kvm --enable-bzip2 --enable-libssh2 --enable-usb-redir --enable-modules --enable-libusb --enable-lzo --enable-virtfs --enable-curl --enable-vhost-net --enable-libnfs --enable-tpm --enable-linux-aio --enable-nettle --enable-libiscsi --enable-fdt --enable-snappy --enable-cap-ng --enable-attr
make -j4
%install
%make_install
%post
ln -sf /usr/local/bin/qemu-system-x86_64 /usr/libexec/qemu-kvm
ln -sf /usr/local/libexec/qemu-bridge-helper /usr/libexec/qemu-bridge-helper
%postun
rm -f /usr/libexec/qemu-kvm
rm -f /usr/libexec/qemu-bridge-helper
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/local/bin/
/usr/local/libexec/
/usr/local/share/qemu/
/usr/local/lib/qemu/
/usr/local/share/doc/qemu/
/usr/local/share/man/
%doc
%changelog
* Wed Apr 24 2019 Zach Spreuer <spreuer.zach@gmail.com> - 3.1.0-0
- packaging latest version of qemu from source for RHEL7

53
qemu-4.0.0.spec

@ -0,0 +1,53 @@
Name: qemu
Version: 4.0.0
Release: 1%{?dist}
Summary: QEMU the FAST! processor emulator
License: GPLv2+
URL: https://www.qemu.org
Source0: https://download.qemu.org/%{name}-%{version}.tar.xz
BuildRequires: gtk2-devel, gnutls-devel, zlib-devel, glibc-devel, glib2-devel, gcc, pixman-devel, snappy-devel, lzo-devel, bzip2-devel, libcap-ng-devel, libcurl-devel, libssh2-devel, libaio-devel, libiscsi-devel, spice-server-devel, libusb-devel, libusbmuxd-devel, libusbx-devel, usbredir-devel, libnfs-devel
BuildArch: x86_64
Requires: gtk2-devel, gnutls-devel, zlib-devel, glibc-devel, glib2-devel, gcc, pixman-devel, pulseaudio-libs, centos-release-qemu-ev
Obsoletes: qemu-kvm,qemu-kvm-ev
%description
Packaging the latest (at time of writing) version of qemu that is not available from Red Hat repository
%prep
%setup -q -n %{name}-%{version}
%build
./configure --target-list=x86_64-softmmu --enable-gnutls --enable-spice --enable-tools --enable-kvm --enable-bzip2 --enable-libssh2 --enable-usb-redir --enable-modules --enable-libusb --enable-lzo --enable-virtfs --enable-curl --enable-vhost-net --enable-libnfs --enable-tpm --enable-linux-aio --enable-nettle --enable-libiscsi --enable-fdt --enable-snappy --enable-cap-ng --enable-attr
make -j4
%install
%make_install
%post
ln -sf /usr/local/bin/qemu-system-x86_64 /usr/libexec/qemu-kvm
ln -sf /usr/local/libexec/qemu-bridge-helper /usr/libexec/qemu-bridge-helper
%postun
rm -f /usr/libexec/qemu-kvm
rm -f /usr/libexec/qemu-bridge-helper
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/local/bin/
/usr/local/libexec/
/usr/local/share/qemu/
/usr/local/share/applications/
/usr/local/share/icons/hicolor/
/usr/local/lib/qemu/
%doc
%changelog
* Wed Apr 24 2019 Zach Spreuer <spreuer.zach@gmail.com> - 4.0.0-0
- packaging latest version of qemu from source for RHEL7

20
qemu-centos-buildscript.sh

@ -0,0 +1,20 @@
#!/bin/bash
echo 'Installing Required Packages...'
sudo yum install -y rpm-build rpmdevtools gtk2-devel gnutls-devel zlib-devel glibc-devel glib2-devel gcc pixman-devel snappy-devel lzo-devel bzip2-devel libcap-ng-devel libcurl-devel libssh2-devel libaio-devel libiscsi-devel spice-server-devel libusb-devel libusbmuxd-devel libusbx-devel usbredir-devel libnfs-devel
echo 'Setting Up RPM Build Folder Structure....'
rpmdev-setuptree
echo 'Copying QEMU SPEC Files...'
cp *.spec ~/rpmbuild/SPECS/
echo 'Changing Directory to RPM Build Folder Structure...'
cd ~/rpmbuild/
echo 'Downloading QEMU 4.0.0 Source Code...'
cd ~/rpmbuild/SOURCES/
wget https://download.qemu.org/qemu-4.0.0.tar.xz > /dev/null 2>&1
echo 'Changing Directory to RPM Build SPECS Folder...'
cd ~/rpmbuild/SPECS/
echo 'Building QEMU 4.0.0...'
rpmbuild -ba qemu-4.0.0.spec > /dev/null 2>&1
echo 'Copying QEMU 4.0.0 to Home Folder...'
cp ~/rpmbuild/RPMS/x86_64/qemu-4.0.0-1.el7.x86_64.rpm ~/qemu-4.0.0-1.el7.x86_64.rpm
echo 'QEMU 4.0.0 Is Now In Your Home Folder...'

36
qemu-debian-buildscript.sh

@ -0,0 +1,36 @@
#!/bin/bash
echo 'Start By Apt-Get Updating...'
sudo apt-get update
echo 'Installing Required Packages...'
sudo apt-get install libspice-server-dev libgnutls28-dev libssh-dev libssh2-1-dev libusb-1.0-0-dev libusb-dev libusbredirhost-dev liblzo2-dev libusbredirparser-dev build-essential checkinstall libcurl4-openssl-dev libnfs-dev libaio-dev nettle-dev libiscsi-dev libsnappy-dev libcap-dev libcap-ng-dev libattr1 libbz2-dev libglib2.0-dev libpixman-1-dev flex bison -y
echo 'Changing Directory to Home Directory...'
cd ~
echo 'Downloading QEMU 4.0.0...'
wget https://download.qemu.org/qemu-4.0.0.tar.xz > /dev/null 2>&1
echo 'Extracting QEMU 4.0.0...'
tar xvf qemu-4.0.0.tar.xz > /dev/null 2>&1
echo 'Changing Directory to QEMU Source Directory...'
cd ~/qemu-4.0.0/
echo 'Running Configure on QEMU Source Directory....'
./configure --target-list=x86_64-softmmu --enable-gnutls --enable-spice --enable-tools --enable-kvm --enable-bzip2 --enable-libssh2 --enable-usb-redir --enable-modules --enable-libusb --enable-lzo --enable-virtfs --enable-curl --enable-vhost-net --enable-libnfs --enable-tpm --enable-linux-aio --enable-nettle --enable-libiscsi --enable-fdt --enable-snappy --enable-cap-ng --enable-attr > /dev/null 2>&1
echo 'Making QEMU 4.0.0 with 4 CPU Cores...'
make -j4 > /dev/null 2>&1
echo 'Making Post Install and Post Remove Files...'
echo '#!/bin/sh' > ~/qemu-4.0.0/postinstall-pak
echo 'ln -sf /usr/local/bin/qemu-img /usr/bin/qemu-img' >> ~/qemu-4.0.0/postinstall-pak
echo 'ln -sf /usr/local/bin/qemu-system-x86_64 /usr/bin/qemu-system-x86_64' >> ~/qemu-4.0.0/postinstall-pak
echo 'ln -sf /usr/local/bin/qemu-system-x86_64 /usr/bin/kvm' >> ~/qemu-4.0.0/postinstall-pak
echo 'exit 0' >> ~/qemu-4.0.0/postinstall-pak
echo '#!/bin/sh' > ~/qemu-4.0.0/postremove-pak
echo 'rm -f /usr/bin/qemu-img' >> ~/qemu-4.0.0/postremove-pak
echo 'rm -f /usr/bin/qemu-system-x86_64' >> ~/qemu-4.0.0/postremove-pak
echo 'rm -f /usr/bin/kvm' >> ~/qemu-4.0.0/postremove-pak
echo 'exit 0' >> ~/qemu-4.0.0/postremove-pak
echo 'Building QEMU 4.0.0 Debian Package...'
checkinstall -D --install=no --fstrans=no --reset-uids=yes --pkgname=qemu --pkgversion=4:0.0 --pkglicense=GPL --pkggroup=Virtualization --provides=qemu --maintainer="Zach Spreuer \<spreuer.zach@gmail.com\>"
echo 'Moving Package to Home Directory...'
mv ~/qemu-4.0.0/qemu_0.0-1_amd64.deb ~/qemu-4.0.0_amd64.deb
echo 'Deleting QEMU Source Directory...'
rm -rf ~/qemu-4.0.0/
echo 'Deleting QEMU Source File...'
rm ~/qemu-4.0.0.tar.xz
Loading…
Cancel
Save