1# Copyright (c) 2021 Red Hat, Inc. 2# 3# Author: 4# Cleber Rosa <crosa@redhat.com> 5# 6# This work is licensed under the terms of the GNU GPL, version 2 or 7# later. See the COPYING file in the top-level directory. 8# 9# This is an ansible playbook file. Run it to set up systems with the 10# environment needed to build QEMU. 11--- 12- name: Installation of basic packages to build QEMU 13 hosts: all 14 tasks: 15 - name: Check for suitable ansible version 16 delegate_to: localhost 17 assert: 18 that: 19 - '((ansible_version.major == 2) and (ansible_version.minor >= 8)) or (ansible_version.major >= 3)' 20 msg: "Unsuitable ansible version, please use version 2.8.0 or later" 21 22 - name: Add armhf foreign architecture to aarch64 hosts 23 command: dpkg --add-architecture armhf 24 when: 25 - ansible_facts['distribution'] == 'Ubuntu' 26 - ansible_facts['architecture'] == 'aarch64' 27 28 - name: Update apt cache / upgrade packages via apt 29 apt: 30 update_cache: yes 31 upgrade: yes 32 when: 33 - ansible_facts['distribution'] == 'Ubuntu' 34 35 # lcitool variables -f json ubuntu-2204 qemu | jq -r '.pkgs[]' | xargs -n 1 echo "-" 36 - name: Install basic packages to build QEMU on Ubuntu 22.04 37 package: 38 name: 39 - bash 40 - bc 41 - bison 42 - bsdextrautils 43 - bzip2 44 - ca-certificates 45 - ccache 46 - clang 47 - dbus 48 - debianutils 49 - diffutils 50 - exuberant-ctags 51 - findutils 52 - flex 53 - g++ 54 - gcc 55 - gcovr 56 - genisoimage 57 - gettext 58 - git 59 - hostname 60 - libaio-dev 61 - libasan5 62 - libasound2-dev 63 - libattr1-dev 64 - libbpf-dev 65 - libbrlapi-dev 66 - libbz2-dev 67 - libc6-dev 68 - libcacard-dev 69 - libcap-ng-dev 70 - libcapstone-dev 71 - libcmocka-dev 72 - libcurl4-gnutls-dev 73 - libdaxctl-dev 74 - libdrm-dev 75 - libepoxy-dev 76 - libfdt-dev 77 - libffi-dev 78 - libgbm-dev 79 - libgcrypt20-dev 80 - libglib2.0-dev 81 - libglusterfs-dev 82 - libgnutls28-dev 83 - libgtk-3-dev 84 - libibumad-dev 85 - libibverbs-dev 86 - libiscsi-dev 87 - libjemalloc-dev 88 - libjpeg-turbo8-dev 89 - libjson-c-dev 90 - liblttng-ust-dev 91 - liblzo2-dev 92 - libncursesw5-dev 93 - libnfs-dev 94 - libnuma-dev 95 - libpam0g-dev 96 - libpcre2-dev 97 - libpixman-1-dev 98 - libpmem-dev 99 - libpng-dev 100 - libpulse-dev 101 - librbd-dev 102 - librdmacm-dev 103 - libsasl2-dev 104 - libsdl2-dev 105 - libsdl2-image-dev 106 - libseccomp-dev 107 - libslirp-dev 108 - libsnappy-dev 109 - libspice-protocol-dev 110 - libspice-server-dev 111 - libssh-dev 112 - libsystemd-dev 113 - libtasn1-6-dev 114 - libubsan1 115 - libudev-dev 116 - liburing-dev 117 - libusb-1.0-0-dev 118 - libusbredirhost-dev 119 - libvdeplug-dev 120 - libvirglrenderer-dev 121 - libvte-2.91-dev 122 - libxen-dev 123 - libxml2-dev 124 - libzstd-dev 125 - llvm 126 - locales 127 - make 128 - meson 129 - multipath-tools 130 - ncat 131 - nettle-dev 132 - ninja-build 133 - openssh-client 134 - pkgconf 135 - python3 136 - python3-numpy 137 - python3-opencv 138 - python3-pillow 139 - python3-pip 140 - python3-sphinx 141 - python3-sphinx-rtd-theme 142 - python3-venv 143 - python3-yaml 144 - rpm2cpio 145 - sed 146 - sparse 147 - systemtap-sdt-dev 148 - tar 149 - tesseract-ocr 150 - tesseract-ocr-eng 151 - texinfo 152 - xfslibs-dev 153 - zlib1g-dev 154 state: present 155 when: 156 - ansible_facts['distribution'] == 'Ubuntu' 157 - ansible_facts['distribution_version'] == '22.04' 158 159 - name: Install armhf cross-compile packages to build QEMU on AArch64 Ubuntu 22.04 160 package: 161 name: 162 - binutils-arm-linux-gnueabihf 163 - gcc-arm-linux-gnueabihf 164 - libblkid-dev:armhf 165 - libc6-dev:armhf 166 - libffi-dev:armhf 167 - libglib2.0-dev:armhf 168 - libmount-dev:armhf 169 - libpcre2-dev:armhf 170 - libpixman-1-dev:armhf 171 - zlib1g-dev:armhf 172 when: 173 - ansible_facts['distribution'] == 'Ubuntu' 174 - ansible_facts['distribution_version'] == '22.04' 175 - ansible_facts['architecture'] == 'aarch64' 176 177 - name: Enable EPEL repo on EL8 178 dnf: 179 name: 180 - epel-release 181 state: present 182 when: 183 - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS'] 184 - ansible_facts['distribution_major_version'] == '8' 185 186 - name: Enable PowerTools repo on CentOS 8 187 ini_file: 188 path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo 189 section: powertools 190 option: enabled 191 value: "1" 192 when: 193 - ansible_facts['distribution_file_variety'] == 'CentOS' 194 - ansible_facts['distribution_major_version'] == '8' 195 196 - name: Install basic packages to build QEMU on EL8 197 dnf: 198 # This list of packages start with tests/docker/dockerfiles/centos8.docker 199 # but only include files that are common to all distro variants and present 200 # in the standard repos (no add-ons) 201 name: 202 - bzip2 203 - bzip2-devel 204 - capstone-devel 205 - dbus-daemon 206 - device-mapper-multipath-devel 207 - diffutils 208 - gcc 209 - gcc-c++ 210 - genisoimage 211 - gettext 212 - git 213 - glib2-devel 214 - glusterfs-api-devel 215 - gnutls-devel 216 - libaio-devel 217 - libcap-ng-devel 218 - libcurl-devel 219 - libepoxy-devel 220 - libfdt-devel 221 - libgcrypt-devel 222 - libiscsi-devel 223 - libpmem-devel 224 - librados-devel 225 - librbd-devel 226 - libseccomp-devel 227 - libssh-devel 228 - libxkbcommon-devel 229 - lzo-devel 230 - make 231 - mesa-libEGL-devel 232 - nettle-devel 233 - ninja-build 234 - nmap-ncat 235 - numactl-devel 236 - pixman-devel 237 - python38 238 - python3-sphinx 239 - rdma-core-devel 240 - redhat-rpm-config 241 - snappy-devel 242 - spice-glib-devel 243 - systemd-devel 244 - systemtap-sdt-devel 245 - tar 246 - zlib-devel 247 state: present 248 when: 249 - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS'] 250 - ansible_facts['distribution_version'] == '8' 251 252 - name: Install packages only available on x86 and aarch64 253 dnf: 254 # Spice server not available in ppc64le 255 name: 256 - spice-server 257 - spice-server-devel 258 state: present 259 when: 260 - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS'] 261 - ansible_facts['distribution_version'] == '8' 262 - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64' 263 264 - name: Check whether the Python runtime version is managed by alternatives 265 stat: 266 path: /etc/alternatives/python3 267 register: python3 268 269 - name: Set default Python runtime to 3.8 on EL8 270 command: alternatives --set python3 /usr/bin/python3.8 271 when: 272 - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS'] 273 - ansible_facts['distribution_version'] == '8' 274 - python3.stat.islnk and python3.stat.lnk_target != '/usr/bin/python3.8' 275