| 1 | --- |
| 2 | - name: Update apt cache. |
| 3 | apt: update_cache=yes cache_valid_time=86400 |
| 4 | |
| 5 | - name: Add snapshot soures for gcc-11-powerpc/riscv64 |
| 6 | when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '12' |
| 7 | block: |
| 8 | - ansible.builtin.copy: |
| 9 | dest: /etc/apt/preferences.d/snapshot.pref |
| 10 | content: "Package: *\nPin: origin \"snapshot.debian.org\"\nPin-Priority: 400\n" |
| 11 | when: cross_compilers_debian_bookworm_snapshot |
| 12 | - ansible.builtin.apt_repository: |
| 13 | repo: 'deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20230109T091852Z/ bookworm main' |
| 14 | state: "{{cross_compilers_debian_bookworm_snapshot|ternary('present', 'absent')}}" |
| 15 | - ansible.builtin.apt: |
| 16 | update_cache: true |
| 17 | |
| 18 | - name: Ensure cross-compilers packages are installed. |
| 19 | when: cross_compilers_install|default(true) |
| 20 | ansible.builtin.apt: |
| 21 | name: "{{ cross_compilers_packages | difference(lookup('vars', 'cross_compilers_packages_exclude_{{ansible_userspace_architecture|default(ansible_architecture)}}', default=[]))}}" |
| 22 | |
| 23 | - name: Install legacy cross compilers |
| 24 | when: ansible_distribution == 'Debian' and ansible_architecture == 'x86_64' and compilers_legacy_install |
| 25 | block: |
| 26 | # This step needs to happen after the cross compiler packages are installed |
| 27 | # so the libgcc cross libraries can be copied |
| 28 | - name: Copy gcc-cross libs |
| 29 | ansible.builtin.command: |
| 30 | argv: ['cp', '-r', "/usr/lib/gcc-cross/{{item}}/12/", "/usr/lib/gcc-cross/{{item}}/4.8.5"] |
| 31 | creates: "/usr/lib/gcc-cross/{{item}}/4.8.5" |
| 32 | with_items: |
| 33 | - aarch64-linux-gnu |
| 34 | - arm-linux-gnueabihf |
| 35 | - i686-linux-gnu |
| 36 | - powerpc64le-linux-gnu |
| 37 | - powerpc-linux-gnu |
| 38 | - riscv64-linux-gnu |
| 39 | - s390x-linux-gnu |
| 40 | - name: Download gcc-4.8 cross compiler binaries |
| 41 | # These binaries built from files/Containerfile |
| 42 | ansible.builtin.get_url: |
| 43 | url: https://obj.internal.efficios.com/jenkins/gcc-4.8-x86_64-linux-gnu-cross.tgz |
| 44 | dest: /root/gcc-4.8-x86_64-linux-gnu-cross.tgz |
| 45 | register: cross_gcc48_download |
| 46 | - name: Extract gcc-4.8 cross compiler binaries |
| 47 | when: cross_gcc48_download.changed |
| 48 | ansible.builtin.command: |
| 49 | argv: ['tar', '-C', '/', '-xzf', '/root/gcc-4.8-x86_64-linux-gnu-cross.tgz'] |
| 50 | |
| 51 | - name: Download gcc-5.5 cross compiler binaries |
| 52 | ansible.builtin.get_url: |
| 53 | url: https://obj.internal.efficios.com/jenkins/gcc-5.5-x86_64-linux-gnu-cross.tgz |
| 54 | dest: /root/gcc-5.5-x86_64-linux-gnu-cross.tgz |
| 55 | register: cross_gcc55_download |
| 56 | - name: Extract gcc-5.5 cross compiler binaries |
| 57 | when: cross_gcc55_download.changed |
| 58 | ansible.builtin.command: |
| 59 | argv: ['tar', '-xzf', '/root/gcc-5.5-x86_64-linux-gnu-cross.tgz', '-C', '/'] |