aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci/setup/ubuntu/build-environment.yml
blob: edf1900b3ecd5fb8062c610aaa3b48a55a4e7b59 (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
# Copyright (c) 2021 Red Hat, Inc.
#
# Author:
#  Cleber Rosa <crosa@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later.  See the COPYING file in the top-level directory.
#
# This is an ansible playbook file.  Run it to set up systems with the
# environment needed to build QEMU.
---
- name: Installation of basic packages to build QEMU
  hosts: all
  tasks:
    - name: Check for suitable ansible version
      delegate_to: localhost
      assert:
        that:
          - '((ansible_version.major == 2) and (ansible_version.minor >= 8)) or (ansible_version.major >= 3)'
        msg: "Unsuitable ansible version, please use version 2.8.0 or later"

    - name: Add armhf foreign architecture to aarch64 hosts
      command: dpkg --add-architecture armhf
      when:
        - ansible_facts['distribution'] == 'Ubuntu'
        - ansible_facts['architecture'] == 'aarch64'

    - name: Update apt cache / upgrade packages via apt
      apt:
        update_cache: yes
        upgrade: yes
      when:
        - ansible_facts['distribution'] == 'Ubuntu'

    # the package lists are updated by "make lcitool-refresh"
    - name: Include package lists based on OS and architecture
      include_vars:
        file: "ubuntu-2204-{{ ansible_facts['architecture'] }}.yaml"
      when:
        - ansible_facts['distribution'] == 'Ubuntu'
        - ansible_facts['distribution_version'] == '22.04'
        - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'

    - name: Install packages for QEMU on Ubuntu 22.04
      package:
        name: "{{ packages }}"
      when:
        - ansible_facts['distribution'] == 'Ubuntu'
        - ansible_facts['distribution_version'] == '22.04'
        - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'

    - name: Install armhf cross-compile packages to build QEMU on AArch64 Ubuntu 22.04
      package:
        name:
          - binutils-arm-linux-gnueabihf
          - gcc-arm-linux-gnueabihf
          - libblkid-dev:armhf
          - libc6-dev:armhf
          - libffi-dev:armhf
          - libglib2.0-dev:armhf
          - libmount-dev:armhf
          - libpcre2-dev:armhf
          - libpixman-1-dev:armhf
          - zlib1g-dev:armhf
      when:
        - ansible_facts['distribution'] == 'Ubuntu'
        - ansible_facts['distribution_version'] == '22.04'
        - ansible_facts['architecture'] == 'aarch64'